-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Unable to set audio tag attributes #1124
Comments
@sgrove That's definitely something React should do, but the attributes/properties are not listed in However, I must warn you that |
That's great, happy to send the PR later this week. Thanks @syranide, appreciate the speedy response! |
Fixes facebook#1124. I didn't add `volume` because it requires more complicated logic to control properly and I didn't add `paused` because to set it we need to call play() or pause() -- perhaps a mutation method is appropriate.
@sgrove I see that you posted this is 4 years ago, but I also built an MP3 player from React this year and I had the same issue. What worked for me was adding the lifecycle method of componentWillReceiveProps. It solved my issue immediately. componentWillReceiveProps() { |
This is a limitation of the HTML5/javascript API for
<audio>
tags from what I can see, but maybe React can work around it (like it does to normalize<textarea>
tags, etc.)I would like to be able to do something like this pseudo-code:
And have React 1.) pick up on the
muted
attribute change, then 2.) take care of invoking the javascript interfacetargetAudioTag.muted = true/false
. Same for attributespaused
, etc.The text was updated successfully, but these errors were encountered: