aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-29 08:37:25 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit092092969633bbcf6d4891a083ea497a7d5c3154 (patch)
tree69e82fe4f60c444cca216830e96afe143a9dac71 /client/src/app/videos
parent4348a27d252a3349bafa7ef4859c0e2cf060c255 (diff)
downloadPeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.gz
PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.tar.zst
PeerTube-092092969633bbcf6d4891a083ea497a7d5c3154.zip
Add hls support on server
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts28
1 files changed, 23 insertions, 5 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 6e38af195..f77316712 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -23,7 +23,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
23import { environment } from '../../../environments/environment' 23import { environment } from '../../../environments/environment'
24import { VideoCaptionService } from '@app/shared/video-caption' 24import { VideoCaptionService } from '@app/shared/video-caption'
25import { MarkdownService } from '@app/shared/renderer' 25import { MarkdownService } from '@app/shared/renderer'
26import { PeertubePlayerManager } from '../../../assets/player/peertube-player-manager' 26import { P2PMediaLoaderOptions, PeertubePlayerManager, PlayerMode, WebtorrentOptions } from '../../../assets/player/peertube-player-manager'
27 27
28@Component({ 28@Component({
29 selector: 'my-video-watch', 29 selector: 'my-video-watch',
@@ -424,15 +424,33 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
424 serverUrl: environment.apiUrl, 424 serverUrl: environment.apiUrl,
425 425
426 videoCaptions: playerCaptions 426 videoCaptions: playerCaptions
427 }, 427 }
428 }
428 429
429 webtorrent: { 430 let mode: PlayerMode
431 const hlsPlaylist = this.video.getHlsPlaylist()
432 if (hlsPlaylist) {
433 mode = 'p2p-media-loader'
434 const p2pMediaLoader = {
435 playlistUrl: hlsPlaylist.playlistUrl,
436 segmentsSha256Url: hlsPlaylist.segmentsSha256Url,
437 redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl),
438 trackerAnnounce: this.video.trackerUrls,
430 videoFiles: this.video.files 439 videoFiles: this.video.files
431 } 440 } as P2PMediaLoaderOptions
441
442 Object.assign(options, { p2pMediaLoader })
443 } else {
444 mode = 'webtorrent'
445 const webtorrent = {
446 videoFiles: this.video.files
447 } as WebtorrentOptions
448
449 Object.assign(options, { webtorrent })
432 } 450 }
433 451
434 this.zone.runOutsideAngular(async () => { 452 this.zone.runOutsideAngular(async () => {
435 this.player = await PeertubePlayerManager.initialize('webtorrent', options) 453 this.player = await PeertubePlayerManager.initialize(mode, options)
436 this.player.on('customError', ({ err }: { err: any }) => this.handleError(err)) 454 this.player.on('customError', ({ err }: { err: any }) => this.handleError(err))
437 }) 455 })
438 456