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