Closed philhenri closed 8 years ago
Unfortunately not. This needs direct access to the <video>
element, but YouTube embeds don't allow that.
ok thanks.
@bfred-it do you think it could be hacked to work? Just curious before I'd dive in to the challenge.
It can't because the document loaded in the iframe has a different origin and you can't do absolutely anything with it, other than using postMessage (which is what the YouTube API uses)
Well, there is half a solution, but it requires you to link directly to the mp4 on YouTube servers, which means you lose the YouTube player and its API. Also the URL could change at any time and your video would break.
https://github.com/endlesshack/youtube-video
http://stackoverflow.com/questions/8402457/how-to-get-direct-url-for-youtube-videos
Maybe if the videos were streamed using a proxy like this: https://github.com/licson0729/node-YouTubeStreamer
That way, you'd access the videos by specifying a youtubeID.
On a side note: the youtube iframe API on iOS10 devices already plays inline, but not sure about autoplay
The proxy output is not different from what I described just before your comment and suffers of the same breaks-if-API-changes issue, unfortunately.
HI help wanted: will this work embedding youtube videos? thanks philipe