whitphx / streamlit-webrtc

Real-time video and audio streams over the network, with Streamlit.
https://discuss.streamlit.io/t/new-component-streamlit-webrtc-a-new-way-to-deal-with-real-time-media-streams/8669
MIT License
1.34k stars 181 forks source link

Camera doesn't start when offline state #1119

Closed RoloAfrole closed 1 year ago

RoloAfrole commented 1 year ago

I'm creating a camera app that runs locally. Also, I want to run it even when the PC is not connected to network, but if I press the start button when the PC is not connected to network, the camera does not start and nothing is output to the log.

camera_image

Of course, the camera is displayed correctly when connected to the Internet. Currently, when using streamlit-webrtc, we only do simple processing like the code below.

webrtc_streamer(
    key="image-filter",
    mode=WebRtcMode.SENDRECV,
    video_frame_callback=callback_func,
    media_stream_constraints={"video": True},
)

What do I need to do to make streamlit-webrtc work offline?

whitphx commented 1 year ago

Maybe duplicated with #485 and as it said, it depends on the browser's WebRTC implementation and sometimes it is impossible, while I can't provide the final clear answer.

RoloAfrole commented 1 year ago

When I verified various things, the camera did not work in the offline state on chrome. On firefox, it was confirmed that the camera works when it is offline after connecting to the network once