1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-08-08 10:12:50 +00:00

Receivers: Resume on receiver timestamp on sender reconnect

This commit is contained in:
Michael Hollister 2025-04-25 09:54:08 -05:00
parent 2afa866d82
commit a5fc61fd85
2 changed files with 19 additions and 27 deletions

View file

@ -8,13 +8,15 @@ export enum PlayerType {
}
export class Player {
private player: dashjs.MediaPlayerClass | HTMLVideoElement
private hlsPlayer: Hls | undefined
public playerType: PlayerType
private player: dashjs.MediaPlayerClass | HTMLVideoElement;
private hlsPlayer: Hls | undefined;
private source: string;
public playerType: PlayerType;
constructor(playerType: PlayerType, player: dashjs.MediaPlayerClass | HTMLVideoElement, hlsPlayer?: Hls) {
constructor(playerType: PlayerType, player: dashjs.MediaPlayerClass | HTMLVideoElement, source: string, hlsPlayer?: Hls) {
this.playerType = playerType;
this.player = player;
this.source = source;
this.hlsPlayer = playerType === PlayerType.Hls ? hlsPlayer : null;
}
@ -162,12 +164,7 @@ export class Player {
}
getSource(): string {
if (this.playerType === PlayerType.Dash) {
const videoPlayer = this.player as dashjs.MediaPlayerClass;
return videoPlayer.getSource() instanceof String ? videoPlayer.getSource() as string : JSON.stringify(videoPlayer.getSource());
} else { // HLS, HTML
return (this.player as HTMLVideoElement).src;
}
return this.source;
}
getBufferLength(): number {