Commit e242ff21 authored by anton's avatar anton

Update from release_2_0

parents b4d76f64 d0ff087c
Pipeline #56710 passed with stage
in 5 minutes and 57 seconds
...@@ -126,6 +126,10 @@ export default { ...@@ -126,6 +126,10 @@ export default {
this.$root.$on('video-time-changed', this.onMediaTimeChanged) this.$root.$on('video-time-changed', this.onMediaTimeChanged)
this.$root.$on('grid-datetime', this.onGridDateTime) this.$root.$on('grid-datetime', this.onGridDateTime)
}, },
beforeDestroy () {
this.$root.$off('video-time-changed', this.onMediaTimeChanged)
this.$root.$off('grid-datetime', this.onGridDateTime)
},
computed: { computed: {
videoUuid () { videoUuid () {
return this.cell ? this.cell.id : undefined return this.cell ? this.cell.id : undefined
......
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
q-window-resize-observable(@resize="resizeMedia") q-window-resize-observable(@resize="resizeMedia")
template(v-if="display") template(v-if="display")
media-player( media-player(
v-if="video",
:class="{ hidePlayer: !showPlayer }", :class="{ hidePlayer: !showPlayer }",
ref='videoPlayer', ref='videoPlayer',
:annotation="video || fauxMedia", :annotation="video",
@ready="handlePlayerReady", @ready="handlePlayerReady",
@play="handlePlayerPlaying", @play="handlePlayerPlaying",
@canplay:once="onCanPlay", @canplay:once="onCanPlay",
...@@ -39,19 +40,6 @@ ...@@ -39,19 +40,6 @@
showPlayer: false showPlayer: false
} }
}, },
computed: {
fauxMedia () {
return {
body: {
type: 'Video',
purpose: 'linking',
source: {
id: this.cell ? this.cell.source._value.content : undefined
}
}
}
}
},
watch: { watch: {
visible (val) { visible (val) {
if (!val && this.player) { if (!val && this.player) {
...@@ -65,15 +53,16 @@ ...@@ -65,15 +53,16 @@
} }
}, },
async mounted () { async mounted () {
// if (this.cell && this.cell.data.id) {
if (this.cell && this.cell.id && this.cell.source._value.id) { if (this.cell && this.cell.id && this.cell.source._value.id) {
// this.video = await this.$store.dispatch('annotations/get', this.cell.source.id)
this.video = await this.$store.dispatch('annotations/get', this.cell.source._value.id) this.video = await this.$store.dispatch('annotations/get', this.cell.source._value.id)
if (this.video) { if (this.video) {
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis) this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
this.contextTime = this.videoTime this.contextTime = this.videoTime
} }
} }
else {
this.fauxMedia()
}
if (this.display) { if (this.display) {
if (!this.cell.source.start) this.showPlayer = true if (!this.cell.source.start) this.showPlayer = true
else { else {
...@@ -82,21 +71,38 @@ ...@@ -82,21 +71,38 @@
// Show the player after 2s if the canPlay event does not fire // Show the player after 2s if the canPlay event does not fire
setTimeout(() => { _this.showPlayer = true }, 2000) setTimeout(() => { _this.showPlayer = true }, 2000)
} }
const _this = this
this.$root.$on('grid-datetime', datetime => { this.$root.$on('grid-datetime', this.onGridDateTime)
console.debug('CellMedia: received grid-datetime', datetime.toISO()) this.$root.$on('annotation-trigger', this.onAnnotationTrigger)
_this.setPlayerTimeFromDateTime(datetime)
})
this.$root.$on('annotation-trigger', (annotation, annotationGlobalTime) => {
if (!_this.video) return
if (_this.video.target && annotation.target.id === _this.video.target.id) {
console.debug('CellMedia: received annotation-trigger', annotation.id, annotationGlobalTime.toISO())
_this.setPlayerTimeFromDateTime(annotationGlobalTime)
}
})
} }
}, },
beforeDestroy () {
this.$root.$off('grid-datetime', this.onGridDateTime)
this.$root.$off('annotation-trigger', this.onAnnotationTrigger)
},
methods: { methods: {
onGridDateTime (datetime) {
console.debug('CellMedia: received grid-datetime', datetime.toISO())
this.setPlayerTimeFromDateTime(datetime)
},
onAnnotationTrigger (annotation, annotationGlobalTime) {
if (!this.video) return
if (this.video.target && annotation.target.id === this.video.target.id) {
console.debug('CellMedia: received annotation-trigger', annotation.id, annotationGlobalTime.toISO())
this.setPlayerTimeFromDateTime(annotationGlobalTime)
}
},
fauxMedia () {
this.video = {
body: {
type: 'Video',
purpose: 'linking',
source: {
id: this.cell ? this.cell.source._value.content : undefined
}
}
}
},
onCanPlay () { onCanPlay () {
if (this.cell && this.cell.source._value.start) { if (this.cell && this.cell.source._value.start) {
if (this.player) { if (this.player) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment