From 52033e878856875fb300d3958cd693df40e81c51 Mon Sep 17 00:00:00 2001 From: Willow Gillingham Date: Tue, 13 Jul 2021 21:57:39 +0000 Subject: [PATCH] check that there are audio textTracks before trying to use them for #1871 --- modules/islandora_audio/js/audio.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/islandora_audio/js/audio.js b/modules/islandora_audio/js/audio.js index e7a57ea5..de0daec7 100644 --- a/modules/islandora_audio/js/audio.js +++ b/modules/islandora_audio/js/audio.js @@ -21,10 +21,12 @@ function init(context,settings){ if (!initialized){ initialized = true; - $('audio')[0].textTracks[0].oncuechange = function() { - var currentCue = this.activeCues[0].text; - $('#audioTrack').html(currentCue); - } + if ($('audio')[0].textTracks.length > 0) { + $('audio')[0].textTracks[0].oncuechange = function() { + var currentCue = this.activeCues[0].text; + $('#audioTrack').html(currentCue); + } + } } } Drupal.Audio = Drupal.Audio || {};