aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-06 10:39:50 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit6ec0b75beb9c8bcd84e178912319913b91830da2 (patch)
treed6fbcb774c5019fc20f42e8f9da4529545fdcbf9 /client/src/app
parent092092969633bbcf6d4891a083ea497a7d5c3154 (diff)
downloadPeerTube-6ec0b75beb9c8bcd84e178912319913b91830da2.tar.gz
PeerTube-6ec0b75beb9c8bcd84e178912319913b91830da2.tar.zst
PeerTube-6ec0b75beb9c8bcd84e178912319913b91830da2.zip
Fallback HLS to webtorrent
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts23
1 files changed, 16 insertions, 7 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 f77316712..e1766255b 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,13 @@ 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 { P2PMediaLoaderOptions, PeertubePlayerManager, PlayerMode, WebtorrentOptions } from '../../../assets/player/peertube-player-manager' 26import {
27 P2PMediaLoaderOptions,
28 PeertubePlayerManager,
29 PeertubePlayerManagerOptions,
30 PlayerMode,
31 WebtorrentOptions
32} from '../../../assets/player/peertube-player-manager'
27 33
28@Component({ 34@Component({
29 selector: 'my-video-watch', 35 selector: 'my-video-watch',
@@ -395,10 +401,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
395 src: environment.apiUrl + c.captionPath 401 src: environment.apiUrl + c.captionPath
396 })) 402 }))
397 403
398 const options = { 404 const options: PeertubePlayerManagerOptions = {
399 common: { 405 common: {
400 autoplay: this.isAutoplay(), 406 autoplay: this.isAutoplay(),
407
401 playerElement: this.playerElement, 408 playerElement: this.playerElement,
409 onPlayerElementChange: (element: HTMLVideoElement) => this.playerElement = element,
410
402 videoDuration: this.video.duration, 411 videoDuration: this.video.duration,
403 enableHotkeys: true, 412 enableHotkeys: true,
404 inactivityTimeout: 2500, 413 inactivityTimeout: 2500,
@@ -424,6 +433,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
424 serverUrl: environment.apiUrl, 433 serverUrl: environment.apiUrl,
425 434
426 videoCaptions: playerCaptions 435 videoCaptions: playerCaptions
436 },
437
438 webtorrent: {
439 videoFiles: this.video.files
427 } 440 }
428 } 441 }
429 442
@@ -431,6 +444,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
431 const hlsPlaylist = this.video.getHlsPlaylist() 444 const hlsPlaylist = this.video.getHlsPlaylist()
432 if (hlsPlaylist) { 445 if (hlsPlaylist) {
433 mode = 'p2p-media-loader' 446 mode = 'p2p-media-loader'
447
434 const p2pMediaLoader = { 448 const p2pMediaLoader = {
435 playlistUrl: hlsPlaylist.playlistUrl, 449 playlistUrl: hlsPlaylist.playlistUrl,
436 segmentsSha256Url: hlsPlaylist.segmentsSha256Url, 450 segmentsSha256Url: hlsPlaylist.segmentsSha256Url,
@@ -442,11 +456,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
442 Object.assign(options, { p2pMediaLoader }) 456 Object.assign(options, { p2pMediaLoader })
443 } else { 457 } else {
444 mode = 'webtorrent' 458 mode = 'webtorrent'
445 const webtorrent = {
446 videoFiles: this.video.files
447 } as WebtorrentOptions
448
449 Object.assign(options, { webtorrent })
450 } 459 }
451 460
452 this.zone.runOutsideAngular(async () => { 461 this.zone.runOutsideAngular(async () => {