@d-i-t-a/reader 2.0.0-beta.10 → 2.0.0-beta.11

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
@@ -52390,6 +52390,7 @@ var MediaOverlaySettings = class {
52390
52390
  this.volume = 1;
52391
52391
  this.rate = 1;
52392
52392
  this.playing = false;
52393
+ this.resourceReady = false;
52393
52394
  this.wait = 1;
52394
52395
  this.settingsChangeCallback = () => {
52395
52396
  };
@@ -52781,6 +52782,7 @@ var MediaOverlayModule = class {
52781
52782
  await this.playLink();
52782
52783
  } else {
52783
52784
  if (this.settings.autoTurn && this.settings.playing) {
52785
+ this.audioElement.pause();
52784
52786
  this.delegate.nextResource();
52785
52787
  } else {
52786
52788
  this.stopReadAloud();
@@ -52962,6 +52964,7 @@ var MediaOverlayModule = class {
52962
52964
  } else {
52963
52965
  this.audioElement.pause();
52964
52966
  if (this.settings.autoTurn && this.settings.playing) {
52967
+ this.audioElement.pause();
52965
52968
  this.delegate.nextResource();
52966
52969
  } else {
52967
52970
  this.stopReadAloud();
@@ -52999,6 +53002,7 @@ var MediaOverlayModule = class {
52999
53002
  } else {
53000
53003
  this.audioElement.pause();
53001
53004
  if (this.settings.autoTurn && this.settings.playing) {
53005
+ this.audioElement.pause();
53002
53006
  this.delegate.nextResource();
53003
53007
  } else {
53004
53008
  this.stopReadAloud();
@@ -53111,9 +53115,17 @@ var MediaOverlayModule = class {
53111
53115
  this.audioElement.volume = this.settings.volume;
53112
53116
  if (this.settings.playing) {
53113
53117
  if (!initial) {
53114
- setTimeout(async () => {
53115
- await this.audioElement.play();
53116
- }, this.settings.wait);
53118
+ let checkReady = function() {
53119
+ if (!self2.settings.resourceReady) {
53120
+ setTimeout(checkReady, 200);
53121
+ } else {
53122
+ setTimeout(async () => {
53123
+ await self2.audioElement.play();
53124
+ }, self2.settings.wait * 1200);
53125
+ }
53126
+ };
53127
+ let self2 = this;
53128
+ checkReady();
53117
53129
  } else {
53118
53130
  await this.audioElement.play();
53119
53131
  }
@@ -53133,9 +53145,17 @@ var MediaOverlayModule = class {
53133
53145
  this.audioElement.volume = this.settings.volume;
53134
53146
  if (this.settings.playing) {
53135
53147
  if (!initial) {
53136
- setTimeout(async () => {
53137
- await this.audioElement.play();
53138
- }, this.settings.wait);
53148
+ let checkReady = function() {
53149
+ if (!self2.settings.resourceReady) {
53150
+ setTimeout(checkReady, 200);
53151
+ } else {
53152
+ setTimeout(async () => {
53153
+ await self2.audioElement.play();
53154
+ }, self2.settings.wait * 1200);
53155
+ }
53156
+ };
53157
+ let self2 = this;
53158
+ checkReady();
53139
53159
  } else {
53140
53160
  await this.audioElement.play();
53141
53161
  }
@@ -53204,6 +53224,7 @@ var MediaOverlayModule = class {
53204
53224
  await this.playLink();
53205
53225
  } else {
53206
53226
  if (this.settings.autoTurn && this.settings.playing) {
53227
+ this.audioElement.pause();
53207
53228
  this.delegate.nextResource();
53208
53229
  } else {
53209
53230
  this.stopReadAloud();
@@ -56097,6 +56118,11 @@ var IFrameNavigator = class extends import_events.default {
56097
56118
  }
56098
56119
  await this.updatePositionInfo();
56099
56120
  await this.view?.setSize();
56121
+ setTimeout(() => {
56122
+ if (this.mediaOverlayModule !== void 0) {
56123
+ this.mediaOverlayModule.settings.resourceReady = true;
56124
+ }
56125
+ }, 300);
56100
56126
  }, 200);
56101
56127
  return new Promise((resolve) => resolve());
56102
56128
  } catch (err) {
@@ -57401,6 +57427,9 @@ var IFrameNavigator = class extends import_events.default {
57401
57427
  this.loadingMessage.style.display = "block";
57402
57428
  this.loadingMessage.classList.add("is-loading");
57403
57429
  }
57430
+ if (this.mediaOverlayModule !== void 0) {
57431
+ this.mediaOverlayModule.settings.resourceReady = false;
57432
+ }
57404
57433
  }
57405
57434
  hideIframeContents() {
57406
57435
  this.isBeingStyled = true;