开发者

youtube videos autoplay on iphone phonegap app

开发者 https://www.devze.com 2023-04-12 12:29 出处:网络
In phonegap if开发者_StackOverflow中文版 you embed a video you come up with a bad scrolling (if you scroll the page with a finger on the video thumbnail, the whole viewport scrolls, instead of the cor

In phonegap if开发者_StackOverflow中文版 you embed a video you come up with a bad scrolling (if you scroll the page with a finger on the video thumbnail, the whole viewport scrolls, instead of the correct div). To avoid this I'm trying to use a thumbnail image with a play button in its center: when the play button is pushed a js code renders an hidden div with an object tag inside (that's the video). The coolest thing at this point would be to let the video load on top of the fake thumbnail and autoplay (so the control goes automatically to the native youtube app)!

Everything works in my code, except for the autoplay: I've tried both the autoplay and autostart params:

<object style="margin-left:0px;margin-top:10px;" id="video" width="296" height="222" data="http://www.youtube.com/v/R6Z7xceSLy4" type="application/x-shockwave-flash">
    <param name="allowfullscreen" value="true" />
    <param name="autoplay" value="true">
    <param name="autoStart" value="0">
    <param name="wmode" value="transparent" />
    <param name="src" value="http://www.youtube.com/v/R6Z7xceSLy4" />
</object>

and the &autoplay=1 or ?autoplay=1 trailing in the video address (I read somewhere that the '&' for some reason should be replaced by '?')

<object style="margin-left:0px;margin-top:10px;" id="video" width="296" height="222" data="http://www.youtube.com/v/R6Z7xceSLy4?autoplay=1" type="application/x-shockwave-flash">
    <param name="allowfullscreen" value="true" />
    <param name="autoplay" value="true">
    <param name="autoStart" value="0">
    <param name="wmode" value="transparent" />
    <param name="src" value="http://www.youtube.com/v/R6Z7xceSLy4?autoplay=1" />
</object>

Do you have any suggestion? Another thing I thought to resolve my problem was to launch automatically the video in the youtube native app on play button push. I've tryed using

window.location = 'http://www.youtube.com/v/R6Z7xceSLy4';

everything seems correct, except that when done it doesn't give the control back to my app but it remains stucked in youtube app. Can anybody help please?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号