diff options
Diffstat (limited to 'client/src/standalone/videos/embed.ts')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 1efecd3f3..a99bc586f 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -23,10 +23,15 @@ loadVideoInfo(videoId) | |||
23 | 23 | ||
24 | const videoElement = document.getElementById(videoContainerId) as HTMLVideoElement | 24 | const videoElement = document.getElementById(videoContainerId) as HTMLVideoElement |
25 | let autoplay = false | 25 | let autoplay = false |
26 | let startTime = 0 | ||
26 | 27 | ||
27 | try { | 28 | try { |
28 | let params = new URL(window.location.toString()).searchParams | 29 | let params = new URL(window.location.toString()).searchParams |
29 | autoplay = params.has('autoplay') && (params.get('autoplay') === '1' || params.get('autoplay') === 'true') | 30 | autoplay = params.has('autoplay') && (params.get('autoplay') === '1' || params.get('autoplay') === 'true') |
31 | |||
32 | const startTimeParamString = params.get('start') | ||
33 | const startTimeParamNumber = parseInt(startTimeParamString, 10) | ||
34 | if (isNaN(startTimeParamNumber) === false) startTime = startTimeParamNumber | ||
30 | } catch (err) { | 35 | } catch (err) { |
31 | console.error('Cannot get params from URL.', err) | 36 | console.error('Cannot get params from URL.', err) |
32 | } | 37 | } |
@@ -40,7 +45,8 @@ loadVideoInfo(videoId) | |||
40 | videoDuration: videoInfo.duration, | 45 | videoDuration: videoInfo.duration, |
41 | enableHotkeys: true, | 46 | enableHotkeys: true, |
42 | peertubeLink: true, | 47 | peertubeLink: true, |
43 | poster: window.location.origin + videoInfo.previewPath | 48 | poster: window.location.origin + videoInfo.previewPath, |
49 | startTime | ||
44 | }) | 50 | }) |
45 | videojs(videoContainerId, videojsOptions, function () { | 51 | videojs(videoContainerId, videojsOptions, function () { |
46 | const player = this | 52 | const player = this |