From 3eef73ecb6e8fa36466cd8921a6129c886911138 Mon Sep 17 00:00:00 2001 From: 648540858 <456panlinlin> Date: Sat, 2 Apr 2022 18:19:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9E=E6=97=B6=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E6=97=A0=E6=B3=95=E6=92=AD=E6=94=BE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#427?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dialog/devicePlayer.vue | 4 +- web_src/src/components/dialog/jessibuca.vue | 67 ++++++++++++------- web_src/src/components/live.vue | 2 +- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index effd389d..2eb3acb4 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -3,7 +3,9 @@ - +
+ +
diff --git a/web_src/src/components/dialog/jessibuca.vue b/web_src/src/components/dialog/jessibuca.vue index e719c2b0..339d3a24 100644 --- a/web_src/src/components/dialog/jessibuca.vue +++ b/web_src/src/components/dialog/jessibuca.vue @@ -1,25 +1,22 @@ @@ -46,15 +43,20 @@ export default { forceNoOffscreen: false, }; }, - props: ['videoUrl', 'error', 'hasAudio', 'height'], + props: ['containerId','videoUrl', 'error', 'hasAudio', 'height'], mounted () { window.onerror = (msg) => { // console.error(msg) }; let paramUrl = decodeURIComponent(this.$route.params.url) this.$nextTick(() =>{ - let dom = document.getElementById("container"); - dom.style.height = (9/16 ) * dom.clientWidth + "px" + let dom = document.getElementById(this.containerId); + if (dom.parentNode.clientHeight == 0) { + dom.style.height = (9/16 ) * dom.clientWidth + "px" + } + dom.style.height = dom.parentNode.clientHeight + "px"; + dom.style.width = dom.parentNode.clientWidth + "px"; + if (typeof (this.videoUrl) == "undefined") { this.videoUrl = paramUrl; } @@ -72,12 +74,12 @@ export default { methods: { create(){ let options = {}; - console.log(this.$refs.container) + console.log(this.$refs[this.containerId]) console.log("hasAudio " + this.hasAudio) this.jessibuca = new window.Jessibuca(Object.assign( { - container: this.$refs.container, + container: this.$refs[this.containerId], videoBuffer: 0.2, // 最大缓冲时长,单位秒 isResize: true, decoder:"static/js/jessibuca/decoder.js", @@ -198,6 +200,19 @@ export default { }); }, + resize(){ + if (this.jessibuca){ + this.jessibuca.resize() + this.$nextTick(() =>{ + let dom = document.getElementById(this.containerId); + if (dom.parentNode.clientHeight == 0) { + dom.style.height = (9/16 ) * dom.clientWidth + "px" + } + dom.style.height = dom.parentNode.clientHeight + "px"; + dom.style.width = dom.parentNode.clientWidth + "px"; + }) + } + }, playBtnClick: function (event){ this.play(this.videoUrl) }, diff --git a/web_src/src/components/live.vue b/web_src/src/components/live.vue index 3c910583..82575276 100644 --- a/web_src/src/components/live.vue +++ b/web_src/src/components/live.vue @@ -33,7 +33,7 @@ >
{{i}}
+ :containerId="'player'+i" @screenshot="shot" @destroy="destroy">