ydshieh HF staff commited on
Commit
17a4757
1 Parent(s): 3f13f99

Update transcript-tracer.js

Browse files
Files changed (1) hide show
  1. transcript-tracer.js +4 -2
transcript-tracer.js CHANGED
@@ -459,9 +459,11 @@ function handleWordClick(e) {
459
  var transcript = wordElement.closest('.tt-transcript');
460
  var mediaUrl = transcript.dataset.ttCurrentMediaUrl;
461
  var startSeconds = ttLinkedDataByMediaUrl[mediaUrl].wordTimings[wordIndex].startSeconds
462
- var ttData = ttLinkedDataByMediaUrl[ttActivePlayer.dataset.ttLinkedMediaUrl];
463
-
464
  ttLinkedDataByMediaUrl[mediaUrl].mediaElement.currentTime = startSeconds;
 
 
 
465
 
466
  // Make sure the correct transcript is selected
467
  if (!ttCurrentTranscript || ttCurrentTranscript.dataset.ttTranscript != ttData.transcriptIndex) {
 
459
  var transcript = wordElement.closest('.tt-transcript');
460
  var mediaUrl = transcript.dataset.ttCurrentMediaUrl;
461
  var startSeconds = ttLinkedDataByMediaUrl[mediaUrl].wordTimings[wordIndex].startSeconds
462
+
 
463
  ttLinkedDataByMediaUrl[mediaUrl].mediaElement.currentTime = startSeconds;
464
+
465
+ if (!ttActivePlayer || !(ttActivePlayer.dataset.ttLinkedMediaUrl in ttLinkedDataByMediaUrl)) return;
466
+ var ttData = ttLinkedDataByMediaUrl[ttActivePlayer.dataset.ttLinkedMediaUrl];
467
 
468
  // Make sure the correct transcript is selected
469
  if (!ttCurrentTranscript || ttCurrentTranscript.dataset.ttTranscript != ttData.transcriptIndex) {