fregante / iphone-inline-video

📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)
https://npm.im/iphone-inline-video
MIT License
2.05k stars 297 forks source link

help wanted: will this work embedding youtube videos? #58

Closed philhenri closed 8 years ago

philhenri commented 8 years ago

HI help wanted: will this work embedding youtube videos? thanks philipe

fregante commented 8 years ago

Unfortunately not. This needs direct access to the <video> element, but YouTube embeds don't allow that.

philhenri commented 8 years ago

ok thanks.

oskarrough commented 8 years ago

@bfred-it do you think it could be hacked to work? Just curious before I'd dive in to the challenge.

fregante commented 8 years ago

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)

fregante commented 8 years ago

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

GordanRatkovic commented 8 years ago

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

fregante commented 8 years ago

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.