Skip to content

Commit

Permalink
fix(FEC-11792): slides does not appear in dual video (#510)
Browse files Browse the repository at this point in the history
fix `getCuePointById` to return the found cue point
use `some` instead of `forEackh` to break the loop once a cue point found by id
protect the `removeCuePoint`

Solves FEC-11792
  • Loading branch information
yairans authored Dec 23, 2021
1 parent 9f00f81 commit a2f69fa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/common/cuepoint/cuepoint-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,23 @@ export class CuePointManager {
}

getCuePointById(id: string): ?TextTrackCue {
let cuePoint = null;
const metadataTracks = this._getMetadataTracks();
metadataTracks.forEach(track => {
const cuePoint = track.cues.getCueById(id);
if (cuePoint) {
return cuePoint;
}
metadataTracks.some(track => {
cuePoint = track.cues.getCueById(id);
return cuePoint;
});
return cuePoint;
}

removeCuePoint(cuePoint: TextTrackCue) {
const metadataTracks = this._getMetadataTracks();
metadataTracks.forEach(track => {
track.removeCue(cuePoint);
try {
track.removeCue(cuePoint);
} catch (e) {
// do nothing
}
});
}

Expand Down

0 comments on commit a2f69fa

Please sign in to comment.