From 67534a1f163ac15db49166607d855ea680227aa9 Mon Sep 17 00:00:00 2001 From: "zhuangpeng.li" <908349383@qq.com> Date: Fri, 12 Jul 2024 12:52:08 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=92=AD=E6=94=BE=E5=99=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/player/deviceLiveStream.vue | 3 +- vue/src/views/components/player/player.vue | 59 +++++++------------ 2 files changed, 24 insertions(+), 38 deletions(-) diff --git a/vue/src/views/components/player/deviceLiveStream.vue b/vue/src/views/components/player/deviceLiveStream.vue index d78929c7..9efb0eb4 100644 --- a/vue/src/views/components/player/deviceLiveStream.vue +++ b/vue/src/views/components/player/deviceLiveStream.vue @@ -137,8 +137,9 @@ export default { } this.$refs.player.registercallback('loadingTimeout', 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) { - + } else { startPlay(this.deviceId, this.channelId).then((response) => { console.log('开始推流: [' + this.streamId + ']'); diff --git a/vue/src/views/components/player/player.vue b/vue/src/views/components/player/player.vue index 611646d9..31aef135 100644 --- a/vue/src/views/components/player/player.vue +++ b/vue/src/views/components/player/player.vue @@ -46,7 +46,9 @@ export default { if (this.playinfo && this.playinfo.playtype !== '') { this.playtype = this.playinfo.playtype; } - this.init(); + this.$nextTick(() => { + this.init(); + }) }, methods: { init() { @@ -58,19 +60,12 @@ export default { console.log('暂不支持webGPU,降级到webgl渲染'); this.useWebGPU = false; } - - const useVconsole = this.isMobile() || this.isPad(); - if (useVconsole && window.VConsole) { - new window.VConsole(); - } - this.$forceUpdate(() => { - this.initplayer(); - }); + this.initplayer(); }, initplayer() { this.isPlaybackPause = false; this.initconf(); - jessibucaPlayer[this._uid] = new window.Jessibuca({ + let options = { container: this.$refs.container, decoder: '/js/jessibuca/decoder.js', videoBuffer: Number(0.2), // 缓存时长 @@ -80,19 +75,17 @@ export default { useSIMD: true, wcsUseVideoRender: false, loadingText: '加载中', - debug: false, - debugLevel: "debug", + debug: true, showBandwidth: true, // 显示网速 showPlaybackOperate: true, operateBtns: this.operateBtns, forceNoOffscreen: true, isNotMute: false, showPerformance: false, - // playFailedAndReplay: true, - // networkDelayTimeoutReplay: true, - playbackForwardMaxRateDecodeIFrame: 4, - useWebGPU: this.useWebGPU, // 使用WebGPU - }); + useWebGPU: this.useWebGPU, + }; + jessibucaPlayer[this._uid] = new window.Jessibuca({...options}); + console.log('initplayer2'); let jessibuca = jessibucaPlayer[this._uid]; this.initcallback(jessibuca); this.isInit = true; @@ -102,17 +95,13 @@ export default { //直播按钮配置 this.operateBtns = { fullscreen: true, - zoom: true, - ptz: true, play: true, }; } else { //录像回放按钮配置 this.operateBtns = { fullscreen: true, - zoom: true, play: true, - ptz: false, }; } }, @@ -151,22 +140,18 @@ export default { jessibuca.on('timeout', function (error) { console.log('timeout:', error); }); - jessibuca.on('playbackPreRateChange', (rate) => { - jessibuca.forward(rate); - }); - - let pre = 0; - let cur = 0; - jessibuca.on('timeUpdate', function (ts) { - cur = parseInt(ts / 60000); - if (pre !== cur) { - pre++; - } - }); - jessibuca.on(JessibucaPro.EVENTS.ptz, (arrow) => { - console.log('ptz arrow', arrow); - _this.handlePtz(arrow); - }); + // let pre = 0; + // let cur = 0; + // jessibuca.on('timeUpdate', function (ts) { + // cur = parseInt(ts / 60000); + // if (pre !== cur) { + // pre++; + // } + // }); + // jessibuca.on("ptz", (arrow) => { + // console.log('ptz arrow', arrow); + // _this.handlePtz(arrow); + // }); jessibuca.on('crashLog', (data) => { console.log('crashLog is', data); });