赞
踩
首先APP需要安装X5核心,然后在你的播放器代码类添加相关代码
在里面加入下面代码
var isMobile = !!navigator.userAgent.match(/AppleWebKit.*Mobile.*/);
if (isMobile) {
//全屏事件
dp.on('fullscreen',function() {
screen.orientation.lock("landscape");
});
//退出全屏事件
dp.on('fullscreen_cancel',function() {
screen.orientation.unlock();
});
}
代码里面的dp.on 这个dp要看你个人定义播放器名称
var isMobile = !!navigator.userAgent.match(/AppleWebKit.*Mobile.*/);
if (isMobile) {
//全屏事件
player.on('requestFullScreen',function() {
screen.orientation.lock("landscape");
});
//退出全屏事件
player.on('cancelFullScreen',function() {
screen.orientation.unlock();
});
}
代码里面的player.on 这个player要看你个人定义播放器名称
找到你要使用播放器全屏 事件绑定 screen.orientation.lock(“landscape”);
退出全屏事件绑定 screen.orientation.unlock();
理轮上所有的H5播放器都能自动横屏
screen.orientation
https://developer.mozilla.org/zh-CN/docs/Web/API/Screen/orientation
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。