Mui移动端视频自动全屏方法

2019-09-19 10:34:35 浏览数 (1)

代码语言:javascript复制
var player_flg =false;
//视频初始化完成
player.on('complete', function() {
	//$('#mse .xgplayer-fullscreen').trigger("click"); 
	lockOrientation(); 
})

//强制横屏及全屏
function lockOrientation(){
	mui.plusReady(function() {
		plus.navigator.setFullscreen(true); 
		plus.screen.lockOrientation("landscape-primary"); 
		$('#mse .xgplayer-fullscreen').css('display','none');
		$("#videoPlayBox").show();
		$(".wrap-top").hide();
	});
}

//返回
mui.plusReady(function() {
	plus.screen.lockOrientation("portrait-primary");
	var old_back = mui.back;
	mui.back = function(){  
		if(player_flg){
			player.destroy();
			plus.screen.lockOrientation("portrait-primary");
			$("#videoPlayBox").hide();
			$(".wrap-top").show();
			player_flg = false;
		}else{
			console.log("back");
			old_back();
		}
	}  
})

0 人点赞