Skip to content

Commit

Permalink
Merge pull request #48 from Uscreen-video/fix-live-mode
Browse files Browse the repository at this point in the history
fix: live event seek to the end
  • Loading branch information
Bitaru committed May 21, 2024
2 parents bfbf76c + a85f34b commit b529576
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 b529576

Please sign in to comment.