daily-co / daily-python

Daily Client SDK for Python
BSD 2-Clause "Simplified" License
35 stars 7 forks source link

Is self._speaker.read_frames(...) blocking? #18

Closed RevanthRameshkumar closed 1 week ago

RevanthRameshkumar commented 2 weeks ago

Hello, is the read_frames function blocking? When I inspect it, I noticed there is a callback option but the function itself also returns bytes so I am assuming it is blocking? If I want it to not block my threads/event loops should I call it inside an async function and then await that async function?

Thanks!

aconchillo commented 1 week ago

@RevanthRameshkumar Hi! Yes, read_frames() is blocking. If you want to use the non-blocking approach you should create the speaker device with non_blocking=True and then you can use futures. See this for an example: https://github.com/daily-co/daily-python/issues/3#issuecomment-2174442529

RevanthRameshkumar commented 1 week ago

Thanks! Looks like that is a new param? Seems like a good idea, looking forward to using it 👍