Skip to content

Commit

Permalink
fix: live event seek to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
Bitaru committed May 21, 2024
1 parent 8a219f7 commit a85f34b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/video-container/Video-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import "../buttons/Play";
import { subtitlesController, SubtitlesController } from "./subtitles";
import { sourcesController, SourcesController } from "./sources";

const END_OF_STREAM_SECONDS = 99999;

const INIT_NATIVE_HLS_RE = /^((?!chrome|android).)*safari/i;

// In Safari on live streams video.duration = Infinity
Expand Down Expand Up @@ -176,7 +174,9 @@ export class VideoContainer extends LitElement {
dispatch(this, Types.Action.live, { live: true });
if (this.played) {
window.requestAnimationFrame(() => {
this.videos[0].currentTime = END_OF_STREAM_SECONDS;
const seekable = this.videos[0].seekable;
const end = seekable?.length ? seekable.end(0) - 10 : 999999;
this.videos[0].currentTime = end;
this.play();
});
}
Expand Down

0 comments on commit a85f34b

Please sign in to comment.