Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
677 views
in Technique[技术] by (71.8m points)

IOS Video.js 在全屏下退出全屏失效?

IOS Video.js 在全屏下退出全屏失效?或者说有什么其它好的退出全屏的方法吗?

//退出全屏
  function exitFull() {
            var exitMethod =
                document.mozCancelFullScreen || //Chrome等
                document.webkitExitFullscreen || //FireFox
                document.webkitExitFullscreen || //IE11
                document.exitFullscreen; //W3C
            if (exitMethod) {
                exitMethod.call(document);
            } else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
                var wscript = new ActiveXObject("WScript.Shell");
                if (wscript !== null) {
                    wscript.SendKeys("{F11}");
                }
            }
        }
//player
let player = videojs('my-video', {
                controls: true, // 是否显示控制条
                poster: 'http://xxx', // 视频封面图地址
                preload: 'auto',
                autoplay: false,
                fluid: true, // 自适应宽高
                language: 'zh-CN', // 设置语言
                muted: false, // 是否静音
                inactivityTimeout: false,
                controlBar: { // 设置控制条组件
                    //  设置控制条里面组件的相关属性及显示与否
                    // 'currentTimeDisplay': true,
                    // 'timeDivider': true,
                    // 'durationDisplay': true,
                    // 'remainingTimeDisplay': false,
                    /* 使用children的形式可以控制每一个控件的位置,以及显示与否 */
                    children: [{
                            name: 'playToggle'
                        }, // 播放按钮
                        {
                            name: 'currentTimeDisplay'
                        }, // 当前已播放时间
                        {
                            name: 'progressControl'
                        }, // 播放进度条
                        {
                            name: 'durationDisplay'
                        }, // 总时间
                        {
                            name: 'FullscreenToggle'
                        },
                        {
                            name: 'volumePanel', // 音量控制
                            inline: false, // 使用水平方式
                        }
                    ]
                },
                sources: [ // 视频源
                    {
                        src: './video.mp4',
                        type: 'video/mp4',
                        poster: '//xxxxx'
                    }
                ]
            }, function () {
                console.log('视频可以播放了', this);
                this.on('timeupdate', function () {
                    if (this.currentTime() > 3) {
                        exitFull();
                        this.pause();
                    }
                })
            });

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...