Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Use HLS by default if enabled

Chocobozzz656591660527
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index 8463e15d75..22f0246561 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -52,4 +52,8 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
getHlsPlaylist () {
return this.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
}
+
+ hasHlsPlaylist () {
+ return !!this.getHlsPlaylist()
+ }
}
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 0532e7de7f..b147b75b04 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -423,7 +423,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
}
- const mode: PlayerMode = urlOptions.playerMode === 'p2p-media-loader' ? 'p2p-media-loader' : 'webtorrent'
+ let mode: PlayerMode
+
+ if (urlOptions.playerMode) {
+ if (urlOptions.playerMode === 'p2p-media-loader') mode = 'p2p-media-loader'
+ else mode = 'webtorrent'
+ } else {
+ if (this.video.hasHlsPlaylist()) mode = 'p2p-media-loader'
+ else mode = 'webtorrent'
+ }
if (mode === 'p2p-media-loader') {
const hlsPlaylist = this.video.getHlsPlaylist()