fix(qconnect): restore local repeat renderer flow
cx
This commit is contained in:
4 files changed
+125
-19
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
isQconnectPeerRendererActive,
|
||||
isQconnectRemoteModeActive,
|
||||
resolveQconnectPlayNextAuthoritativeTrackId,
|
||||
shouldQconnectSuppressLocalPlaybackAutomation,
|
||||
type QconnectConnectionStatus
|
||||
} from './qconnectRuntime';
|
||||
import type { QconnectQueueSnapshot, QconnectRendererSnapshot } from './qconnectRemoteQueue';
|
||||
@@ -182,6 +183,28 @@ describe('QConnect runtime state helpers', () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('suppresses local playback automation only when a peer renderer is active', () => {
|
||||
expect(
|
||||
shouldQconnectSuppressLocalPlaybackAutomation(true, {
|
||||
session_uuid: 'session-1',
|
||||
active_renderer_id: 4,
|
||||
local_renderer_id: 11,
|
||||
renderers: []
|
||||
})
|
||||
).toBe(true);
|
||||
|
||||
expect(
|
||||
shouldQconnectSuppressLocalPlaybackAutomation(true, {
|
||||
session_uuid: 'session-1',
|
||||
active_renderer_id: 11,
|
||||
local_renderer_id: 11,
|
||||
renderers: []
|
||||
})
|
||||
).toBe(false);
|
||||
|
||||
expect(shouldQconnectSuppressLocalPlaybackAutomation(false, null)).toBe(false);
|
||||
});
|
||||
|
||||
it('does not trust the local current track for play next when a peer renderer is active', () => {
|
||||
expect(
|
||||
resolveQconnectPlayNextAuthoritativeTrackId({
|
||||
|
||||
@@ -194,6 +194,13 @@ export function isQconnectPeerRendererActive(
|
||||
return activeRendererId !== localRendererId;
|
||||
}
|
||||
|
||||
export function shouldQconnectSuppressLocalPlaybackAutomation(
|
||||
connected: boolean,
|
||||
sessionSnapshot: QconnectSessionSnapshot | null | undefined
|
||||
): boolean {
|
||||
return connected && isQconnectPeerRendererActive(sessionSnapshot);
|
||||
}
|
||||
|
||||
export function resolveQconnectPlayNextAuthoritativeTrackId(params: {
|
||||
sessionSnapshot: QconnectSessionSnapshot | null | undefined;
|
||||
localCurrentTrackId: number | null | undefined;
|
||||
|
||||
Reference in new issue
Block a user