@xiboplayer/renderer 0.5.4 → 0.5.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiboplayer/renderer",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "RendererLite - Fast, efficient XLF layout rendering engine",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -12,8 +12,8 @@
12
12
  "dependencies": {
13
13
  "nanoevents": "^9.1.0",
14
14
  "pdfjs-dist": "^4.10.38",
15
- "@xiboplayer/cache": "0.5.4",
16
- "@xiboplayer/utils": "0.5.4"
15
+ "@xiboplayer/cache": "0.5.6",
16
+ "@xiboplayer/utils": "0.5.6"
17
17
  },
18
18
  "devDependencies": {
19
19
  "vitest": "^2.0.0",
@@ -209,7 +209,6 @@ export class RendererLite {
209
209
  this._paused = false;
210
210
  this._layoutTimerStartedAt = null; // Date.now() when layout timer started
211
211
  this._layoutTimerDurationMs = null; // Total layout duration in ms
212
- this._layoutTimerRemaining = null; // ms remaining when paused
213
212
  this.widgetTimers = new Map(); // widgetId => timer
214
213
  this.mediaUrlCache = new Map(); // fileId => blob URL (for parallel pre-fetching)
215
214
  this.layoutBlobUrls = new Map(); // layoutId => Set<blobUrl> (for lifecycle tracking)
@@ -3153,21 +3152,13 @@ export class RendererLite {
3153
3152
  }
3154
3153
 
3155
3154
  /**
3156
- * Pause playback: stop layout timer, pause all media, stop widget cycling.
3157
- * The layout timer's remaining time is saved so resume() can restart it.
3155
+ * Pause playback: pause all media, stop widget cycling.
3156
+ * The layout timer keeps running schedule is authoritative.
3158
3157
  */
3159
3158
  pause() {
3160
3159
  if (this._paused) return;
3161
3160
  this._paused = true;
3162
3161
 
3163
- // Save remaining layout time
3164
- if (this.layoutTimer && this._layoutTimerStartedAt) {
3165
- const elapsed = Date.now() - this._layoutTimerStartedAt;
3166
- this._layoutTimerRemaining = Math.max(0, this._layoutTimerDurationMs - elapsed);
3167
- clearTimeout(this.layoutTimer);
3168
- this.layoutTimer = null;
3169
- }
3170
-
3171
3162
  // Stop all region widget-cycling timers
3172
3163
  for (const [, region] of this.regions) {
3173
3164
  if (region.timer) {
@@ -3180,7 +3171,7 @@ export class RendererLite {
3180
3171
  this._forEachMedia(el => el.pause());
3181
3172
 
3182
3173
  this.emit('paused');
3183
- this.log.info('Playback paused');
3174
+ this.log.info('Playback paused (layout timer continues)');
3184
3175
  }
3185
3176
 
3186
3177
  /**
@@ -3191,27 +3182,13 @@ export class RendererLite {
3191
3182
  }
3192
3183
 
3193
3184
  /**
3194
- * Resume playback: restart layout timer with remaining time, resume media and widget cycling.
3185
+ * Resume playback: resume media and widget cycling.
3186
+ * Layout timer was never paused — no need to restore it.
3195
3187
  */
3196
3188
  resume() {
3197
3189
  if (!this._paused) return;
3198
3190
  this._paused = false;
3199
3191
 
3200
- // Resume layout timer with remaining time
3201
- if (this._layoutTimerRemaining != null && this._layoutTimerRemaining > 0) {
3202
- this._layoutTimerStartedAt = Date.now();
3203
- this._layoutTimerDurationMs = this._layoutTimerRemaining;
3204
- const layoutId = this.currentLayoutId;
3205
- this.layoutTimer = setTimeout(() => {
3206
- this.log.info(`Layout ${layoutId} duration expired (resumed)`);
3207
- if (this.currentLayoutId) {
3208
- this.layoutEndEmitted = true;
3209
- this.emit('layoutEnd', this.currentLayoutId);
3210
- }
3211
- }, this._layoutTimerRemaining);
3212
- this._layoutTimerRemaining = null;
3213
- }
3214
-
3215
3192
  // Resume all video/audio
3216
3193
  this._forEachMedia(el => el.play().catch(() => {}));
3217
3194