aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/utils.ts')
-rw-r--r--client/src/assets/player/utils.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts
index c02e19929..cf4f60f55 100644
--- a/client/src/assets/player/utils.ts
+++ b/client/src/assets/player/utils.ts
@@ -23,9 +23,8 @@ function isMobile () {
23 return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent) 23 return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent)
24} 24}
25 25
26function buildVideoLink (time?: number) { 26function buildVideoLink (time?: number, url?: string) {
27 const baseEmbedPath = window.location.pathname.replace('/embed/', '/watch/') 27 if (!url) url = window.location.origin + window.location.pathname.replace('/embed/', '/watch/')
28 const baseEmbedURL = window.location.origin + baseEmbedPath
29 28
30 if (time) { 29 if (time) {
31 const timeInt = Math.floor(time) 30 const timeInt = Math.floor(time)
@@ -33,10 +32,10 @@ function buildVideoLink (time?: number) {
33 const params = new URLSearchParams(window.location.search) 32 const params = new URLSearchParams(window.location.search)
34 params.set('start', secondsToTime(timeInt)) 33 params.set('start', secondsToTime(timeInt))
35 34
36 return baseEmbedURL + '?' + params.toString() 35 return url + '?' + params.toString()
37 } 36 }
38 37
39 return baseEmbedURL 38 return url
40} 39}
41 40
42function timeToInt (time: number | string) { 41function timeToInt (time: number | string) {