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">