|
@ -1,6 +1,5 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div id="jessibuca" style="width: auto; height: auto"> |
|
|
<div :id="containerId" :ref="containerId" style="width: 100%;height: auto; background-color: #000" @dblclick="fullscreenSwich"> |
|
|
<div id="container" ref="container" style="width: 100%; height: 10rem; background-color: #000" @dblclick="fullscreenSwich"> |
|
|
|
|
|
<div class="buttons-box" id="buttonsBox"> |
|
|
<div class="buttons-box" id="buttonsBox"> |
|
|
<div class="buttons-box-left"> |
|
|
<div class="buttons-box-left"> |
|
|
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> |
|
|
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> |
|
@ -19,8 +18,6 @@ |
|
|
<i v-if="fullscreen" class="iconfont icon-weibiaoti11 jessibuca-btn" @click="fullscreenSwich"></i> |
|
|
<i v-if="fullscreen" class="iconfont icon-weibiaoti11 jessibuca-btn" @click="fullscreenSwich"></i> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
@ -46,15 +43,20 @@ export default { |
|
|
forceNoOffscreen: false, |
|
|
forceNoOffscreen: false, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
props: ['videoUrl', 'error', 'hasAudio', 'height'], |
|
|
props: ['containerId','videoUrl', 'error', 'hasAudio', 'height'], |
|
|
mounted () { |
|
|
mounted () { |
|
|
window.onerror = (msg) => { |
|
|
window.onerror = (msg) => { |
|
|
// console.error(msg) |
|
|
// console.error(msg) |
|
|
}; |
|
|
}; |
|
|
let paramUrl = decodeURIComponent(this.$route.params.url) |
|
|
let paramUrl = decodeURIComponent(this.$route.params.url) |
|
|
this.$nextTick(() =>{ |
|
|
this.$nextTick(() =>{ |
|
|
let dom = document.getElementById("container"); |
|
|
let dom = document.getElementById(this.containerId); |
|
|
|
|
|
if (dom.parentNode.clientHeight == 0) { |
|
|
dom.style.height = (9/16 ) * dom.clientWidth + "px" |
|
|
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") { |
|
|
if (typeof (this.videoUrl) == "undefined") { |
|
|
this.videoUrl = paramUrl; |
|
|
this.videoUrl = paramUrl; |
|
|
} |
|
|
} |
|
@ -72,12 +74,12 @@ export default { |
|
|
methods: { |
|
|
methods: { |
|
|
create(){ |
|
|
create(){ |
|
|
let options = {}; |
|
|
let options = {}; |
|
|
console.log(this.$refs.container) |
|
|
console.log(this.$refs[this.containerId]) |
|
|
console.log("hasAudio " + this.hasAudio) |
|
|
console.log("hasAudio " + this.hasAudio) |
|
|
|
|
|
|
|
|
this.jessibuca = new window.Jessibuca(Object.assign( |
|
|
this.jessibuca = new window.Jessibuca(Object.assign( |
|
|
{ |
|
|
{ |
|
|
container: this.$refs.container, |
|
|
container: this.$refs[this.containerId], |
|
|
videoBuffer: 0.2, // 最大缓冲时长,单位秒 |
|
|
videoBuffer: 0.2, // 最大缓冲时长,单位秒 |
|
|
isResize: true, |
|
|
isResize: true, |
|
|
decoder:"static/js/jessibuca/decoder.js", |
|
|
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){ |
|
|
playBtnClick: function (event){ |
|
|
this.play(this.videoUrl) |
|
|
this.play(this.videoUrl) |
|
|
}, |
|
|
}, |
|
|