问题遇到的现象和发生背景
视频ios系统15,播放一秒后无视频内容
问题相关代码,请勿粘贴截图
//创建监控对象
initEZUIKit(id, ez, historyIndex) {
clearTimeout(this.timeOut)
let hd = ""
if (ez.hd == 1) {
hd = ".hd"
}
let that = this;
that.historyIndex = historyIndex ;
///update 当play_type 为0时,使用萤石云播放器;当play_type为1时,首选判断是ios浏览器还是android浏览器,如果是ios浏览器,使用video标签播放字段hls;如果是Android浏览器,使用flv.js播放器播放字段flv
if(this.oldPlayMethod!=1){
if( ez.playType == "1"){
console.log("initEZUIKit id,type,hls,flv", id,ez.playType, ez.hls,ez.flv) ;
let element = document.getElementById(id) ;
//首选判断是ios浏览器
//debug video 测试用户
// ez.hls = "https://img.dilingtech.cn/video/AD380DA969F78B7D6F15C4841F4F2CE2-300-wm.mp4";
// ez.hls = "http://cctvalih5ca.v.myalicdn.com/live/cctv1_2/index.m3u8";
if(this.isiOS && ez.hls){
element.innerHTML = `<video id="${id+'video'}" autoplay width="100%" height="100%" controls preload='none' webkit-playsinline playsinline>
<source src="${ez.hls}" type="application/x-mpegURL" >
</video>` ;
console.log('ios play with video');
ez.isPlay = true;
that.playSuccess = true ;
that.timeOut = setTimeout(()=> {
clearTimeout(that.timeOut);
let video = document.getElementById(id+'video') ;
that.myPlay = {
stop:function(){
that.playSuccess = false ;
video.pause();
},
play:function(){
that.playSuccess = true ;
video.play();
},
// fullScreen:function(){ },
};
that.myPlay = {
stop: new Promise(function(resolve, reject) {
console.log("--video stop ");
video.pause();
resolve() ;
}),
// fullScreen:function(){ video.requestFullscreen();},
};
that.capturePictureCheckMonitor(ez, that.myPlay, 1)
}, 3000) ;
return ;
} else {
if (flvjs.isSupported()) {
console.log('android play with flvjs') ;
......
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
ios任何系统视频可以播放