#510 jessibuca分屏监控异常

pull/524/head
648540858 2022-06-13 23:02:53 +08:00
parent 6d4312e383
commit c827d1518b
1 changed files with 18 additions and 17 deletions

View File

@ -23,7 +23,7 @@
</template> </template>
<script> <script>
let jessibuca = null; let jessibucaPlayer = {};
export default { export default {
name: 'jessibuca', name: 'jessibuca',
data() { data() {
@ -49,6 +49,7 @@ export default {
window.onerror = (msg) => { window.onerror = (msg) => {
// console.error(msg) // console.error(msg)
}; };
console.log(this._uid)
let paramUrl = decodeURIComponent(this.$route.params.url) let paramUrl = decodeURIComponent(this.$route.params.url)
this.$nextTick(() => { this.$nextTick(() => {
this.updatePlayerDomSize() this.updatePlayerDomSize()
@ -88,7 +89,7 @@ export default {
let options = {}; let options = {};
console.log("hasAudio " + this.hasAudio) console.log("hasAudio " + this.hasAudio)
jessibuca = new window.Jessibuca(Object.assign( jessibucaPlayer[this._uid] = new window.Jessibuca(Object.assign(
{ {
container: this.$refs.container, container: this.$refs.container,
videoBuffer: 0.2, // videoBuffer: 0.2, //
@ -117,7 +118,7 @@ export default {
}, },
options options
)); ));
let jessibuca = jessibucaPlayer[this._uid];
let _this = this; let _this = this;
jessibuca.on("load", function () { jessibuca.on("load", function () {
console.log("on load init"); console.log("on load init");
@ -216,40 +217,40 @@ export default {
}, },
play: function (url) { play: function (url) {
console.log(url) console.log(url)
if (jessibuca) { if (jessibucaPlayer[this._uid]) {
this.destroy(); this.destroy();
} }
this.create(); this.create();
jessibuca.on("play", () => { jessibucaPlayer[this._uid].on("play", () => {
this.playing = true; this.playing = true;
this.loaded = true; this.loaded = true;
this.quieting = jessibuca.quieting; this.quieting = jessibuca.quieting;
}); });
if (jessibuca.hasLoaded()) { if (jessibucaPlayer[this._uid].hasLoaded()) {
jessibuca.play(url); jessibucaPlayer[this._uid].play(url);
} else { } else {
jessibuca.on("load", () => { jessibucaPlayer[this._uid].on("load", () => {
console.log("load 播放") console.log("load 播放")
jessibuca.play(url); jessibucaPlayer[this._uid].play(url);
}); });
} }
}, },
pause: function () { pause: function () {
if (jessibuca) { if (jessibucaPlayer[this._uid]) {
jessibuca.pause(); jessibucaPlayer[this._uid].pause();
} }
this.playing = false; this.playing = false;
this.err = ""; this.err = "";
this.performance = ""; this.performance = "";
}, },
destroy: function () { destroy: function () {
if (jessibuca) { if (jessibucaPlayer[this._uid]) {
jessibuca.destroy(); jessibucaPlayer[this._uid].destroy();
} }
if (document.getElementById("buttonsBox") == null) { if (document.getElementById("buttonsBox") == null) {
this.$refs.container.appendChild(this.btnDom) this.$refs.container.appendChild(this.btnDom)
} }
jessibuca = null; jessibucaPlayer[this._uid] = null;
this.playing = false; this.playing = false;
this.err = ""; this.err = "";
this.performance = ""; this.performance = "";
@ -262,7 +263,7 @@ export default {
}, },
fullscreenSwich: function () { fullscreenSwich: function () {
let isFull = this.isFullscreen() let isFull = this.isFullscreen()
jessibuca.setFullscreen(!isFull) jessibucaPlayer[this._uid].setFullscreen(!isFull)
this.fullscreen = !isFull; this.fullscreen = !isFull;
}, },
isFullscreen: function () { isFullscreen: function () {
@ -273,8 +274,8 @@ export default {
} }
}, },
destroyed() { destroyed() {
if (jessibuca) { if (jessibucaPlayer[this._uid]) {
jessibuca.destroy(); jessibucaPlayer[this._uid].destroy();
} }
this.playing = false; this.playing = false;
this.loaded = false; this.loaded = false;