aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/standalone
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-24 10:16:30 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit3b6f205c34bb931de0323581edf991ca33256e6b (patch)
treef6ba40b7c666e38ff9c321906f04cb2c2630163e /client/src/standalone
parent2adfc7ea9a1f858db874df9fe322e7ae833db77c (diff)
downloadPeerTube-3b6f205c34bb931de0323581edf991ca33256e6b.tar.gz
PeerTube-3b6f205c34bb931de0323581edf991ca33256e6b.tar.zst
PeerTube-3b6f205c34bb931de0323581edf991ca33256e6b.zip
Correctly implement p2p-media-loader
Diffstat (limited to 'client/src/standalone')
-rw-r--r--client/src/standalone/videos/embed.ts31
1 files changed, 20 insertions, 11 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index b1261c4a2..0d165ea7b 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -23,7 +23,7 @@ import { peertubeTranslate, ResultList, VideoDetails } from '../../../../shared'
23import { PeerTubeResolution } from '../player/definitions' 23import { PeerTubeResolution } from '../player/definitions'
24import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' 24import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings'
25import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' 25import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
26import { PeertubePlayerManager, PeertubePlayerManagerOptions } from '../../assets/player/peertube-player-manager' 26import { PeertubePlayerManager, PeertubePlayerManagerOptions, PlayerMode } from '../../assets/player/peertube-player-manager'
27 27
28/** 28/**
29 * Embed API exposes control of the embed player to the outside world via 29 * Embed API exposes control of the embed player to the outside world via
@@ -162,6 +162,7 @@ class PeerTubeEmbed {
162 subtitle: string 162 subtitle: string
163 enableApi = false 163 enableApi = false
164 startTime: number | string = 0 164 startTime: number | string = 0
165 mode: PlayerMode
165 scope = 'peertube' 166 scope = 'peertube'
166 167
167 static async main () { 168 static async main () {
@@ -255,6 +256,8 @@ class PeerTubeEmbed {
255 this.scope = this.getParamString(params, 'scope', this.scope) 256 this.scope = this.getParamString(params, 'scope', this.scope)
256 this.subtitle = this.getParamString(params, 'subtitle') 257 this.subtitle = this.getParamString(params, 'subtitle')
257 this.startTime = this.getParamString(params, 'start') 258 this.startTime = this.getParamString(params, 'start')
259
260 this.mode = this.getParamToggle(params, 'p2p-media-loader') ? 'p2p-media-loader' : 'webtorrent'
258 } catch (err) { 261 } catch (err) {
259 console.error('Cannot get params from URL.', err) 262 console.error('Cannot get params from URL.', err)
260 } 263 }
@@ -312,20 +315,26 @@ class PeerTubeEmbed {
312 serverUrl: window.location.origin, 315 serverUrl: window.location.origin,
313 language: navigator.language, 316 language: navigator.language,
314 embedUrl: window.location.origin + videoInfo.embedPath 317 embedUrl: window.location.origin + videoInfo.embedPath
315 },
316
317 webtorrent: {
318 videoFiles: videoInfo.files
319 } 318 }
319 }
320 320
321 // p2pMediaLoader: { 321 if (this.mode === 'p2p-media-loader') {
322 // // playlistUrl: 'https://akamai-axtest.akamaized.net/routes/lapd-v1-acceptance/www_c4/Manifest.m3u8' 322 Object.assign(options, {
323 // // playlistUrl: 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8' 323 p2pMediaLoader: {
324 // playlistUrl: 'https://cdn.theoplayer.com/video/elephants-dream/playlist.m3u8' 324 // playlistUrl: 'https://akamai-axtest.akamaized.net/routes/lapd-v1-acceptance/www_c4/Manifest.m3u8'
325 // } 325 // playlistUrl: 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8'
326 playlistUrl: 'https://cdn.theoplayer.com/video/elephants-dream/playlist.m3u8'
327 }
328 })
329 } else {
330 Object.assign(options, {
331 webtorrent: {
332 videoFiles: videoInfo.files
333 }
334 })
326 } 335 }
327 336
328 this.player = await PeertubePlayerManager.initialize('webtorrent', options) 337 this.player = await PeertubePlayerManager.initialize(this.mode, options)
329 338
330 this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations)) 339 this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations))
331 340