chore(video-player): rebuild dist for v0.1.3

This commit is contained in:
2026-03-20 15:09:34 +03:00
parent 8ac6e00b68
commit 9eaca089e5
10 changed files with 53 additions and 26 deletions

View File

@@ -465,6 +465,24 @@ export class VideoPlayerRuntime {
pLoader: playlistLoader,
};
}
syncLiveUi(player, video, isLive) {
const wrapper = video.parentElement;
if (isLive) {
wrapper?.classList.add("vjs-hls-live", "vjs-live");
player.duration(Infinity);
if (player.liveTracker) {
player.liveTracker.isLive_ = true;
player.liveTracker.startTracking();
player.liveTracker.trigger("durationchange");
}
return;
}
wrapper?.classList.remove("vjs-hls-live", "vjs-live");
if (player.liveTracker) {
player.liveTracker.isLive_ = false;
player.liveTracker.trigger("durationchange");
}
}
async loadHlsSource() {
const options = this.options;
const player = this.playerRef;
@@ -508,19 +526,27 @@ export class VideoPlayerRuntime {
duration: details?.totalduration,
live: details?.live,
});
if (details?.live) {
video.parentElement?.classList.add("vjs-hls-live", "vjs-live");
player.duration(Infinity);
if (player.liveTracker) {
player.liveTracker.isLive_ = true;
player.liveTracker.startTracking();
player.liveTracker.trigger("durationchange");
}
if (typeof details?.live === "boolean") {
this.syncLiveUi(player, video, details.live);
}
if (options.initialTime > 0) {
hls.startLoad(options.initialTime);
}
});
hls.on(Hls.Events.LEVEL_LOADED, (_event, data) => {
const details = data?.details;
if (!details) {
return;
}
this.emit("manifestloaded", {
engine: "hls",
duration: details.totalduration,
live: details.live,
});
if (typeof details.live === "boolean") {
this.syncLiveUi(player, video, details.live);
}
});
hls.on(Hls.Events.FRAG_CHANGED, () => {
if (player.liveTracker) {
player.liveTracker.atLiveEdge = isAtLiveEdge;
@@ -722,10 +748,8 @@ export class VideoPlayerRuntime {
const videoElement = this.playerRef
.el()
?.querySelector("video");
videoElement?.parentElement?.classList.remove("vjs-hls-live", "vjs-live");
if (this.playerRef.liveTracker) {
this.playerRef.liveTracker.isLive_ = false;
this.playerRef.liveTracker.trigger("durationchange");
if (videoElement) {
this.syncLiveUi(this.playerRef, videoElement, false);
}
}
}