@d-i-t-a/reader 2.1.0-beta.11 → 2.1.0-beta.12

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/dist/esm/index.js CHANGED
@@ -41188,17 +41188,19 @@ var MediaOverlayModule = class {
41188
41188
  this.trackCurrentTime();
41189
41189
  };
41190
41190
  this.ensureOnTimeUpdate = (remove, replace) => {
41191
- if (this.audioElement) {
41192
- if (remove) {
41193
- if (this.__ontimeupdate) {
41194
- this.__ontimeupdate = false;
41191
+ if (remove) {
41192
+ if (this.__ontimeupdate) {
41193
+ this.__ontimeupdate = false;
41194
+ if (this.audioElement) {
41195
41195
  this.audioElement.removeEventListener("timeupdate", this.ontimeupdate);
41196
- cancelAnimationFrame(this.myReq);
41197
41196
  }
41198
- } else {
41199
- if (!this.__ontimeupdate || replace) {
41200
- this.__ontimeupdate = true;
41201
- if (replace) {
41197
+ cancelAnimationFrame(this.myReq);
41198
+ }
41199
+ } else {
41200
+ if (!this.__ontimeupdate || replace) {
41201
+ this.__ontimeupdate = true;
41202
+ if (replace) {
41203
+ if (this.audioElement) {
41202
41204
  this.audioElement.removeEventListener("timeupdate", this.ontimeupdate);
41203
41205
  }
41204
41206
  this.audioElement.addEventListener("timeupdate", this.ontimeupdate);
@@ -41273,17 +41275,19 @@ var MediaOverlayModule = class {
41273
41275
  await this.playMediaOverlays(hrefUrlObj.pathname.substr(1), link.MediaOverlays, void 0);
41274
41276
  } else {
41275
41277
  if (this.audioElement) {
41276
- await this.audioElement?.pause();
41278
+ await this.audioElement.pause();
41277
41279
  }
41278
41280
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41279
41281
  this.currentLinkIndex++;
41280
41282
  await this.playLink();
41281
41283
  } else {
41282
41284
  if (this.settings.autoTurn && this.settings.playing) {
41283
- this.audioElement?.pause();
41285
+ if (this.audioElement) {
41286
+ await this.audioElement.pause();
41287
+ }
41284
41288
  this.delegate.nextResource();
41285
41289
  } else {
41286
- this.stopReadAloud();
41290
+ await this.stopReadAloud();
41287
41291
  }
41288
41292
  }
41289
41293
  }
@@ -41291,7 +41295,7 @@ var MediaOverlayModule = class {
41291
41295
  async startReadAloud() {
41292
41296
  if (this.delegate.rights.enableMediaOverlays) {
41293
41297
  this.settings.playing = true;
41294
- if (this.audioElement) {
41298
+ if (this.audioElement && this.currentLinks[this.currentLinkIndex]?.Properties.MediaOverlay) {
41295
41299
  const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
41296
41300
  this.audioElement.currentTime = timeToSeekTo;
41297
41301
  await this.audioElement.play();
@@ -41318,10 +41322,8 @@ var MediaOverlayModule = class {
41318
41322
  }
41319
41323
  async stopReadAloud() {
41320
41324
  if (this.delegate.rights.enableMediaOverlays) {
41321
- if (this.currentLinkIndex > 0)
41322
- await this.playLink();
41323
41325
  this.settings.playing = false;
41324
- this.audioElement?.pause();
41326
+ this.audioElement.pause();
41325
41327
  if (this.play)
41326
41328
  this.play.style.removeProperty("display");
41327
41329
  if (this.pause)
@@ -41331,7 +41333,7 @@ var MediaOverlayModule = class {
41331
41333
  pauseReadAloud() {
41332
41334
  if (this.delegate.rights.enableMediaOverlays) {
41333
41335
  this.settings.playing = false;
41334
- this.audioElement?.pause();
41336
+ this.audioElement.pause();
41335
41337
  if (this.play)
41336
41338
  this.play.style.removeProperty("display");
41337
41339
  if (this.pause)
@@ -41443,9 +41445,9 @@ var MediaOverlayModule = class {
41443
41445
  this.currentLinkIndex++;
41444
41446
  this.playLink();
41445
41447
  } else {
41446
- this.audioElement?.pause();
41448
+ this.audioElement.pause();
41447
41449
  if (this.settings.autoTurn && this.settings.playing) {
41448
- this.audioElement?.pause();
41450
+ this.audioElement.pause();
41449
41451
  this.delegate.nextResource();
41450
41452
  } else {
41451
41453
  this.stopReadAloud();
@@ -41477,9 +41479,9 @@ var MediaOverlayModule = class {
41477
41479
  this.currentLinkIndex++;
41478
41480
  this.playLink();
41479
41481
  } else {
41480
- this.audioElement?.pause();
41482
+ this.audioElement.pause();
41481
41483
  if (this.settings.autoTurn && this.settings.playing) {
41482
- this.audioElement?.pause();
41484
+ this.audioElement.pause();
41483
41485
  this.delegate.nextResource();
41484
41486
  } else {
41485
41487
  this.stopReadAloud();
@@ -41497,7 +41499,7 @@ var MediaOverlayModule = class {
41497
41499
  import_loglevel10.default.log("mediaOverlaysPause()");
41498
41500
  this.mediaOverlayHighlight(void 0);
41499
41501
  if (this.audioElement) {
41500
- this.audioElement?.pause();
41502
+ this.audioElement.pause();
41501
41503
  }
41502
41504
  }
41503
41505
  findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
@@ -41635,7 +41637,7 @@ var MediaOverlayModule = class {
41635
41637
  import_loglevel10.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
41636
41638
  this.audioElement = document.getElementById("AUDIO_MO_ID");
41637
41639
  if (this.audioElement) {
41638
- this.audioElement?.pause();
41640
+ this.audioElement.pause();
41639
41641
  this.audioElement.setAttribute("src", "");
41640
41642
  if (this.audioElement.parentNode) {
41641
41643
  this.audioElement.parentNode.removeChild(this.audioElement);
@@ -41669,7 +41671,7 @@ var MediaOverlayModule = class {
41669
41671
  await this.playLink();
41670
41672
  } else {
41671
41673
  if (this.settings.autoTurn && this.settings.playing) {
41672
- this.audioElement?.pause();
41674
+ this.audioElement.pause();
41673
41675
  this.delegate.nextResource();
41674
41676
  } else {
41675
41677
  this.stopReadAloud();