Skip to content

Commit

Permalink
fix(FEV-1104): slides are missing during live when no DVR is configur…
Browse files Browse the repository at this point in the history
…ed (#12)

* fix(FEV-1104): cue-points startTime fix

* fix(FEV-1104): fix typo

* fix(FEV-1104): fix comment
  • Loading branch information
semarche-kaltura authored Oct 26, 2021
1 parent 83e27d2 commit 370c1f8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/providers/live/live-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,19 @@ export class LiveProvider extends Provider {
});
}

private _makeCuePointStartEndTime = (cuePointCreatedAt: number) => {
let startTime = this._player.currentTime - (this._currentTimeLive - cuePointCreatedAt);
if (startTime < 0) {
// TextTrack in Safari doesn't allow add new cue-points with startTime less then 0
startTime = this._player.currentTime;
}
return {startTime, endTime: Number.MAX_SAFE_INTEGER};
};

private _prepareThumbCuePoints = (newThumb: ThumbPushNotificationData) => {
const startTime = this._player.currentTime - (this._currentTimeLive - newThumb.createdAt);
const newThumbCue = {
...newThumb,
startTime,
endTime: Number.MAX_SAFE_INTEGER,
...this._makeCuePointStartEndTime(newThumb.createdAt),
assetUrl: makeAssetUrl(this._player.config.provider.env?.serviceUrl, newThumb.assetId, this._player.config.session?.ks)
};
this._thumbCuePoints.push(newThumbCue);
Expand All @@ -135,13 +142,11 @@ export class LiveProvider extends Provider {
};

private _prepareViewChangeCuePoints = (viewChange: SlideViewChangePushNotificationData) => {
const startTime = this._player.currentTime - (this._currentTimeLive - viewChange.createdAt);
try {
const partnerData = JSON.parse(viewChange.partnerData);
const newViewChangeCue = {
...viewChange,
startTime: Number(startTime.toFixed(2)),
endTime: Number.MAX_SAFE_INTEGER,
...this._makeCuePointStartEndTime(viewChange.createdAt),
partnerData
};
this._slideViewChangeCuePoints.push(newViewChangeCue);
Expand Down

0 comments on commit 370c1f8

Please sign in to comment.