import { VideoFile } from '@shared/models'
+import { escapeHTML } from '@shared/core-utils/renderer'
function toTitleCase (str: string) {
return str.charAt(0).toUpperCase() + str.slice(1)
const params = generateParams(window.location.search)
- if (options.startTime) {
+ if (options.startTime !== undefined && options.startTime !== null) {
const startTimeInt = Math.floor(options.startTime)
params.set('start', secondsToTime(startTimeInt))
}
function secondsToTime (seconds: number, full = false, symbol?: string) {
let time = ''
+ if (seconds === 0 && !full) return '0s'
+
const hourSymbol = (symbol || 'h')
const minuteSymbol = (symbol || 'm')
const secondsSymbol = full ? '' : 's'
return time
}
-function buildVideoOrPlaylistEmbed (embedUrl: string) {
+function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) {
+ const title = escapeHTML(embedTitle)
return '<iframe width="560" height="315" ' +
'sandbox="allow-same-origin allow-scripts allow-popups" ' +
+ 'title="' + title + '" ' +
'src="' + embedUrl + '" ' +
'frameborder="0" allowfullscreen>' +
'</iframe>'