Commit 29239b81 authored by anton's avatar anton
Browse files

Update from release_2_1

parents 3f754e90 84b0ab47
Pipeline #63786 passed with stage
in 3 minutes and 29 seconds
......@@ -14,10 +14,13 @@ and this project adheres to
- Add media screen uses `publishedAt` field from YouTube metadata as initial
reference date, if available (e.g. live streams)
- `Live` indicator for YouTube live streams in post-annotator
- Edit media screen allows adding duration for live streams once archived
### Changed
- Add media screen explicitly shows option for overriding or auto-detecting media start times
- Make Media duration in post-annotator dynamic
### Fixed
......
......@@ -185,7 +185,8 @@
'map',
'selectedMillis',
'mode',
'mayEdit'
'mayEdit',
'isLive'
],
data () {
return {
......
......@@ -8,6 +8,7 @@ export default {
abort: 'Abort',
apply_synchronisation: 'Apply Synchronisation',
annotate: 'Annotate',
add_duration: 'Add duration',
add_term: 'Add Term',
add_media: 'Add Media',
add_vocabulary: 'Add Vocabulary',
......@@ -45,6 +46,7 @@ export default {
no: 'No',
remove: 'Remove',
request_reset_pass: 'Request Password Reset',
reset: 'Reset',
reject: 'Reject',
save_changes: 'Save changes',
save: 'Save',
......@@ -174,6 +176,7 @@ export default {
invitation: 'Invitation',
last_annotation: 'Last annotated',
last_edit: 'Last edit',
live: 'Live',
location: 'Location',
map_title: 'Map Title',
members: 'Members',
......@@ -478,7 +481,8 @@ export default {
},
edit: {
title: 'Edit media',
caption: 'Edit media details.'
caption: 'Edit media details.',
duration_found: 'Media currently has no duration but a duration was found for it.'
},
create: {
title: 'Add Media',
......
......@@ -16,6 +16,8 @@
media-player.full-height.relative-position(v-if="media", :annotation="media", :fine-controls="true",
:post-errors="true", @ready="playerReady($event)", @timeupdate="onPlayerTime($event)")
q-chip.q-ma-md.absolute-top-left(v-if="isLive") {{ $t('labels.live') }}
// swimlane content
.absolute-bottom-right.bg-dark.full-width.ui-border-top(
......@@ -31,8 +33,9 @@
:markerDetails="false",
:resizable="true",
:mayEdit="mayEdit",
:start="getMediaDate().toMillis()",
:duration="getMediaDuration()",
:isLive="isLive",
:start="mediaDate.toMillis()",
:duration="mediaDuration",
:annotations="annotations",
:media="media",
:key="componentKey",
......@@ -90,7 +93,7 @@
timecode-label(
@click.native="gotoSelector(annotation.target.selector, false, annotation)",
:millis="annotation.target.selector._valueMillis",
:videoDate="getMediaDate()")
:videoDate="mediaDate")
// annotation has duration
......@@ -100,7 +103,7 @@
timecode-label(
@click.native="gotoSelector(annotation.target.selector, true, annotation)",
:millis="getAnnotationEndMillis(annotation)",
:videoDate="getMediaDate()")
:videoDate="mediaDate")
// add timecode button
......@@ -266,6 +269,29 @@
isAnnotationDirty () {
return this.isEditingAnnotations &&
this.annotations[this.editAnnotationIndex].body.value !== this.editAnnotationBuffer
},
mediaDate () {
if (this.media && this.media.target.selector) {
return DateTime.fromMillis(this.media.target.selector._valueMillis)
}
else return DateTime.local()
},
mediaDuration () {
if (this.media && this.media.target.selector) {
let duration = this.media.target.selector.getDuration()
if (duration) {
return duration.as('milliseconds')
}
else {
const videoDate = DateTime.fromMillis(this.media.target.selector._valueMillis)
duration = Interval.fromDateTimes(videoDate, DateTime.local()).toDuration()
return duration.as('milliseconds')
}
}
return 0
},
isLive () {
return this.metadata.liveBroadcastContent === 'live'
}
},
watch: {
......@@ -353,7 +379,10 @@
}
this.$root.$emit('setBackButton', '/piecemaker/timelines/' + parseURI(this.media.target.id).uuid + '/media')
if (this.media) {
this.metadata = await this.$store.dispatch('metadata/getLocal', this.media)
let duration
if (this.media.target.selector) duration = this.media.target.selector.getDuration()
if (!duration) this.metadata = await this.$store.dispatch('metadata/get', this.media)
else this.metadata = await this.$store.dispatch('metadata/getLocal', this.media)
}
},
async getAnnotations () {
......@@ -498,16 +527,6 @@
this.editAnnotationIndex = i
this.editAnnotationBuffer = this.annotations[i].body.value
},
getMediaDate () {
return DateTime.fromMillis(this.media.target.selector._valueMillis)
},
getMediaDuration () {
const duration = this.media.target.selector.getDuration()
if (duration) {
return duration.as('milliseconds')
}
return 0
},
// Annotation list items specific
getAnnotationEndMillis (annotation) {
......
......@@ -5,6 +5,9 @@
headline(:content="$t('routes.piecemaker.media.edit.title') + ':'")
| {{ payload.title }} ({{ duration }})
.q-mb-lg
q-alert(color="info" :actions="actions" v-if="showDurationOverride") {{ $t('routes.piecemaker.media.edit.duration_found') }}
content-paragraph(v-if="acl.put", :position="'first'")
calendar-time-main(:datetime="selectorValue", @update="onCalendarUpdate")
......@@ -107,9 +110,19 @@
data () {
const context = this
return {
actions: [
{
label: this.$t('buttons.add_duration'),
handler () {
context.durationOverride = context.meta.duration * 1000
}
}
],
acl: {},
apiPayload: undefined,
selectorOverride: undefined,
showDurationOverride: false,
durationOverride: undefined,
titlePayload: undefined,
media: undefined,
meta: undefined,
......@@ -119,9 +132,17 @@
.then(async result => {
context.$q.loading.show()
if (result.target.selector) {
const duration = result.target.selector.getDuration()
if (!duration) {
this.meta = await this.$store.dispatch('metadata/get', result)
this.showDurationOverride = !!this.meta.duration
}
else this.meta = await this.$store.dispatch('metadata/getLocal', result)
}
this.annotation = result
this.map = await this.$store.dispatch('maps/get', parseURI(result.target.id).uuid)
this.meta = await this.$store.dispatch('metadata/getLocal', result)
this.titlePayload = this.meta.titleAnnotation
const tags = await this.$store.dispatch('tags/get', result)
......@@ -180,6 +201,7 @@
await titleHelper.update(context.$store, context.titlePayload.id, context.payload.title)
}
let selector
if (context.durationOverride) context.annotation.target.selector._valueDuration = context.durationOverride
if (context.selectorOverride) {
const
durationMs = context.annotation.target.selector._valueDuration,
......
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