- formatTimestamp (video: Video) {
- const start = video.playlistElement.startTimestamp
- const stop = video.playlistElement.stopTimestamp
-
- const startFormatted = secondsToTime(start, true, ':')
- const stopFormatted = secondsToTime(stop, true, ':')
-
- if (start === null && stop === null) return ''
-
- if (start !== null && stop === null) return this.i18n('Starts at ') + startFormatted
- if (start === null && stop !== null) return this.i18n('Stops at ') + stopFormatted
-
- return this.i18n('Starts at ') + startFormatted + this.i18n(' and stops at ') + stopFormatted
- }
-
- onDropdownOpenChange () {
- this.displayTimestampOptions = false
- }
-
- toggleDisplayTimestampsOptions (event: Event, video: Video) {
- event.preventDefault()
-
- this.displayTimestampOptions = !this.displayTimestampOptions
-
- if (this.displayTimestampOptions === true) {
- this.timestampOptions = {
- startTimestampEnabled: false,
- stopTimestampEnabled: false,
- startTimestamp: 0,
- stopTimestamp: video.duration
- }
-
- if (video.playlistElement.startTimestamp) {
- this.timestampOptions.startTimestampEnabled = true
- this.timestampOptions.startTimestamp = video.playlistElement.startTimestamp
- }
-
- if (video.playlistElement.stopTimestamp) {
- this.timestampOptions.stopTimestampEnabled = true
- this.timestampOptions.stopTimestamp = video.playlistElement.stopTimestamp
- }
- }