video: keep time in src switches

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/900/head
Varun Patil 2023-10-26 23:32:50 -07:00
parent 1f7602c8c6
commit 0fad53b3e0
1 changed files with 9 additions and 2 deletions

View File

@ -434,13 +434,13 @@ class VideoContentSetup {
// Set the source to the original video
if (isHLS) {
content.videojs.src(this.getDirectSrc(content));
this.changeSourceKeepTime(content.videojs, this.getDirectSrc(content));
}
return;
} else {
// Set source to HLS
if (!isHLS) {
content.videojs.src(this.getHLSsrc(content));
this.changeSourceKeepTime(content.videojs, this.getHLSsrc(content));
}
}
@ -458,6 +458,13 @@ class VideoContentSetup {
}
}
changeSourceKeepTime(vidjs: Player, src: { src: string; type: string }) {
const time = vidjs.currentTime();
vidjs.src(src);
vidjs.currentTime(time);
vidjs.play();
}
onContentDestroy({ content }: PsVideoEvent) {
this.destroyVideo(content);
}