From 686109674cc78ed0848af9bcb2d4132611cf4ab1 Mon Sep 17 00:00:00 2001 From: MosheMaorKaltura Date: Sun, 23 Jun 2024 23:31:44 +0300 Subject: [PATCH] fix/SUP-42321: player crash on ios 17.5+ --- src/common/cuepoint/cuepoint-manager.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/common/cuepoint/cuepoint-manager.ts b/src/common/cuepoint/cuepoint-manager.ts index 689c47de0..beec860d1 100644 --- a/src/common/cuepoint/cuepoint-manager.ts +++ b/src/common/cuepoint/cuepoint-manager.ts @@ -69,10 +69,8 @@ export class CuePointManager { const metadataTracks = this._getMetadataTracks(); metadataTracks.some((track) => { try { - if (track.cues!.getCueById(cue.id)) { - track.removeCue(cue); - return true; - } + track.removeCue(cue); + return true; } catch { // do nothing } @@ -86,13 +84,15 @@ export class CuePointManager { } const timedMetadataArr: Array = []; data.forEach((cuePoint: CuePoint) => { - const textTrackCue = this._createTextTrackCue(cuePoint); - const exisedCue = this._getTextTrackCueById(cuePoint.id); - if (exisedCue) { - this._removeTextTrackCue(exisedCue); + if (cuePoint.id) { + const textTrackCue = this._createTextTrackCue(cuePoint); + const exisedCue = this._getTextTrackCueById(cuePoint.id); + if (exisedCue) { + this._removeTextTrackCue(exisedCue); + } + this._textTrack?.addCue(textTrackCue!); + timedMetadataArr.push(createTimedMetadata(textTrackCue!)!); } - this._textTrack?.addCue(textTrackCue!); - timedMetadataArr.push(createTimedMetadata(textTrackCue!)!); }); this._player.dispatchEvent(