开发者

Mobile Safari video question

开发者 https://www.devze.com 2023-01-31 19:27 出处:网络
I\'m playing with the iPhone\'s Safari HTML5 <video> tag and I was wondering if there\'s a way to programmatically quit fullscreen mode once the video is done playing?

I'm playing with the iPhone's Safari HTML5 <video> tag and I was wondering if there's a way to programmatically quit fullscreen mode once the video is done playing?

You start 开发者_如何学Pythonfullscreen mode using the play()-function, but how do you end it?

Thanks in advance, Thomas


Use the "ended" event and the webkitExitFullScreen() method.

If you are using jQuery this is how you would do that:

// #video is the ID of the <video> element.    
$('#video').bind('ended', function() 
    {   
       var videoEl = document.getElementById('video');  
       videoEl.webkitExitFullScreen()

    });

The trick is sending video into fullscreen mode and playing the video all with one click on a thumbnail. For the life of me I can't figure that out!

0

精彩评论

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