Use HLS by default if enabled

pull/1813/head
Chocobozzz 2019-05-14 11:35:54 +02:00
parent 39e6a5cbec
commit 6565916605
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 13 additions and 1 deletions

View File

@ -52,4 +52,8 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
getHlsPlaylist () { getHlsPlaylist () {
return this.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS) return this.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
} }
hasHlsPlaylist () {
return !!this.getHlsPlaylist()
}
} }

View File

@ -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') { if (mode === 'p2p-media-loader') {
const hlsPlaylist = this.video.getHlsPlaylist() const hlsPlaylist = this.video.getHlsPlaylist()