mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
Fix async echo example (#118)
* Fix async example * Version bump --------- Co-authored-by: Freddy Boulton <freddyboulton@hf-freddy.local>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user