aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/js/captions.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/js/captions.js b/src/js/captions.js
index b3723885..38167d7a 100644
--- a/src/js/captions.js
+++ b/src/js/captions.js
@@ -127,13 +127,10 @@ const captions = {
// Get the tracks
getTracks() {
- // Return empty array at least
- if (utils.is.nullOrUndefined(this.media)) {
- return [];
- }
-
- // Only get accepted kinds
- return Array.from(this.media.textTracks || []).filter(track => [
+ // Handle media or textTracks missing or null
+ const { textTracks } = this.media || {};
+ // Filter out invalid tracks kinds (like metadata)
+ return Array.from(textTracks || []).filter(track => [
'captions',
'subtitles',
].includes(track.kind));