简体   繁体   English

如何在单个HTML5全屏模式下显示2个视频

[英]How to show 2 videos in single HTML5 Full-screen mode

I have 2 video tags. 我有2个视频标签。 How can I show a single full-screen mode containing both videos (for example, a video chat, where I want to see my own camera, and my friend's at the same time)? 如何显示包含两个视频的单个全屏模式(例如,视频聊天,我想同时看到自己的相机和朋友的相机)?

Answer 回答

I don't think there is a way to use the fullscreen mode like you want to do right now. 我不认为您可以像现在那样使用全屏模式。

Solution

You can make an element go fullscreen such as a container that wraps the two videos . 您可以使元素变为全屏显示,例如包装两个视频的容器 Supported in Chrome 15, Firefox 10, Safari 5.1, IE 10. 在Chrome 15,Firefox 10,Safari 5.1,IE 10中受支持。

MDN reference to the fullscreen API MDN对全屏API的引用

Other solution 其他解决方案

You could fill the browser you your two video with something like 您可以在浏览器中填充两个视频,例如

#video1, #video2 {
    width: 50%;
    height: 100vh;
    float:left;
}

and somewhere have a little message saying "Put your browser in fullscreen for better experience" or have a button that toggle an almost fullscreen mode like this. 并且在某处有一条小消息,提示“将浏览器置于全屏模式以获得更好的体验”,或者有一个按钮可以切换几乎全屏模式。

<script type="text/javascript">
    window.onload = maxWindow;

    function maxWindow() {
        window.moveTo(0, 0);


        if (document.all) {
            top.window.resizeTo(screen.availWidth, screen.availHeight);
        }

        else if (document.layers || document.getElementById) {
            if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
                top.window.outerHeight = screen.availHeight;
                top.window.outerWidth = screen.availWidth;
            }
        }
    }

</script> 

Code taken from that Stack Overflow answer 从该堆栈溢出答案中获取的代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM