whitphx/streamlit-webrtc

Introduce an imperative API accessible from inside callbacks to control the player's state

whitphx opened this issue · 1 comments

Rel: #478

There are few use cases where devs want to control the player's state from the callback like https://discuss.streamlit.io/t/class-based-web-rtc-streamlit-app/41363/3

For example:

def video_frame_callback(frame, ctx):
    ...
    if some_condition:
        ctx.stop()
    ...

Until now, we only expected use cases where the player state are controlled from the global scope in a declarative way, and didn't provide API accessible from inside the callback, which would be an imperative manner.
There is an impedance mismatch between the global scope (declarative) and inside the callback (imperative).

Hi, I am trying to figure out the best way in which two people on the same video conference call(like in the example you have https://github.com/whitphx/streamlit-video-chat-example) and have their audio transcripts published in live using the deep speech (https://github.com/whitphx/streamlit-stt-app) example you have. I have tried a lot but I cannot get the streamlit-server-state module to work in this way. Can you suggest a way to do this?