debug
This commit is contained in:
@@ -252,35 +252,47 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
// this.initJyPlayer264(strPlayUrl)
|
||||
},
|
||||
|
||||
initDPlayer(strPlayUrl) {
|
||||
let DomDPlayer = document.getElementById('dplayer')
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
autoplay: true,
|
||||
screenshot: false,
|
||||
//logo: dplayerLogo,
|
||||
video: {
|
||||
url: strPlayUrl,
|
||||
type: 'hls',
|
||||
},
|
||||
pluginOptions: {
|
||||
hls: {
|
||||
maxBufferLength: 600,
|
||||
},
|
||||
},
|
||||
});
|
||||
initDPlayer(strPlayUrl) {
|
||||
let DomDPlayer = document.getElementById('dplayer') || document.querySelector('.dplayer')
|
||||
if (!DomDPlayer) {
|
||||
console.warn('DPlayer 容器不存在')
|
||||
return null
|
||||
}
|
||||
if (!strPlayUrl) {
|
||||
console.warn('DPlayer 播放地址为空')
|
||||
return null
|
||||
}
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
autoplay: true,
|
||||
screenshot: false,
|
||||
//logo: dplayerLogo,
|
||||
video: {
|
||||
url: strPlayUrl,
|
||||
type: 'hls',
|
||||
},
|
||||
pluginOptions: {
|
||||
hls: {
|
||||
maxBufferLength: 600,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
videoPlayer.play()
|
||||
videoPlayer.play()
|
||||
|
||||
|
||||
|
||||
// 监听全屏进入事件
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
});
|
||||
// 监听全屏退出事件
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
});
|
||||
// 监听全屏进入事件
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
if (DomDPlayer.classList) {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
}
|
||||
});
|
||||
// 监听全屏退出事件
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
if (DomDPlayer.classList) {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
}
|
||||
});
|
||||
videoPlayer.on('error', function () {
|
||||
|
||||
});
|
||||
@@ -295,12 +307,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}, 1000); // 等待一会儿确保视频已开始
|
||||
});
|
||||
// 监听当前播放时间
|
||||
videoPlayer.on('timeupdate', function () {
|
||||
if (videoPlayer.video.currentTime < 20) { // 当前时间小于 20 秒
|
||||
videoPlayer.seek(20); // 跳过到 20 秒
|
||||
}
|
||||
});
|
||||
},
|
||||
videoPlayer.on('timeupdate', function () {
|
||||
if (videoPlayer.video.currentTime < 20) { // 当前时间小于 20 秒
|
||||
videoPlayer.seek(20); // 跳过到 20 秒
|
||||
}
|
||||
});
|
||||
return videoPlayer
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
@@ -414,11 +427,19 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
* @param {string} strPlayUrl
|
||||
* @param {boolean} boolIsFirstPlayCctv 是否首次播放广告
|
||||
*/
|
||||
initDPlayer264(strPlayUrl, boolIsFirstPlayCctv = false) {
|
||||
let DomDPlayer = document.getElementById('dplayer')
|
||||
if(videoPlayer == null){
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
initDPlayer264(strPlayUrl, boolIsFirstPlayCctv = false) {
|
||||
let DomDPlayer = document.getElementById('dplayer') || document.querySelector('.dplayer')
|
||||
if (!DomDPlayer) {
|
||||
console.warn('DPlayer 容器不存在')
|
||||
return null
|
||||
}
|
||||
if (!strPlayUrl) {
|
||||
console.warn('DPlayer 播放地址为空')
|
||||
return null
|
||||
}
|
||||
if(videoPlayer == null){
|
||||
videoPlayer = new DPlayer({
|
||||
container: DomDPlayer,
|
||||
autoplay: true,
|
||||
screenshot: false,
|
||||
//logo: dplayerLogo,
|
||||
@@ -438,24 +459,29 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
videoPlayer.play()
|
||||
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
});
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
});
|
||||
videoPlayer.on('fullscreen', function () {
|
||||
if (DomDPlayer.classList) {
|
||||
DomDPlayer.classList.add("dp-fullscreen");
|
||||
}
|
||||
});
|
||||
videoPlayer.on('fullscreen_cancel', function () {
|
||||
if (DomDPlayer.classList) {
|
||||
DomDPlayer.classList.remove("dp-fullscreen");
|
||||
}
|
||||
});
|
||||
videoPlayer.on('error', function () {
|
||||
//videoInfoJs.beforePlay(videoInfoJs.checkPlaylineUrl(videoInfoJs.intPlayLine, strPlayUrl));
|
||||
});
|
||||
videoPlayer.on('play', function () {
|
||||
// if (videoInfoJs.boolIsShowCctvImg || videoInfoJs.boolIsShowCctvVideo) {
|
||||
// if (boolIsFirstPlayCctv && publicJs.strEquipmentCode == 'ios') {
|
||||
videoPlayer.on('play', function () {
|
||||
// if (videoInfoJs.boolIsShowCctvImg || videoInfoJs.boolIsShowCctvVideo) {
|
||||
// if (boolIsFirstPlayCctv && publicJs.strEquipmentCode == 'ios') {
|
||||
// return;
|
||||
// }
|
||||
// videoInfoJs.countDownFn()
|
||||
// }
|
||||
});
|
||||
},
|
||||
// videoInfoJs.countDownFn()
|
||||
// }
|
||||
});
|
||||
return videoPlayer
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
@@ -667,4 +693,3 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
// }));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user