带有 HTML5 视频的 Firefox/Gecko 全屏 API (javascript/jQuery)

发布于 2024-12-08 00:34:12 字数 1176 浏览 0 评论 0原文

我想知道是否有人可以向我提供如何使用 Firefox 新的全屏(不仅仅是全窗口)模式 API 的示例 javascript/jquery 代码(请参阅下面的链接)。基本上我想单击一些会使视频全屏显示的内容。

基于API,看起来我应该能够做一些我知道在Safari(和Chrome的开发版本)中工作的事情:

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

更新正如亚历山大建议的那样,今晚(11/10/11)我安装了 Firefox 10 的“Nightly”版本,以下代码现在可以运行:

$(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

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 (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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅笑依然 2024-12-15 00:34:12

该功能目前不属于 FF 7/8/9。它将在 FF10 中实现,您需要等待 6-8 周才能在 极光频道。您还可以使用夜间频道

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文