Restore seamless native looping for zero emit loop delay
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.03.01 R331";
|
window.CHGRID_WEB_VERSION = "2026.03.01 R332";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ export class ItemEmitRuntime {
|
|||||||
element.playbackRate = initialRates.playbackRate;
|
element.playbackRate = initialRates.playbackRate;
|
||||||
const initialDelaySeconds = resolveEmitInitialDelaySeconds(item);
|
const initialDelaySeconds = resolveEmitInitialDelaySeconds(item);
|
||||||
const loopDelaySeconds = resolveEmitLoopDelaySeconds(item);
|
const loopDelaySeconds = resolveEmitLoopDelaySeconds(item);
|
||||||
|
element.loop = loopDelaySeconds <= 0;
|
||||||
const resumeState = this.resumeStateByItemId.get(item.id);
|
const resumeState = this.resumeStateByItemId.get(item.id);
|
||||||
const matchingResumeState = resumeState && resumeState.soundUrl === soundUrl ? resumeState : null;
|
const matchingResumeState = resumeState && resumeState.soundUrl === soundUrl ? resumeState : null;
|
||||||
const onEnded = () => {
|
const onEnded = () => {
|
||||||
@@ -387,7 +388,17 @@ export class ItemEmitRuntime {
|
|||||||
}
|
}
|
||||||
const nextRates = resolveEmitRates(item);
|
const nextRates = resolveEmitRates(item);
|
||||||
output.initialDelaySeconds = resolveEmitInitialDelaySeconds(item);
|
output.initialDelaySeconds = resolveEmitInitialDelaySeconds(item);
|
||||||
output.loopDelaySeconds = resolveEmitLoopDelaySeconds(item);
|
const nextLoopDelaySeconds = resolveEmitLoopDelaySeconds(item);
|
||||||
|
output.loopDelaySeconds = nextLoopDelaySeconds;
|
||||||
|
const shouldLoop = nextLoopDelaySeconds <= 0;
|
||||||
|
if (output.element.loop !== shouldLoop) {
|
||||||
|
output.element.loop = shouldLoop;
|
||||||
|
if (shouldLoop) {
|
||||||
|
// Returning to native loop mode should clear delayed restart scheduling.
|
||||||
|
this.nextEmitStartAtMs.delete(itemId);
|
||||||
|
this.tryStartEmitPlayback(itemId, output.element);
|
||||||
|
}
|
||||||
|
}
|
||||||
setElementPreservesPitch(output.element, nextRates.preservePitch);
|
setElementPreservesPitch(output.element, nextRates.preservePitch);
|
||||||
const nextPlaybackRate = nextRates.playbackRate;
|
const nextPlaybackRate = nextRates.playbackRate;
|
||||||
if (Math.abs(output.element.playbackRate - nextPlaybackRate) > 0.001) {
|
if (Math.abs(output.element.playbackRate - nextPlaybackRate) > 0.001) {
|
||||||
|
|||||||
Reference in New Issue
Block a user