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 {
this.$root.$on('video-time-changed', this.onMediaTimeChanged)
this.$root.$on('grid-datetime', this.onGridDateTime)
},
beforeDestroy () {
this.$root.$off('video-time-changed', this.onMediaTimeChanged)
this.$root.$off('grid-datetime', this.onGridDateTime)
},
computed: {
videoUuid () {
return this.cell ? this.cell.id : undefined
......
......@@ -4,9 +4,10 @@
q-window-resize-observable(@resize="resizeMedia")
template(v-if="display")
media-player(
v-if="video",
:class="{ hidePlayer: !showPlayer }",
ref='videoPlayer',
:annotation="video || fauxMedia",
:annotation="video",
@ready="handlePlayerReady",
@play="handlePlayerPlaying",
@canplay:once="onCanPlay",
......@@ -39,19 +40,6 @@
showPlayer: false
}
},
computed: {
fauxMedia () {
return {
body: {
type: 'Video',
purpose: 'linking',
source: {
id: this.cell ? this.cell.source._value.content : undefined
}
}
}
}
},
watch: {
visible (val) {
if (!val && this.player) {
......@@ -65,15 +53,16 @@
}
},
async mounted () {
// if (this.cell && this.cell.data.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)
if (this.video) {
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
this.contextTime = this.videoTime
}
}
else {
this.fauxMedia()
}
if (this.display) {
if (!this.cell.source.start) this.showPlayer = true
else {
......@@ -82,21 +71,38 @@
// Show the player after 2s if the canPlay event does not fire
setTimeout(() => { _this.showPlayer = true }, 2000)
}
const _this = this
this.$root.$on('grid-datetime', datetime => {
this.$root.$on('grid-datetime', this.onGridDateTime)
this.$root.$on('annotation-trigger', this.onAnnotationTrigger)
}
},
beforeDestroy () {
this.$root.$off('grid-datetime', this.onGridDateTime)
this.$root.$off('annotation-trigger', this.onAnnotationTrigger)
},
methods: {
onGridDateTime (datetime) {
console.debug('CellMedia: received grid-datetime', datetime.toISO())
_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) {
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)
this.setPlayerTimeFromDateTime(annotationGlobalTime)
}
},
fauxMedia () {
this.video = {
body: {
type: 'Video',
purpose: 'linking',
source: {
id: this.cell ? this.cell.source._value.content : undefined
}
}
})
}
},
methods: {
onCanPlay () {
if (this.cell && this.cell.source._value.start) {
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