From f7996b7cb7f112085a0c9d941be2d62287a77dc9 Mon Sep 17 00:00:00 2001 From: ManhNguyen98 Date: Fri, 10 Sep 2021 21:30:23 +0700 Subject: [PATCH] fix: Multiple instances on the same page --- src/dashboard/controls.vue | 18 +++++++++++------- src/dashboard/dashboard.vue | 13 ++++++++++--- src/dashboard/fullscreen.vue | 9 ++++++++- src/dashboard/mobile-controls.vue | 14 +++++++++----- src/dashboard/mobile-dashboard.vue | 13 ++++++++++--- src/dashboard/picture-in-picture.vue | 7 ++++++- src/dashboard/play-pause-control.vue | 9 ++++++++- src/dashboard/progress.vue | 11 +++++++++-- src/dashboard/settings.vue | 15 +++++++++++---- src/dashboard/time-span.vue | 11 +++++++++-- src/dashboard/volume.vue | 9 ++++++++- src/layers/cover-layer.vue | 9 ++++++++- src/layers/error-layer.vue | 21 ++++++++++++++------- src/layers/layers.vue | 18 +++++++++++------- src/layers/loading-layer.vue | 9 +++++++++ src/layers/logo-layer.vue | 9 ++++++++- src/layers/play-pause-layer.vue | 9 ++++++++- src/layers/title-layer.vue | 9 +++++++++ src/mixins.js | 24 +++++++++++++++++------- src/vue-core-video-player.vue | 15 +++++++++------ 20 files changed, 192 insertions(+), 60 deletions(-) diff --git a/src/dashboard/controls.vue b/src/dashboard/controls.vue index 6170d51..76bad35 100644 --- a/src/dashboard/controls.vue +++ b/src/dashboard/controls.vue @@ -1,14 +1,14 @@ @@ -33,7 +33,11 @@ export default { }, props: { visible: Boolean, - muted: Boolean + muted: Boolean, + playerKey: { + type: String, + default: '' + } } } diff --git a/src/dashboard/dashboard.vue b/src/dashboard/dashboard.vue index 834159a..a6fe66a 100644 --- a/src/dashboard/dashboard.vue +++ b/src/dashboard/dashboard.vue @@ -1,7 +1,7 @@ @@ -26,7 +26,11 @@ export default { }, props: { controls: [Boolean, String], - muted: Boolean + muted: Boolean, + playerKey: { + type: String, + default: '' + } }, data () { return { @@ -34,6 +38,9 @@ export default { } }, mixins: [coreMixins], + created () { + this._playerKey = this.playerKey + }, methods: { showDashboard (delay) { window.clearTimeout(this._hideTimeout) diff --git a/src/dashboard/fullscreen.vue b/src/dashboard/fullscreen.vue index 0c8ab6a..d83faf4 100644 --- a/src/dashboard/fullscreen.vue +++ b/src/dashboard/fullscreen.vue @@ -20,7 +20,14 @@ export default { name: 'Fullscreen', mixins: [coreMixins], props: { - visible: Boolean + visible: Boolean, + playerKey: { + type: String, + default: '' + } + }, + created () { + this._playerKey = this.playerKey }, data () { return { diff --git a/src/dashboard/mobile-controls.vue b/src/dashboard/mobile-controls.vue index 89762af..def0846 100644 --- a/src/dashboard/mobile-controls.vue +++ b/src/dashboard/mobile-controls.vue @@ -1,12 +1,12 @@ @@ -27,7 +27,11 @@ export default { }, props: { visible: Boolean, - muted: Boolean + muted: Boolean, + playerKey: { + type: String, + default: '' + } } } diff --git a/src/dashboard/mobile-dashboard.vue b/src/dashboard/mobile-dashboard.vue index 41cad52..167041b 100644 --- a/src/dashboard/mobile-dashboard.vue +++ b/src/dashboard/mobile-dashboard.vue @@ -1,7 +1,7 @@ @@ -26,7 +26,11 @@ export default { }, props: { controls: [Boolean, String], - muted: Boolean + muted: Boolean, + playerKey: { + type: String, + default: '' + } }, data () { return { @@ -34,6 +38,9 @@ export default { } }, mixins: [coreMixins], + created () { + this._playerKey = this.playerKey + }, methods: { showDashboard (delay) { window.clearTimeout(this._hideTimeout) diff --git a/src/dashboard/picture-in-picture.vue b/src/dashboard/picture-in-picture.vue index 609c58f..df4d872 100644 --- a/src/dashboard/picture-in-picture.vue +++ b/src/dashboard/picture-in-picture.vue @@ -26,7 +26,11 @@ export default { name: 'PictureInPicture', mixins: [coreMixins], props: { - visible: Boolean + visible: Boolean, + playerKey: { + type: String, + default: '' + } }, data () { return { @@ -37,6 +41,7 @@ export default { if ((_isSupportPIP)) { this.show = true } + this._playerKey = this.playerKey }, methods: { requestPictureInPicture () { diff --git a/src/dashboard/play-pause-control.vue b/src/dashboard/play-pause-control.vue index a695ecd..0847842 100644 --- a/src/dashboard/play-pause-control.vue +++ b/src/dashboard/play-pause-control.vue @@ -18,7 +18,14 @@ export default { name: 'PlayPauseControl', mixins: [coreMixins], props: { - visible: Boolean + visible: Boolean, + playerKey: { + type: String, + default: '' + } + }, + created () { + this._playerKey = this.playerKey } } diff --git a/src/dashboard/progress.vue b/src/dashboard/progress.vue index 0980ac5..6bea558 100644 --- a/src/dashboard/progress.vue +++ b/src/dashboard/progress.vue @@ -18,16 +18,23 @@ import { drag } from '../helper/dom' export default { name: 'Progress', props: { - visible: Boolean + visible: Boolean, + playerKey: { + type: String, + default: '' + } }, mixins: [coreMixins], + created () { + this._playerKey = this.playerKey + }, data () { return { progress: 0.00, bufferProgress: 0.00 } }, - created () { + beforeMount () { this.on(EVENTS.TIMEUPDATE, () => { if (this._dragEl) { return diff --git a/src/dashboard/settings.vue b/src/dashboard/settings.vue index bb8b0d6..bdcc07b 100644 --- a/src/dashboard/settings.vue +++ b/src/dashboard/settings.vue @@ -10,13 +10,13 @@ {{$t('dashboard.settings.autoplay')}}
- +
  • {{$t('dashboard.settings.loop')}}
    - +
  • @@ -31,7 +31,7 @@
    {{resolution}} -
    +