aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-11-22 17:16:11 +0100
committerChocobozzz <me@florianbigard.com>2019-11-25 10:59:49 +0100
commit0f2f274c9837bbcd95446778314c9c32831faa0e (patch)
treecf181f2a68b135ed91efe23fedc14f5cd08c4590 /client
parent3a149e9f8b2e99507c72792b80cee3a90df003b2 (diff)
downloadPeerTube-0f2f274c9837bbcd95446778314c9c32831faa0e.tar.gz
PeerTube-0f2f274c9837bbcd95446778314c9c32831faa0e.tar.zst
PeerTube-0f2f274c9837bbcd95446778314c9c32831faa0e.zip
Auto load HLS player in embed too
Diffstat (limited to 'client')
-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: {