Changing hls path

This commit is contained in:
Zoe Roux 2021-01-10 19:23:23 +01:00
parent c037f0dc72
commit 19ae493109
2 changed files with 10 additions and 5 deletions

View File

@ -3,7 +3,7 @@ import { Track, WatchItem } from "../../models/watch-item";
export enum method export enum method
{ {
direct = "Direct Play", direct = "Direct",
transmux = "Transmux", transmux = "Transmux",
transcode = "Transcode" transcode = "Transcode"
} }

View File

@ -325,7 +325,7 @@ export class PlayerComponent implements OnInit, OnDestroy, AfterViewInit
playbackError(): void playbackError(): void
{ {
if (this.playMethod == method.transcode) if (this.playMethod === method.transcode)
{ {
this.snackBar.open("This episode can't be played.", null, { this.snackBar.open("This episode can't be played.", null, {
horizontalPosition: "left", horizontalPosition: "left",
@ -335,7 +335,7 @@ export class PlayerComponent implements OnInit, OnDestroy, AfterViewInit
} }
else else
{ {
if (this.playMethod == method.direct) if (this.playMethod === method.direct)
this.playMethod = method.transmux; this.playMethod = method.transmux;
else else
this.playMethod = method.transcode; this.playMethod = method.transcode;
@ -346,8 +346,13 @@ export class PlayerComponent implements OnInit, OnDestroy, AfterViewInit
selectPlayMethod(playMethod: method) selectPlayMethod(playMethod: method)
{ {
this.playMethod = playMethod; this.playMethod = playMethod;
const url: string = `/video/${this.playMethod.toLowerCase()}/${this.item.slug}/`; const url: string = [
if (this.playMethod == method.direct || this.player.canPlayType("application/vnd.apple.mpegurl")) "/video",
this.playMethod.toLowerCase(),
this.item.slug,
this.playMethod != method.direct ? 'master.m3u8' : null
].filter(x => x !== null).join("/");
if (this.playMethod === method.direct || this.player.canPlayType("application/vnd.apple.mpegurl"))
this.player.src = url; this.player.src = url;
else else
{ {