Error While using streamlit-webrtc

My work:

Hi I have build an app which predict yoga pose but there is problem regarding webcam
while running on local server with OpenCV I am able to track my pose but after implementing

streamlit-webrtc
Issue has been generated it cannot open Camera feed

Detail Error:

Connection(0) Check CandidatePair((‘192.168.0.102’, 51048) → (‘103.132.3.54’, 61749)) State.IN_PROGRESS → State.FAILED
2021-06-09 12:33:44.326 Connection(0) ICE failed
2021-06-09 12:33:44.360 ICE connection state is failed
2021-06-09 12:33:44.362 ICE connection state is closed

I am just Enjoying the process to bulid this app and appreciate the Work of streamlit team and also
@whitphx for creating streamlit-webrtc

Waiting for answer
Thankyou

1 Like

I have the same issue with ICE on streamlit sharing :confused:

@iamchoudhari11 I have deployed my app in streamlit sharing and got the same error. Did you find any solution for it? And soft-nougat, Did you get to know why is this happening. Any tips would help me. Thanks. @whitphx I appreciate the streamlit_webrtc you have created then I’m getting some errors when deployed in cloud platforms and even when deployed in streamlit sharing and the error in streamlit sharing is similar to the above-stated i.,e, ICE connection failed and closed. If anyone knows how to overcome these errors please let me know. Thanks.

I am facing the same issue. The webcam isn’t being viewed, when hosted on streamlit. sharing.

I have attached the link to my application: https://share.streamlit.io/rahularepaka/objectdetectionweb/main/main.py

Here is the log :

021-08-07 08:04:07.633 Connection(0) ICE failed
2021-08-07 08:04:07.642 ICE connection state is failed
2021-08-07 08:04:07.642 ICE connection state is closed

Thanks!

I am encountering a similar issue when deploying the app on streamlit cloud: Upon pressing “start”, the webcam connects, the loader spins for a few seconds and then the webcam disconnects. It works perfectly on my local machine though.

Here is the app.py: smarteye_app/app.py at main · Inc0mple/smarteye_app · GitHub

And the logs when attempting to connect to the webcam on streamlit cloud:

2022-01-20 01:40:01.973 Track video received
2022-01-20 01:40:01.973 Set <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7fd1594fca00> as an input video track with video_processor <class 'streamlit_webrtc.process.AsyncVideoProcessTrack'>
2022-01-20 01:40:01.973 Add a track <streamlit_webrtc.process.AsyncVideoProcessTrack object at 0x7fd1594d9400> of kind video to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7fd15b76afa0>
2022-01-20 01:40:01.995 Connection(4) Check CandidatePair(('10.13.0.42', 52746) -> ('172.30.64.1', 54310)) State.FROZEN -> State.WAITING
2022-01-20 01:40:01.995 Connection(4) Check CandidatePair(('10.13.0.42', 52746) -> ('192.168.50.164', 54311)) State.FROZEN -> State.WAITING
2022-01-20 01:40:01.995 ICE connection state is checking
2022-01-20 01:40:01.995 Connection(4) Check CandidatePair(('10.13.0.42', 52746) -> ('172.30.64.1', 54310)) State.WAITING -> State.IN_PROGRESS
2022-01-20 01:40:02.504 Connection(4) Check CandidatePair(('10.13.0.42', 52746) -> ('192.168.50.164', 54311)) State.WAITING -> State.IN_PROGRESS
2022-01-20 01:40:20.490 ICE connection state is closed
2022-01-20 01:40:33.604 Exception in callback Transaction.__retry()
handle: <TimerHandle when=3161090.544572577 Transaction.__retry()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 1048, in sendto
    self._sock.sendto(data, addr)
AttributeError: 'NoneType' object has no attribute 'sendto'

Any help would be appreciated!

im also getting same error. what to do. any help!

is this issue still up? Sir @whitphx

FYI: Same issue here:

is this issue still up?

Partially yes.

Hi I’m facing same issue regarding this

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1054, in sendto

    self._sock.sendto(data, addr)

AttributeError: 'NoneType' object has no attribute 'sendto'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry

    self.__protocol.send_stun(self.__request, self.__addr)

  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 243, in send_stun

    self.transport.sendto(bytes(message), addr)

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1064, in sendto

    self._fatal_error(

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 711, in _fatal_error

    self._loop.call_exception_handler({

AttributeError: 'NoneType' object has no attribute 'call_exception_handler'

2023-01-24 10:36:12.459 ICE connection state is closed

2023-01-24 10:36:27.810 Exception in callback Transaction.__retry()

handle: <TimerHandle when=4269501.291509833 Transaction.__retry()>

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1054, in sendto

    self._sock.sendto(data, addr)

AttributeError: 'NoneType' object has no attribute 'sendto'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run

    self._context.run(self._callback, *self._args)

  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry

    self.__protocol.send_stun(self.__request, self.__addr)

  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 243, in send_stun

    self.transport.sendto(bytes(message), addr)

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1064, in sendto

    self._fatal_error(

  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 711, in _fatal_error

    self._loop.call_exception_handler({

AttributeError: 'NoneType' object has no attribute 'call_exception_handler'

[10:38:06] ❗️ Streamlit server consistently failed status checks

[10:38:06] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

Let me know whats the issue with the code
Here is github repo link :GitHub - Reha2704/emotion_detector
deployed link: https://reha2704-emotion-detector-app-iatgiz.streamlit.app/

As I could not test your repo on my laptop (M1 mac) and try it on Streamlit Cloud either because it showed error,
I can’t provide a direct solution though,
did you check the last 2 points in my previous post?

It might be because of some network issue, and solved simply by changing the network like Streamlit webcam stops working (webRTC) · Issue #852 · whitphx/streamlit-webrtc · GitHub, or more fundamentally, by setting up a TURN server.

Hi, has this issue been resolved? I’m also experiencing the same issue when accessing the webcam in the deployed app. Thanks.

has this issue been resolved? I’m also experiencing the same issue when accessing the webcam in the deployed app.