aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-05 17:06:59 +0200
committerChocobozzz <me@florianbigard.com>2018-04-05 17:12:22 +0200
commitf37bad639b36d35c29a464dc52123a1e7c9cd28a (patch)
tree376ff9d09b091610cb943ee5fd4eebc7a17e4c22 /client/src/standalone
parent7ee4a4af0b01040e3896453ee68b3d429dc45cd4 (diff)
downloadPeerTube-f37bad639b36d35c29a464dc52123a1e7c9cd28a.tar.gz
PeerTube-f37bad639b36d35c29a464dc52123a1e7c9cd28a.tar.zst
PeerTube-f37bad639b36d35c29a464dc52123a1e7c9cd28a.zip
Add ability to set a start time
Diffstat (limited to 'client/src/standalone')
-rw-r--r--client/src/standalone/videos/embed.ts8
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