whitphx/streamlit-webrtc

Can st.session be used in a video_frame_callback?

shingyipcheung opened this issue · 1 comments

Hello.

I have a audio_frame_callback that contains a detection function and would like to pass the result and render in video_frame_callback.

I tried to use st.session as a global variable but having errors:

2023-02-25 13:54:16.608 Thread 'async_media_processor_1': missing ScriptRunContext
2023-02-25 13:54:16.817 Thread 'async_media_processor_1': missing ScriptRunContext
2023-02-25 13:54:16.966 Thread 'async_media_processor_1': missing ScriptRunContext
2023-02-25 13:54:17.135 Thread 'async_media_processor_1': missing ScriptRunContext

Thank you!

It is not possible: https://github.com/whitphx/streamlit-webrtc#callback-limitations

You should rather use a normal Python object than Streamlit's session state object for that purpose.