From 8d915c5ccba70f9305877864d880213570851b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 30 Apr 2025 19:23:03 -0700 Subject: [PATCH] DailyParams: allow enabling/disabling camera/microphone tracks --- CHANGELOG.md | 6 ++++++ examples/daily-multi-translation/bot.py | 1 + src/pipecat/transports/services/daily.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 024ab5c7f..71b9ae255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 each generated `TTSAudioRawFrame`. This allows sending multiple bots' audio to multiple destinations in the same pipeline. +- Added `DailyTransportParams.camera_enabled` and + `DailyTransportParams.microphone_enabled` which allows you to enable/disable + the main camera or microphone tracks. This is useful if you only want to use + custom tracks and not send the main tracks. Note that you still need + `audio_out_enabled=True` or `video_out_enabled`. + - Added `RTVIObserverParams` which allows you to configure what RTVI messages are sent to the clients. diff --git a/examples/daily-multi-translation/bot.py b/examples/daily-multi-translation/bot.py index 0c90118f2..4c184062c 100644 --- a/examples/daily-multi-translation/bot.py +++ b/examples/daily-multi-translation/bot.py @@ -57,6 +57,7 @@ async def main(): ), }, audio_out_destinations=["spanish", "french", "german"], + microphone_enabled=False, # Disable since we just use custom tracks vad_analyzer=SileroVADAnalyzer(), ), ) diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index 6bab83691..21bc41e20 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -154,6 +154,8 @@ class DailyParams(TransportParams): api_url: Daily API base URL api_key: Daily API authentication key dialin_settings: Optional settings for dial-in functionality + camera_enabled: Whether to enable the main camera track + microphone_enabled: Whether to enable the main microphone track transcription_enabled: Whether to enable speech transcription transcription_settings: Configuration for transcription service """ @@ -161,6 +163,8 @@ class DailyParams(TransportParams): api_url: str = "https://api.daily.co/v1" api_key: str = "" dialin_settings: Optional[DailyDialinSettings] = None + camera_enabled: bool = True + microphone_enabled: bool = True transcription_enabled: bool = False transcription_settings: DailyTranscriptionSettings = DailyTranscriptionSettings() @@ -502,6 +506,9 @@ class DailyTransportClient(EventHandler): async def _join(self): future = self._get_event_loop().create_future() + camera_enabled = self._params.video_out_enabled and self._params.camera_enabled + microphone_enabled = self._params.audio_out_enabled and self._params.microphone_enabled + self._client.join( self._room_url, self._token, @@ -509,13 +516,13 @@ class DailyTransportClient(EventHandler): client_settings={ "inputs": { "camera": { - "isEnabled": self._params.video_out_enabled, + "isEnabled": camera_enabled, "settings": { "deviceId": self._camera_name(), }, }, "microphone": { - "isEnabled": self._params.audio_out_enabled, + "isEnabled": microphone_enabled, "settings": { "deviceId": self._mic_name(), "customConstraints": {