Skip to content

Commit

Permalink
fixed #1214 Playback using link with t=0 does not work (#1231)
Browse files Browse the repository at this point in the history
Jump to 00:00 when set by parameter t = 0
  • Loading branch information
YiranDuan721 authored and SebiWrn committed May 7, 2024
1 parent 9beddd7 commit 61b7559
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/ts/TUMLiveVjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class PlayerSettings {
let iOSReady;
const t: number | undefined = +getQueryParam("t");
this.player.on("loadedmetadata", () => {
if (!isNaN(t) && t) {
if (!isNaN(t)) {
this.player.currentTime(t);
console.log(`⚫️ jump to: ${t}`);
}
});
if (videojs.browser.IS_IOS) {
this.player.on("canplaythrough", () => {
// Can be executed multiple times during playback
if (!iOSReady && t) {
if (!iOSReady) {
this.player.currentTime(t);
iOSReady = true;
}
Expand Down Expand Up @@ -323,11 +323,12 @@ export const watchProgress = function (streamID: number, lastProgress: number) {
let iOSReady = false;
let intervalMillis = 10000;
let jumpTo: number;
const tParam = +getQueryParam("t");

// Fetch the user's video progress from the database and set the time in the player
players[j].on("loadedmetadata", () => {
duration = players[j].duration();
jumpTo = +getQueryParam("t") || lastProgress * duration;
jumpTo = isNaN(tParam) ? lastProgress * duration : tParam;
players[j].currentTime(jumpTo);
});

Expand Down

0 comments on commit 61b7559

Please sign in to comment.