Skip to content

Commit d66d365

Browse files
committed
make add_track async for consistency
1 parent e5ee964 commit d66d365

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/local_audio/full_duplex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def on_track_subscribed(
4242
participant: rtc.RemoteParticipant,
4343
):
4444
if track.kind == rtc.TrackKind.KIND_AUDIO:
45-
player.add_track(track)
45+
asyncio.create_task(player.add_track(track))
4646
logging.info("subscribed to audio from %s", participant.identity)
4747

4848
room.on("track_subscribed", on_track_subscribed)

livekit-rtc/livekit/rtc/media_devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _callback(outdata: np.ndarray, frame_count: int, time_info: Any, status: Any
235235
blocksize=blocksize,
236236
)
237237

238-
def add_track(self, track: Track) -> None:
238+
async def add_track(self, track: Track) -> None:
239239
"""Add an audio track to the internal mixer for playback.
240240
241241
This creates an `AudioStream` from the track and adds it to the internal

0 commit comments

Comments
 (0)