Commit c827d1518bc30e76259f59186ef10bfc8a989294

Authored by 648540858
1 parent 6d4312e3

#510 jessibuca分屏监控异常

web_src/src/components/common/jessibuca.vue
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 </template> 23 </template>
24 24
25 <script> 25 <script>
26 -let jessibuca = null; 26 +let jessibucaPlayer = {};
27 export default { 27 export default {
28 name: 'jessibuca', 28 name: 'jessibuca',
29 data() { 29 data() {
@@ -49,6 +49,7 @@ export default { @@ -49,6 +49,7 @@ export default {
49 window.onerror = (msg) => { 49 window.onerror = (msg) => {
50 // console.error(msg) 50 // console.error(msg)
51 }; 51 };
  52 + console.log(this._uid)
52 let paramUrl = decodeURIComponent(this.$route.params.url) 53 let paramUrl = decodeURIComponent(this.$route.params.url)
53 this.$nextTick(() => { 54 this.$nextTick(() => {
54 this.updatePlayerDomSize() 55 this.updatePlayerDomSize()
@@ -88,7 +89,7 @@ export default { @@ -88,7 +89,7 @@ export default {
88 let options = {}; 89 let options = {};
89 console.log("hasAudio " + this.hasAudio) 90 console.log("hasAudio " + this.hasAudio)
90 91
91 - jessibuca = new window.Jessibuca(Object.assign( 92 + jessibucaPlayer[this._uid] = new window.Jessibuca(Object.assign(
92 { 93 {
93 container: this.$refs.container, 94 container: this.$refs.container,
94 videoBuffer: 0.2, // 最大缓冲时长,单位秒 95 videoBuffer: 0.2, // 最大缓冲时长,单位秒
@@ -117,7 +118,7 @@ export default { @@ -117,7 +118,7 @@ export default {
117 }, 118 },
118 options 119 options
119 )); 120 ));
120 - 121 + let jessibuca = jessibucaPlayer[this._uid];
121 let _this = this; 122 let _this = this;
122 jessibuca.on("load", function () { 123 jessibuca.on("load", function () {
123 console.log("on load init"); 124 console.log("on load init");
@@ -216,40 +217,40 @@ export default { @@ -216,40 +217,40 @@ export default {
216 }, 217 },
217 play: function (url) { 218 play: function (url) {
218 console.log(url) 219 console.log(url)
219 - if (jessibuca) { 220 + if (jessibucaPlayer[this._uid]) {
220 this.destroy(); 221 this.destroy();
221 } 222 }
222 this.create(); 223 this.create();
223 - jessibuca.on("play", () => { 224 + jessibucaPlayer[this._uid].on("play", () => {
224 this.playing = true; 225 this.playing = true;
225 this.loaded = true; 226 this.loaded = true;
226 this.quieting = jessibuca.quieting; 227 this.quieting = jessibuca.quieting;
227 }); 228 });
228 - if (jessibuca.hasLoaded()) {  
229 - jessibuca.play(url); 229 + if (jessibucaPlayer[this._uid].hasLoaded()) {
  230 + jessibucaPlayer[this._uid].play(url);
230 } else { 231 } else {
231 - jessibuca.on("load", () => { 232 + jessibucaPlayer[this._uid].on("load", () => {
232 console.log("load 播放") 233 console.log("load 播放")
233 - jessibuca.play(url); 234 + jessibucaPlayer[this._uid].play(url);
234 }); 235 });
235 } 236 }
236 }, 237 },
237 pause: function () { 238 pause: function () {
238 - if (jessibuca) {  
239 - jessibuca.pause(); 239 + if (jessibucaPlayer[this._uid]) {
  240 + jessibucaPlayer[this._uid].pause();
240 } 241 }
241 this.playing = false; 242 this.playing = false;
242 this.err = ""; 243 this.err = "";
243 this.performance = ""; 244 this.performance = "";
244 }, 245 },
245 destroy: function () { 246 destroy: function () {
246 - if (jessibuca) {  
247 - jessibuca.destroy(); 247 + if (jessibucaPlayer[this._uid]) {
  248 + jessibucaPlayer[this._uid].destroy();
248 } 249 }
249 if (document.getElementById("buttonsBox") == null) { 250 if (document.getElementById("buttonsBox") == null) {
250 this.$refs.container.appendChild(this.btnDom) 251 this.$refs.container.appendChild(this.btnDom)
251 } 252 }
252 - jessibuca = null; 253 + jessibucaPlayer[this._uid] = null;
253 this.playing = false; 254 this.playing = false;
254 this.err = ""; 255 this.err = "";
255 this.performance = ""; 256 this.performance = "";
@@ -262,7 +263,7 @@ export default { @@ -262,7 +263,7 @@ export default {
262 }, 263 },
263 fullscreenSwich: function () { 264 fullscreenSwich: function () {
264 let isFull = this.isFullscreen() 265 let isFull = this.isFullscreen()
265 - jessibuca.setFullscreen(!isFull) 266 + jessibucaPlayer[this._uid].setFullscreen(!isFull)
266 this.fullscreen = !isFull; 267 this.fullscreen = !isFull;
267 }, 268 },
268 isFullscreen: function () { 269 isFullscreen: function () {
@@ -273,8 +274,8 @@ export default { @@ -273,8 +274,8 @@ export default {
273 } 274 }
274 }, 275 },
275 destroyed() { 276 destroyed() {
276 - if (jessibuca) {  
277 - jessibuca.destroy(); 277 + if (jessibucaPlayer[this._uid]) {
  278 + jessibucaPlayer[this._uid].destroy();
278 } 279 }
279 this.playing = false; 280 this.playing = false;
280 this.loaded = false; 281 this.loaded = false;