From 9bd26b48f923d7a387c5add8e512991275776c65 Mon Sep 17 00:00:00 2001 From: mister-ben Date: Tue, 19 Sep 2023 19:22:44 +0200 Subject: [PATCH 1/2] fix: Resolves captions sizing issue when minified --- src/js/tracks/text-track.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/tracks/text-track.js b/src/js/tracks/text-track.js index 05ddd4db52..946cc17d50 100644 --- a/src/js/tracks/text-track.js +++ b/src/js/tracks/text-track.js @@ -391,7 +391,7 @@ class TextTrack extends Track { addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor.name !== 'VTTCue') { + if (cue.constructor && cue.constructor !== window.vttjs.VTTCue) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) { From 6d4e21b4b8b6f7709afef9b8c6f705c89569a6ea Mon Sep 17 00:00:00 2001 From: mister-ben Date: Tue, 19 Sep 2023 22:54:17 +0200 Subject: [PATCH 2/2] Change test for minification --- src/js/tracks/text-track.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/tracks/text-track.js b/src/js/tracks/text-track.js index 946cc17d50..5c94a709d7 100644 --- a/src/js/tracks/text-track.js +++ b/src/js/tracks/text-track.js @@ -391,7 +391,8 @@ class TextTrack extends Track { addCue(originalCue) { let cue = originalCue; - if (cue.constructor && cue.constructor !== window.vttjs.VTTCue) { + // Testing if the cue is a VTTCue in a way that survives minification + if (!('getCueAsHTML' in cue)) { cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text); for (const prop in originalCue) {