fix: Use auto_unmute as input to stream selection for HA (#2562)

- Closes #2479
This commit is contained in:
Dermot Duffy
2026-07-03 08:19:11 -07:00
committed by GitHub
parent 6a6d65d5c5
commit 3494706225
7 changed files with 428 additions and 61 deletions
+15
View File
@@ -0,0 +1,15 @@
import {
MEDIA_ACTION_POSITIVE_CONDITIONS,
type AutoUnmuteCondition,
} from '../../config/schema/common/media-actions.js';
/**
* Whether the configured auto-unmute policy will unmute a stream as it loads
* (i.e. on selection or visibility), rather than only later in response to a
* user action or call event. Used to decide whether to pre-select a camera's
* audio-carrying stream up front instead of switching to it after the fact.
*/
export const isAudioIntendedOnLoad = (
autoUnmute: readonly AutoUnmuteCondition[],
): boolean =>
MEDIA_ACTION_POSITIVE_CONDITIONS.some((condition) => autoUnmute.includes(condition));