Closed funwithtriangles closed 4 years ago
So by the looks of things... this library is abandoned.
I've figured out why it's not working anymore. There's no need to hack the library just set mute:1. It is a problem with Youtube's API, you can't autoplay without muting the sound at the same time. So setting the ModalVideo props like that will do the trick:
<ModalVideo
channel="youtube"
youtube={{
autoplay: 1,
mute: 1
}}
...
/>
youtube={{ autoplay: 1, mute: 1 }}
That works, but this is really silly. The video is already in a modal window that the user needs to click to open. Autoplaying a video on mute completely bombs the user experience.
Using
?autoplay=1
no longer seems to work with YouTube videos.I managed to get it working by removing any config from the
videoId
prop and hacking a version of this library so that the iFrame element has this attribute:I think the way to fix this would be to have a new prop such as
youtubeAutoplay
so that the above attribute is added to the iframe.Related issue on Stack Overflow: https://stackoverflow.com/questions/48086769/youtube-iframe-api-allow-autoplay-chrome-65