开发者

Firefox/Gecko fullscreen API with HTML5 Video (javascript/jQuery)

I'm wondering if anyone can provide me with example javascript/jquery code of how to use Firefox's new fullscreen (NOT just full window) mode API (see link below). Basically i'd like to click something that would cause the video to go full screen.

Based on the API it looks like i should be able to do something like what i know works in Safari 开发者_StackOverflow(and Dev builds of Chrome):

$(function(){
    $('#full').click(function(){
        var video_player = document.getElementById("video");
        video_player.onwebkitfullscreenchange = function (){}; 
        video_player.webkitRequestFullScreen();
    });
});       

UPDATE As suggested by Alexander, tonight (11/10/11) I installed the "Nightly" build of Firefox 10 and the following code now works:

$(function(){
    $('#full').click(function(){
        var video_player = document.getElementById("video");           
        void video_player.mozRequestFullScreen(); //firefox nightly build as of 11/10/11
    });
}); 

http://blog.pearce.org.nz/2011/11/firefoxs-html-full-screen-api-enabled.html

https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI#requestFullScreen_method


This feature is currently not part of FF 7/8/9. It will be implemented with FF10, you will have to wait for 6-8 weeks to test your code in the aurora channel. You can also use the nightly channel

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜