Fix async echo example (#118)

* Fix async example

* Version bump

---------

Co-authored-by: Freddy Boulton <freddyboulton@hf-freddy.local>
This commit is contained in:
Freddy Boulton
2025-03-03 14:06:24 -05:00
committed by GitHub
parent 146143efb7
commit d8396a2714
3 changed files with 20 additions and 14 deletions

View File

@@ -35,6 +35,7 @@ from numpy import typing as npt
from fastrtc.utils import (
AdditionalOutputs,
DataChannel,
WebRTCError,
create_message,
current_channel,
player_worker_decode,
@@ -459,6 +460,11 @@ class AudioCallback(AudioStreamTrack):
if isinstance(self.event_handler, AsyncHandler):
callable = self.event_handler.emit
start_up = self.event_handler.start_up()
if not inspect.isawaitable(start_up):
raise WebRTCError(
"In AsyncStreamHandler, start_up must be a coroutine (async def)"
)
else:
callable = functools.partial(
loop.run_in_executor, None, self.event_handler_emit