From 71867a9a3dad7e6e59bd6b521dc52089d816531f Mon Sep 17 00:00:00 2001 From: Yuval keidar Date: Wed, 30 Oct 2019 10:39:42 +0200 Subject: [PATCH 1/2] Support every browser which won't throw error when structure is invalid fix #2400 throw error when the added cue isn't exist anymore --- src/controller/timeline-controller.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controller/timeline-controller.ts b/src/controller/timeline-controller.ts index 17aa63a15f1..e085bfed053 100644 --- a/src/controller/timeline-controller.ts +++ b/src/controller/timeline-controller.ts @@ -294,6 +294,7 @@ class TimelineController extends EventHandler { if (!currentTrack.cues.getCueById(cue.id)) { try { currentTrack.addCue(cue); + if (!currentTrack.cues.getCueById(cue.id)) throw new Error('browser which doesnt throw error when cues structure is invalid'); } catch (err) { const textTrackCue = new (window as any).TextTrackCue(cue.startTime, cue.endTime, cue.text); textTrackCue.id = cue.id; From 23aeab16431faf208aee016022a3d55d32db4ef6 Mon Sep 17 00:00:00 2001 From: Yuval keidar Date: Mon, 4 Nov 2019 10:20:40 +0200 Subject: [PATCH 2/2] add debug for this purpose --- src/controller/timeline-controller.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controller/timeline-controller.ts b/src/controller/timeline-controller.ts index e085bfed053..7a441c91d6f 100644 --- a/src/controller/timeline-controller.ts +++ b/src/controller/timeline-controller.ts @@ -294,8 +294,11 @@ class TimelineController extends EventHandler { if (!currentTrack.cues.getCueById(cue.id)) { try { currentTrack.addCue(cue); - if (!currentTrack.cues.getCueById(cue.id)) throw new Error('browser which doesnt throw error when cues structure is invalid'); + if (!currentTrack.cues.getCueById(cue.id)) { + throw new Error(`addCue is failed for: ${cue}`); + } } catch (err) { + logger.debug(`Failed occurred on adding cues: ${err}`); const textTrackCue = new (window as any).TextTrackCue(cue.startTime, cue.endTime, cue.text); textTrackCue.id = cue.id; currentTrack.addCue(textTrackCue);