samedi 3 janvier 2015

iOS WebView Youtube inline-Video


I want to play an youtube-video inline inside a WebView in an iPhone App.

In the youtube iframe-api I use the parameter "'playsinline': 1".

When I inspect the video-tag inside safari devtools, in the video-tag the



webkit-playsinline


attribute is set correctly (...but the value is missing).

Anyhow, the video plays not inline, but still switches to Quicktime.

Though, when I execute



document.getElementsByClassName('html5-main-video')[0].setAttribute('webkit-playsinline','1')


via the Safari devtools in the context of the youtube iframe, it looks like:



webkit-playsinline=1


and the video is finally played inline.

Now I am wondering if this is a bug, and if there is a workaround to inject JS into the youtube iframe from a method of the Webview, like it is possible with Safari Devtools.





Aucun commentaire:

Enregistrer un commentaire