-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for audio/video attributes #2094
Conversation
srcSet: 'srcset' | ||
}, | ||
DOMMutationMethods: { | ||
playing: function(node, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to support an API like this, it should be paused
to mirror the DOM API – but this is tricky because when the media reaches the end, it'll stop playing causing the element to get out of sync with the specified prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spicyj I agree - paused makes more sense than playing
It doesn't, but I believe HTML attributes (unlike SVG, for example) are always case-insensitive so the mapping isn't necessary. |
Perhaps the paused state should be handled in a DOM wrapper to make sure the state stays in sync |
does this add support for media events (canplaythrough, durationchange) as synthetic events? |
@daniellewissc No, this only adds support for attributes. When I have time I'll work on adding full event support as well |
|
@syranide There are other non DOM markup attributes that are supported. There seems to be a discrepancy between implementation and reality that should be ironed out either by adding all attributes or documenting why they shouldn't be supported. |
@contra Hmm? Which ones. The only ones I know of are |
|
Let's get the non-markup attributes removed and then we can move forward. |
}, | ||
DOMMutationMethods: { | ||
paused: function(node, value) { | ||
if (value === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe node[value ? 'pause' : 'play']()
or value ? node.pause() : node.play()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I assume this is a supported attribute (or else it should be removed), not using DOMMutationMethods
at all and setting the attribute (as implemented by the standard) instead seems favorable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://www.w3.org/TR/html-markup/video.html says it doesn't exist, so it shouldn't in React either.
http://www.w3.org/TR/2012/WD-html5-20121025/media-elements.html#mediaevents Are there new events we should support? (I'm not really familiar with the new media elements) |
We can't take this as-is so I'm closing this out – if you do want to remove the non-attribute property names and rebase, I think we can take this though. |
Seems like a step in the wrong direction IMO I hope this get rethought in the future |
@contra Ambigious behavior is best handled by community components, put audio/video in a component of your own and you're free to do what you want with the properties. Anything React could do that you can too. |
currentTime
property for controlling position in a video or audio elementvolume
property for controlling volume in a video or audio elementpaused
mutation method for controlling play/pause state in a video or audio elementplaybackRate
property for controlling playback speed in a video or audio elementsrcObject
property for setting a WebRTC stream on a video elementkind
property/attribute for track elementsrcLang
property/attribute for track elementRelated: #1128 #1474 #2090