1.播放器修改

This commit is contained in:
zhuangpeng.li
2024-07-12 12:52:08 +08:00
parent 841db27f80
commit 67534a1f16
2 changed files with 24 additions and 38 deletions

View File

@@ -137,6 +137,7 @@ export default {
} }
this.$refs.player.registercallback('loadingTimeout', this.TimeoutCallback); this.$refs.player.registercallback('loadingTimeout', this.TimeoutCallback);
this.$refs.player.registercallback('delayTimeout', this.TimeoutCallback); this.$refs.player.registercallback('delayTimeout', this.TimeoutCallback);
// this.$refs.player.play("https://sample-videos.com/video321/flv/480/big_buck_bunny_480p_1mb.flv");
if (this.playrecord) { if (this.playrecord) {
} else { } else {

View File

@@ -46,7 +46,9 @@ export default {
if (this.playinfo && this.playinfo.playtype !== '') { if (this.playinfo && this.playinfo.playtype !== '') {
this.playtype = this.playinfo.playtype; this.playtype = this.playinfo.playtype;
} }
this.$nextTick(() => {
this.init(); this.init();
})
}, },
methods: { methods: {
init() { init() {
@@ -58,19 +60,12 @@ export default {
console.log('暂不支持webGPU降级到webgl渲染'); console.log('暂不支持webGPU降级到webgl渲染');
this.useWebGPU = false; this.useWebGPU = false;
} }
const useVconsole = this.isMobile() || this.isPad();
if (useVconsole && window.VConsole) {
new window.VConsole();
}
this.$forceUpdate(() => {
this.initplayer(); this.initplayer();
});
}, },
initplayer() { initplayer() {
this.isPlaybackPause = false; this.isPlaybackPause = false;
this.initconf(); this.initconf();
jessibucaPlayer[this._uid] = new window.Jessibuca({ let options = {
container: this.$refs.container, container: this.$refs.container,
decoder: '/js/jessibuca/decoder.js', decoder: '/js/jessibuca/decoder.js',
videoBuffer: Number(0.2), // 缓存时长 videoBuffer: Number(0.2), // 缓存时长
@@ -80,19 +75,17 @@ export default {
useSIMD: true, useSIMD: true,
wcsUseVideoRender: false, wcsUseVideoRender: false,
loadingText: '加载中', loadingText: '加载中',
debug: false, debug: true,
debugLevel: "debug",
showBandwidth: true, // 显示网速 showBandwidth: true, // 显示网速
showPlaybackOperate: true, showPlaybackOperate: true,
operateBtns: this.operateBtns, operateBtns: this.operateBtns,
forceNoOffscreen: true, forceNoOffscreen: true,
isNotMute: false, isNotMute: false,
showPerformance: false, showPerformance: false,
// playFailedAndReplay: true, useWebGPU: this.useWebGPU,
// networkDelayTimeoutReplay: true, };
playbackForwardMaxRateDecodeIFrame: 4, jessibucaPlayer[this._uid] = new window.Jessibuca({...options});
useWebGPU: this.useWebGPU, // 使用WebGPU console.log('initplayer2');
});
let jessibuca = jessibucaPlayer[this._uid]; let jessibuca = jessibucaPlayer[this._uid];
this.initcallback(jessibuca); this.initcallback(jessibuca);
this.isInit = true; this.isInit = true;
@@ -102,17 +95,13 @@ export default {
//直播按钮配置 //直播按钮配置
this.operateBtns = { this.operateBtns = {
fullscreen: true, fullscreen: true,
zoom: true,
ptz: true,
play: true, play: true,
}; };
} else { } else {
//录像回放按钮配置 //录像回放按钮配置
this.operateBtns = { this.operateBtns = {
fullscreen: true, fullscreen: true,
zoom: true,
play: true, play: true,
ptz: false,
}; };
} }
}, },
@@ -151,22 +140,18 @@ export default {
jessibuca.on('timeout', function (error) { jessibuca.on('timeout', function (error) {
console.log('timeout:', error); console.log('timeout:', error);
}); });
jessibuca.on('playbackPreRateChange', (rate) => { // let pre = 0;
jessibuca.forward(rate); // let cur = 0;
}); // jessibuca.on('timeUpdate', function (ts) {
// cur = parseInt(ts / 60000);
let pre = 0; // if (pre !== cur) {
let cur = 0; // pre++;
jessibuca.on('timeUpdate', function (ts) { // }
cur = parseInt(ts / 60000); // });
if (pre !== cur) { // jessibuca.on("ptz", (arrow) => {
pre++; // console.log('ptz arrow', arrow);
} // _this.handlePtz(arrow);
}); // });
jessibuca.on(JessibucaPro.EVENTS.ptz, (arrow) => {
console.log('ptz arrow', arrow);
_this.handlePtz(arrow);
});
jessibuca.on('crashLog', (data) => { jessibuca.on('crashLog', (data) => {
console.log('crashLog is', data); console.log('crashLog is', data);
}); });