@xiboplayer/schedule 0.5.7 → 0.5.8
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 +2 -2
- package/src/schedule.js +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/schedule",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"description": "Complete scheduling solution: campaigns, dayparting, interrupts, and overlays",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./overlays": "./src/overlays.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@xiboplayer/utils": "0.5.
|
|
14
|
+
"@xiboplayer/utils": "0.5.8"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"vitest": "^2.0.0"
|
package/src/schedule.js
CHANGED
|
@@ -644,13 +644,18 @@ export class ScheduleManager {
|
|
|
644
644
|
dynamicLayouts: options.dynamicLayouts || new Set(),
|
|
645
645
|
});
|
|
646
646
|
|
|
647
|
+
const prevLayoutSet = this._queueLayoutSet;
|
|
647
648
|
this._scheduleQueue = result;
|
|
648
649
|
this._queueLayoutSet = layoutSetKey;
|
|
649
|
-
|
|
650
|
-
|
|
650
|
+
|
|
651
|
+
// Position only resets when we get a genuinely new set of layouts.
|
|
652
|
+
// Duration corrections rebuild the queue but don't change position.
|
|
653
|
+
if (prevLayoutSet !== layoutSetKey) {
|
|
654
|
+
this._queuePosition = 0;
|
|
655
|
+
}
|
|
651
656
|
|
|
652
657
|
if (result.queue.length > 0) {
|
|
653
|
-
log.info(`[Schedule] Built queue: ${result.queue.length} entries, period ${result.periodSeconds}s`);
|
|
658
|
+
log.info(`[Schedule] Built queue: ${result.queue.length} entries, period ${result.periodSeconds}s (pos ${this._queuePosition})`);
|
|
654
659
|
log.info(`[Schedule] Queue: ${result.queue.map(e => `${e.layoutId}(${e.duration}s)`).join(' → ')}`);
|
|
655
660
|
}
|
|
656
661
|
|
|
@@ -707,8 +712,10 @@ export class ScheduleManager {
|
|
|
707
712
|
*/
|
|
708
713
|
_invalidateQueue() {
|
|
709
714
|
this._scheduleQueue = null;
|
|
710
|
-
|
|
711
|
-
|
|
715
|
+
// Keep _queueLayoutSet so getScheduleQueue() can detect whether the
|
|
716
|
+
// layout set actually changed. Position only resets on new layouts.
|
|
717
|
+
// Resetting on every setSchedule() caused the player to replay position 0
|
|
718
|
+
// endlessly because collections happen more often than layout cycles.
|
|
712
719
|
}
|
|
713
720
|
|
|
714
721
|
/**
|