@d-i-t-a/reader 2.1.0-beta.10 → 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);
@@ -41280,10 +41282,12 @@ var MediaOverlayModule = class {
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)