Commit 9d9947e3 authored by christianrhansen's avatar christianrhansen

jump to timestamp works

parent aa9617bf
<template lang="pug"> <template lang="pug">
full-screen full-screen
back-button(slot="backButton") back-button(slot="backButton")
template(slot="form-title") Annotations Table template(slot="form-title") Annotations Table {{ baseSelector() }}
div(style="width: 300px;") div(style="width: 300px;")
video-player(v-if="video", :src="video.body.source.id", @ready="playerReady($event)", @time="onPlayerTime($event)") video-player(v-if="video", :src="video.body.source.id", @ready="playerReady($event)", @time="onPlayerTime($event)")
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
data () { data () {
const _this = this const _this = this
return { return {
playerTime: 0.0,
query: undefined, query: undefined,
video: undefined, video: undefined,
player: undefined,
timeline: undefined, timeline: undefined,
metadata: undefined, metadata: undefined,
config: { config: {
...@@ -77,8 +79,26 @@ ...@@ -77,8 +79,26 @@
} }
}, },
methods: { methods: {
onStart (val) { playerReady (player) {
alert(DateTime.fromISO(val)) this.player = player
},
onPlayerTime (seconds) {
this.playerTime = seconds
console.log(seconds)
},
baseSelector () {
if (!this.video) return DateTime.local().toISO()
return DateTime.fromISO(this.video.target.selector.value, { setZone: true })
.plus(this.playerTime * 1000)
.toISO()
},
onStart (selector) {
// alert(DateTime.fromISO(selector))
const millis = DateTime.fromISO(selector, { setZone: true }).toMillis() -
DateTime.fromISO(this.video.target.selector.value, { setZone: true }).toMillis()
const targetMillis = millis * 0.001
if (this.playerTime !== targetMillis) this.player.currentTime(targetMillis)
console.log(targetMillis)
}, },
async getVideo () { async getVideo () {
this.video = await this.$store.dispatch('annotations/get', this.$route.params.id) this.video = await this.$store.dispatch('annotations/get', this.$route.params.id)
......
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