aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/standalone')
-rw-r--r--client/src/standalone/videos/embed.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index 896d90de2..40d945824 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -116,7 +116,7 @@ export class PeerTubeEmbed {
116 this.api.initialize() 116 this.api.initialize()
117 } 117 }
118 118
119 private loadParams () { 119 private loadParams (video: VideoDetails) {
120 try { 120 try {
121 const params = new URL(window.location.toString()).searchParams 121 const params = new URL(window.location.toString()).searchParams
122 122
@@ -136,7 +136,15 @@ export class PeerTubeEmbed {
136 this.bigPlayBackgroundColor = this.getParamString(params, 'bigPlayBackgroundColor') 136 this.bigPlayBackgroundColor = this.getParamString(params, 'bigPlayBackgroundColor')
137 this.foregroundColor = this.getParamString(params, 'foregroundColor') 137 this.foregroundColor = this.getParamString(params, 'foregroundColor')
138 138
139 this.mode = this.getParamString(params, 'mode') === 'p2p-media-loader' ? 'p2p-media-loader' : 'webtorrent' 139 const modeParam = this.getParamString(params, 'mode')
140
141 if (modeParam) {
142 if (modeParam === 'p2p-media-loader') this.mode = 'p2p-media-loader'
143 else this.mode = 'webtorrent'
144 } else {
145 if (Array.isArray(video.streamingPlaylists) && video.streamingPlaylists.length !== 0) this.mode = 'p2p-media-loader'
146 else this.mode = 'webtorrent'
147 }
140 } catch (err) { 148 } catch (err) {
141 console.error('Cannot get params from URL.', err) 149 console.error('Cannot get params from URL.', err)
142 } 150 }
@@ -162,7 +170,7 @@ export class PeerTubeEmbed {
162 const videoInfo: VideoDetails = await videoResponse.json() 170 const videoInfo: VideoDetails = await videoResponse.json()
163 const videoCaptions = await this.buildCaptions(serverTranslations, captionsResponse) 171 const videoCaptions = await this.buildCaptions(serverTranslations, captionsResponse)
164 172
165 this.loadParams() 173 this.loadParams(videoInfo)
166 174
167 const options: PeertubePlayerManagerOptions = { 175 const options: PeertubePlayerManagerOptions = {
168 common: { 176 common: {