aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts22
-rw-r--r--client/src/standalone/videos/embed.ts2
2 files changed, 13 insertions, 11 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index e1766255b..9f3a43a08 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -27,8 +27,7 @@ import {
27 P2PMediaLoaderOptions, 27 P2PMediaLoaderOptions,
28 PeertubePlayerManager, 28 PeertubePlayerManager,
29 PeertubePlayerManagerOptions, 29 PeertubePlayerManagerOptions,
30 PlayerMode, 30 PlayerMode
31 WebtorrentOptions
32} from '../../../assets/player/peertube-player-manager' 31} from '../../../assets/player/peertube-player-manager'
33 32
34@Component({ 33@Component({
@@ -117,8 +116,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
117 .subscribe(([ video, captionsResult ]) => { 116 .subscribe(([ video, captionsResult ]) => {
118 const startTime = this.route.snapshot.queryParams.start 117 const startTime = this.route.snapshot.queryParams.start
119 const subtitle = this.route.snapshot.queryParams.subtitle 118 const subtitle = this.route.snapshot.queryParams.subtitle
119 const playerMode = this.route.snapshot.queryParams.mode
120 120
121 this.onVideoFetched(video, captionsResult.data, { startTime, subtitle }) 121 this.onVideoFetched(video, captionsResult.data, { startTime, subtitle, playerMode })
122 .catch(err => this.handleError(err)) 122 .catch(err => this.handleError(err))
123 }) 123 })
124 }) 124 })
@@ -365,7 +365,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
365 ) 365 )
366 } 366 }
367 367
368 private async onVideoFetched (video: VideoDetails, videoCaptions: VideoCaption[], urlOptions: { startTime: number, subtitle: string }) { 368 private async onVideoFetched (
369 video: VideoDetails,
370 videoCaptions: VideoCaption[],
371 urlOptions: { startTime?: number, subtitle?: string, playerMode?: string }
372 ) {
369 this.video = video 373 this.video = video
370 374
371 // Re init attributes 375 // Re init attributes
@@ -440,10 +444,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
440 } 444 }
441 } 445 }
442 446
443 let mode: PlayerMode 447 const mode: PlayerMode = urlOptions.playerMode === 'p2p-media-loader' ? 'p2p-media-loader' : 'webtorrent'
444 const hlsPlaylist = this.video.getHlsPlaylist() 448
445 if (hlsPlaylist) { 449 if (mode === 'p2p-media-loader') {
446 mode = 'p2p-media-loader' 450 const hlsPlaylist = this.video.getHlsPlaylist()
447 451
448 const p2pMediaLoader = { 452 const p2pMediaLoader = {
449 playlistUrl: hlsPlaylist.playlistUrl, 453 playlistUrl: hlsPlaylist.playlistUrl,
@@ -454,8 +458,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
454 } as P2PMediaLoaderOptions 458 } as P2PMediaLoaderOptions
455 459
456 Object.assign(options, { p2pMediaLoader }) 460 Object.assign(options, { p2pMediaLoader })
457 } else {
458 mode = 'webtorrent'
459 } 461 }
460 462
461 this.zone.runOutsideAngular(async () => { 463 this.zone.runOutsideAngular(async () => {
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index c5c46d0c5..32bf42e12 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -263,7 +263,7 @@ class PeerTubeEmbed {
263 this.subtitle = this.getParamString(params, 'subtitle') 263 this.subtitle = this.getParamString(params, 'subtitle')
264 this.startTime = this.getParamString(params, 'start') 264 this.startTime = this.getParamString(params, 'start')
265 265
266 this.mode = this.getParamToggle(params, 'p2p-media-loader') ? 'p2p-media-loader' : 'webtorrent' 266 this.mode = this.getParamString(params, 'mode') === 'p2p-media-loader' ? 'p2p-media-loader' : 'webtorrent'
267 } catch (err) { 267 } catch (err) {
268 console.error('Cannot get params from URL.', err) 268 console.error('Cannot get params from URL.', err)
269 } 269 }