Skip to content

Commit

Permalink
fix(FEC-13781): use new isPreventSeek redux state (#61)
Browse files Browse the repository at this point in the history
### Description of the Changes

**the issue:**
When `PreventFwdSeek` set to true, "Quiz completed" toast is display although not all of the question were answered.

**root cause:**
since cuePoint service is delaying the cuePoints in case `preventSeek` plugin feature is active, ivq is not getting any data so it thinks the quiz is completed.

**solution:**
- use new `isPreventSeek` redux state
- for quiz cuePoints, send the cue points immediately

Solves [FEC-13781](https://kaltura.atlassian.net/browse/FEC-13781)

[FEC-13781]: https://kaltura.atlassian.net/browse/FEC-13781?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
lianbenjamin authored Mar 21, 2024
1 parent e4ae297 commit a8af9cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/cuepoint-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class CuepointService {
private _eventManager: EventManager;
private _logger: Logger;
private _mediaLoaded: boolean = false;
private _isPreventSeekActive: boolean = false;

public get CuepointType() {
return KalturaCuePointType;
Expand Down Expand Up @@ -45,10 +44,6 @@ export class CuepointService {
});
}

public setIsPreventSeekActive = (isPreventSeekActive: boolean): void => {
this._isPreventSeekActive = isPreventSeekActive;
};

public registerTypes(types: KalturaCuePointType[]) {
if (this._mediaLoaded) {
this._logger.warn('Cue point registration should occur on loadMedia (or before)');
Expand All @@ -75,14 +70,13 @@ export class CuepointService {
if (this._player.isLive()) {
this._provider = new LiveProvider(this._player, this._eventManager, this._logger, this._types);
} else {
this._provider = new VodProvider(this._player, this._eventManager, this._logger, this._types, this._isPreventSeekActive);
this._provider = new VodProvider(this._player, this._eventManager, this._logger, this._types);
}
}

public reset(): void {
this._mediaLoaded = false;
this._types.clear();
this._provider?.destroy();
this._isPreventSeekActive = false;
}
}
6 changes: 3 additions & 3 deletions src/providers/vod/vod-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export class VodProvider extends Provider {
private _lastTimeUpdated: number = 0;
private _isPreventSeekActive: boolean;

constructor(player: Player, eventManager: EventManager, logger: Logger, types: CuepointTypeMap, isPreventSeekActive: boolean) {
constructor(player: Player, eventManager: EventManager, logger: Logger, types: CuepointTypeMap) {
super(player, eventManager, logger, types);
this._isPreventSeekActive = isPreventSeekActive;
this._isPreventSeekActive = player.ui.store.getState().seekbar.isPreventSeek;
this._addListeners();
this._fetchVodData();
}
Expand Down Expand Up @@ -350,7 +350,7 @@ export class VodProvider extends Provider {
let cuePoints = createCuePointList(quizQuestionCuePoints);
cuePoints = this._filterAndShiftCuePoints(cuePoints);
cuePoints = sortArrayBy(cuePoints, 'startTime', 'createdAt');
this._addCuePointsData(cuePoints);
this._addCuePointToPlayer(cuePoints);
}
}

Expand Down

0 comments on commit a8af9cc

Please sign in to comment.