Rename option to always_connected.
This commit is contained in:
@@ -557,7 +557,8 @@ live:
|
|||||||
|
|
||||||
| Option | Default | Overridable | Description |
|
| Option | Default | Overridable | Description |
|
||||||
| - | - | - | - |
|
| - | - | - | - |
|
||||||
| `disconnect_seconds` | `60` | :white_check_mark: | The number of seconds after which to disconnect the microphone from the stream. `0` implies never. |
|
| `always_connected` | `false` | :white_check_mark: | Whether or not to keep the microphone stream continually connected while the card is running, or only when microphone is used (default). In the latter case there'll be a connection reset when the microphone is first used -- using this option can avoid that reset.|
|
||||||
|
| `disconnect_seconds` | `60` | :white_check_mark: | The number of seconds after microphone usage to disconnect the microphone from the stream. `0` implies never. Not relevant if `always_connected` is `true`.|
|
||||||
|
|
||||||
See [Using 2-way audio](#using-2-way-audio) for more information about the very particular requirements that must be followed for 2-way audio to work.
|
See [Using 2-way audio](#using-2-way-audio) for more information about the very particular requirements that must be followed for 2-way audio to work.
|
||||||
|
|
||||||
@@ -1098,7 +1099,7 @@ menu:
|
|||||||
Usage:
|
Usage:
|
||||||
* The camera will always load without the microphone connected.
|
* The camera will always load without the microphone connected.
|
||||||
* To speak, hold-down the microphone menu button.
|
* To speak, hold-down the microphone menu button.
|
||||||
* On first press, this will reset the `webrtc` connection to include 2-way audio.
|
* On first press, this will reset the `webrtc` connection to include 2-way audio (unless the `always_connected` microphone option is set to `true`).
|
||||||
* Thereafter hold the microphone button down to unmute/speak, let go to mute.
|
* Thereafter hold the microphone button down to unmute/speak, let go to mute.
|
||||||
* The video will automatically reset to remove the microphone after the number of seconds specified by `disconnect_seconds` in the `microphone` configuration have elapsed since the last mute/unmute press.
|
* The video will automatically reset to remove the microphone after the number of seconds specified by `disconnect_seconds` in the `microphone` configuration have elapsed since the last mute/unmute press.
|
||||||
|
|
||||||
@@ -1877,6 +1878,7 @@ live:
|
|||||||
x: 50
|
x: 50
|
||||||
y: 50
|
y: 50
|
||||||
microphone:
|
microphone:
|
||||||
|
always_connected: false
|
||||||
disconnect_seconds: 60
|
disconnect_seconds: 60
|
||||||
actions:
|
actions:
|
||||||
entity: light.office_main_lights
|
entity: light.office_main_lights
|
||||||
|
|||||||
+6
-3
@@ -1024,8 +1024,11 @@ class FrigateCard extends LitElement {
|
|||||||
oldConfig?.live.microphone.disconnect_seconds !==
|
oldConfig?.live.microphone.disconnect_seconds !==
|
||||||
newConfig.live.microphone.disconnect_seconds
|
newConfig.live.microphone.disconnect_seconds
|
||||||
) {
|
) {
|
||||||
|
const config = this._getConfig();
|
||||||
this._microphoneController = new MicrophoneController(
|
this._microphoneController = new MicrophoneController(
|
||||||
this._getConfig().live.microphone.disconnect_seconds,
|
config.live.microphone.always_connected
|
||||||
|
? undefined
|
||||||
|
: config.live.microphone.disconnect_seconds,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,7 +1317,7 @@ class FrigateCard extends LitElement {
|
|||||||
...(config.menu.buttons.media_player.enabled
|
...(config.menu.buttons.media_player.enabled
|
||||||
? [InitializationAspect.MEDIA_PLAYERS]
|
? [InitializationAspect.MEDIA_PLAYERS]
|
||||||
: []),
|
: []),
|
||||||
...(config.live.microphone.connect_on_load
|
...(config.live.microphone.always_connected
|
||||||
? [InitializationAspect.MICROPHONE]
|
? [InitializationAspect.MICROPHONE]
|
||||||
: []),
|
: []),
|
||||||
])
|
])
|
||||||
@@ -1328,7 +1331,7 @@ class FrigateCard extends LitElement {
|
|||||||
[InitializationAspect.MEDIA_PLAYERS]: async () =>
|
[InitializationAspect.MEDIA_PLAYERS]: async () =>
|
||||||
await this._initializeMediaPlayers(hass),
|
await this._initializeMediaPlayers(hass),
|
||||||
}),
|
}),
|
||||||
...(config.live.microphone.connect_on_load && {
|
...(config.live.microphone.always_connected && {
|
||||||
[InitializationAspect.MICROPHONE]: async () =>
|
[InitializationAspect.MICROPHONE]: async () =>
|
||||||
await this._initializeMicrophone(),
|
await this._initializeMicrophone(),
|
||||||
}),
|
}),
|
||||||
|
|||||||
+2
-2
@@ -194,8 +194,8 @@ export const CONF_LIVE_SHOW_IMAGE_DURING_LOAD =
|
|||||||
`${CONF_LIVE}.show_image_during_load` as const;
|
`${CONF_LIVE}.show_image_during_load` as const;
|
||||||
export const CONF_LIVE_MICROPHONE_DISCONNECT_SECONDS =
|
export const CONF_LIVE_MICROPHONE_DISCONNECT_SECONDS =
|
||||||
`${CONF_LIVE}.microphone.disconnect_seconds` as const;
|
`${CONF_LIVE}.microphone.disconnect_seconds` as const;
|
||||||
export const CONF_LIVE_MICROPHONE_CONNECT_ON_LOAD =
|
export const CONF_LIVE_MICROPHONE_ALWAYS_CONNECTED =
|
||||||
`${CONF_LIVE}.microphone.connect_on_load` as const;
|
`${CONF_LIVE}.microphone.always_connected` as const;
|
||||||
export const CONF_LIVE_ZOOMABLE = `${CONF_LIVE}.zoomable` as const;
|
export const CONF_LIVE_ZOOMABLE = `${CONF_LIVE}.zoomable` as const;
|
||||||
|
|
||||||
const CONF_IMAGE = 'image' as const;
|
const CONF_IMAGE = 'image' as const;
|
||||||
|
|||||||
+3
-3
@@ -156,7 +156,7 @@ import {
|
|||||||
CONF_VIEW_UPDATE_FORCE,
|
CONF_VIEW_UPDATE_FORCE,
|
||||||
CONF_VIEW_UPDATE_SECONDS,
|
CONF_VIEW_UPDATE_SECONDS,
|
||||||
MEDIA_CHUNK_SIZE_MAX,
|
MEDIA_CHUNK_SIZE_MAX,
|
||||||
CONF_LIVE_MICROPHONE_CONNECT_ON_LOAD,
|
CONF_LIVE_MICROPHONE_ALWAYS_CONNECTED,
|
||||||
} from './const.js';
|
} from './const.js';
|
||||||
import { localize } from './localize/localize.js';
|
import { localize } from './localize/localize.js';
|
||||||
import { setLowPerformanceProfile } from './performance.js';
|
import { setLowPerformanceProfile } from './performance.js';
|
||||||
@@ -1880,8 +1880,8 @@ export class FrigateCardEditor extends LitElement implements LovelaceCardEditor
|
|||||||
html`
|
html`
|
||||||
${this._renderNumberInput(CONF_LIVE_MICROPHONE_DISCONNECT_SECONDS)}
|
${this._renderNumberInput(CONF_LIVE_MICROPHONE_DISCONNECT_SECONDS)}
|
||||||
${this._renderSwitch(
|
${this._renderSwitch(
|
||||||
CONF_LIVE_MICROPHONE_CONNECT_ON_LOAD,
|
CONF_LIVE_MICROPHONE_ALWAYS_CONNECTED,
|
||||||
this._defaults.live.microphone.connect_on_load,
|
this._defaults.live.microphone.always_connected,
|
||||||
)}
|
)}
|
||||||
`,
|
`,
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
"lazy_load": "Live cameras are lazily loaded",
|
"lazy_load": "Live cameras are lazily loaded",
|
||||||
"lazy_unload": "Live cameras are lazily unloaded",
|
"lazy_unload": "Live cameras are lazily unloaded",
|
||||||
"microphone": {
|
"microphone": {
|
||||||
"connect_on_load": "Connect microphone on card load",
|
"always_connected": "Always keep the microphone connected",
|
||||||
"disconnect_seconds": "Seconds after which to disconnect microphone (0=never)",
|
"disconnect_seconds": "Seconds after which to disconnect microphone (0=never)",
|
||||||
"editor_label": "Microphone",
|
"editor_label": "Microphone",
|
||||||
"enabled": "Microphone enabled"
|
"enabled": "Microphone enabled"
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
"lazy_load": "Le telecamere dal vivo sono pigramente cariche",
|
"lazy_load": "Le telecamere dal vivo sono pigramente cariche",
|
||||||
"lazy_unload": "Le telecamere dal vivo sono pigramente non caricate",
|
"lazy_unload": "Le telecamere dal vivo sono pigramente non caricate",
|
||||||
"microphone": {
|
"microphone": {
|
||||||
"connect_on_load": "",
|
"always_connected": "",
|
||||||
"disconnect_seconds": "",
|
"disconnect_seconds": "",
|
||||||
"editor_label": "",
|
"editor_label": "",
|
||||||
"enabled": ""
|
"enabled": ""
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
"lazy_load": "As câmeras ao vivo são carregadas lentamente",
|
"lazy_load": "As câmeras ao vivo são carregadas lentamente",
|
||||||
"lazy_unload": "As câmeras ao vivo são descarregadas preguiçosamente",
|
"lazy_unload": "As câmeras ao vivo são descarregadas preguiçosamente",
|
||||||
"microphone": {
|
"microphone": {
|
||||||
"connect_on_load": "",
|
"always_connected": "",
|
||||||
"disconnect_seconds": "",
|
"disconnect_seconds": "",
|
||||||
"editor_label": "",
|
"editor_label": "",
|
||||||
"enabled": ""
|
"enabled": ""
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
"lazy_load": "As câmeras ao vivo são carregadas lentamente",
|
"lazy_load": "As câmeras ao vivo são carregadas lentamente",
|
||||||
"lazy_unload": "As câmeras ao vivo são descarregadas preguiçosamente",
|
"lazy_unload": "As câmeras ao vivo são descarregadas preguiçosamente",
|
||||||
"microphone": {
|
"microphone": {
|
||||||
"connect_on_load": "",
|
"always_connected": "",
|
||||||
"disconnect_seconds": "",
|
"disconnect_seconds": "",
|
||||||
"editor_label": "",
|
"editor_label": "",
|
||||||
"enabled": ""
|
"enabled": ""
|
||||||
|
|||||||
+2
-2
@@ -414,17 +414,17 @@ const imageBaseConfigSchema = z.object({
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const microphoneConfigDefault = {
|
const microphoneConfigDefault = {
|
||||||
|
always_connected: false,
|
||||||
disconnect_seconds: 60,
|
disconnect_seconds: 60,
|
||||||
connect_on_load: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const microphoneConfigSchema = z
|
const microphoneConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
|
always_connected: z.boolean().default(microphoneConfigDefault.always_connected),
|
||||||
disconnect_seconds: z
|
disconnect_seconds: z
|
||||||
.number()
|
.number()
|
||||||
.min(0)
|
.min(0)
|
||||||
.default(microphoneConfigDefault.disconnect_seconds),
|
.default(microphoneConfigDefault.disconnect_seconds),
|
||||||
connect_on_load: z.boolean().default(microphoneConfigDefault.connect_on_load),
|
|
||||||
})
|
})
|
||||||
.default(microphoneConfigDefault);
|
.default(microphoneConfigDefault);
|
||||||
export type MicrophoneConfig = z.infer<typeof microphoneConfigSchema>;
|
export type MicrophoneConfig = z.infer<typeof microphoneConfigSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user