bloom-player 2.11.1 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A library for displaying Bloom books in iframes or WebViews",
4
4
  "author": "SIL Global",
5
5
  "license": "MIT",
6
- "version": "2.11.1",
6
+ "version": "2.11.2",
7
7
  "private": false,
8
8
  "// sideeffects might need to be ['*.css'] to avoid 'shaking' our CSS, if we ever get tree shaking working": "",
9
9
  "sideEffects": false,
@@ -752,13 +752,13 @@ function setSoundAndHighlight(
752
752
  disableHighlightIfNoAudio: boolean,
753
753
  oldElement?: Element | null | undefined,
754
754
  ) {
755
+ setSoundFrom(newElement);
755
756
  setHighlightTo({
756
757
  newElement,
757
758
  shouldScrollToElement: true, // Always true in bloom-player version
758
759
  disableHighlightIfNoAudio,
759
760
  oldElement,
760
761
  });
761
- setSoundFrom(newElement);
762
762
  }
763
763
 
764
764
  function setHighlightTo({
@@ -785,10 +785,13 @@ function setHighlightTo({
785
785
 
786
786
  removeAudioCurrent((oldElement || newElement) as HTMLElement);
787
787
 
788
- if (disableHighlightIfNoAudio) {
789
- const mediaPlayer = getPlayer();
788
+ const mediaPlayer = getPlayer();
789
+ // The "error" may just be that audio has not been recorded for this element.
790
+ // If the audio is missing, then strange things happen in the interaction between
791
+ // narration and drag activity text. See BL-14797
792
+ const hasError = mediaPlayer.error !== null;
793
+ if (!hasError && disableHighlightIfNoAudio) {
790
794
  const isAlreadyPlaying = mediaPlayer.currentTime > 0;
791
-
792
795
  // If it's already playing, no need to disable (Especially in the Soft Split case, where only one file is playing but multiple sentences need to be highlighted).
793
796
  if (!isAlreadyPlaying) {
794
797
  // Start off in a highlight-disabled state so we don't display any momentary highlight for cases where there is no audio for this element.
@@ -800,10 +803,14 @@ function setHighlightTo({
800
803
  mediaPlayer.addEventListener("playing", () => {
801
804
  newElement.classList.remove(kSuppressHighlightClass);
802
805
  });
806
+ mediaPlayer.addEventListener("error", () => {
807
+ newElement.classList.remove("ui-audioCurrent");
808
+ newElement.classList.remove(kSuppressHighlightClass);
809
+ });
803
810
  }
804
811
  }
805
812
 
806
- newElement.classList.add("ui-audioCurrent");
813
+ if (!hasError) newElement.classList.add("ui-audioCurrent");
807
814
  // If the current audio is part of a (currently typically hidden) image description,
808
815
  // highlight the image.
809
816
  // it's important to check for imageDescription on the translationGroup;