Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimenting streamlit-webrtc using Google Colab and Ngrok #335

Closed
trisgelar opened this issue Jul 19, 2021 · 4 comments
Closed

Experimenting streamlit-webrtc using Google Colab and Ngrok #335

trisgelar opened this issue Jul 19, 2021 · 4 comments

Comments

@trisgelar
Copy link

Hi, anyone have been experimenting streamlit-webrtc component with Google Colabs and Ngrok, i need this setup because google colab have free gpu to serve my model.

I have an ICE connection state is failed after running app.py example,

https://gist.github.com/trisgelar/86968b75a3ff84f1425c1ccee6ad0415

Thanks.

You can now view your Streamlit app in your browser.

Network URL: http://172.28.0.2:8501
External URL: http://34.125.122.87:8501

2021-07-19 15:16:47.944 Restore the component value (key=object-detection)
2021-07-19 15:17:45.056 No worker exists though the offer SDP is set. Create a new worker (key="object-detection").
2021-07-19 15:17:45.073 _webrtc_thread_impl starts
2021-07-19 15:17:46.110 Connection(0) Remote candidate "47ce6f98-7967-4bee-af8b-3fba9e547390.local" could not be resolved
2021-07-19 15:17:46.110 Track audio received
2021-07-19 15:17:46.110 Add a track <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7fd7b9e60b10> of kind audio to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7fd7d5325cd0>
2021-07-19 15:17:46.111 Track video received
2021-07-19 15:17:46.111 Set <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7fd7b8d32fd0> as an input video track with video_processor <class 'streamlit_webrtc.process.AsyncVideoProcessTrack'>
2021-07-19 15:17:46.111 Add a track <streamlit_webrtc.process.AsyncVideoProcessTrack object at 0x7fd7b8d37b90> of kind video to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7fd7d5325cd0>
2021-07-19 15:17:46.149 Connection(0) Check CandidatePair(('172.28.0.2', 49728) -> ('120.89.90.198', 33875)) State.FROZEN -> State.WAITING
2021-07-19 15:17:46.197 ICE connection state is checking
2021-07-19 15:17:46.344 Connection(0) Check CandidatePair(('172.28.0.2', 49728) -> ('120.89.90.198', 33875)) State.WAITING -> State.IN_PROGRESS
2021-07-19 15:18:13.134 Unset the worker because the frontend state is neither playing nor signalling (key="object-detection").
2021-07-19 15:18:17.852 No worker exists though the offer SDP is set. Create a new worker (key="object-detection").
2021-07-19 15:18:17.853 _webrtc_thread_impl starts
2021-07-19 15:18:17.888 Track audio received
2021-07-19 15:18:17.888 Add a track <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7fd7d531a510> of kind audio to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7fd7d8149a10>
2021-07-19 15:18:17.888 Track video received
2021-07-19 15:18:17.888 Set <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7fd7b8c0e410> as an input video track with video_processor <class 'streamlit_webrtc.process.AsyncVideoProcessTrack'>
2021-07-19 15:18:17.889 Add a track <streamlit_webrtc.process.AsyncVideoProcessTrack object at 0x7fd7b8c03090> of kind video to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7fd7d8149a10>
2021-07-19 15:18:17.972 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('192.168.0.106', 39647)) State.FROZEN -> State.WAITING
2021-07-19 15:18:17.973 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('120.89.90.198', 39647)) State.FROZEN -> State.WAITING
2021-07-19 15:18:18.112 ICE connection state is checking
2021-07-19 15:18:18.112 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('192.168.0.106', 39647)) State.WAITING -> State.IN_PROGRESS
2021-07-19 15:18:18.189 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('120.89.90.198', 39647)) State.WAITING -> State.IN_PROGRESS
2021-07-19 15:18:49.853 Connection(0) Check CandidatePair(('172.28.0.2', 49728) -> ('120.89.90.198', 33875)) State.IN_PROGRESS -> State.FAILED
2021-07-19 15:18:49.853 Connection(0) ICE failed
2021-07-19 15:18:49.860 ICE connection state is failed
2021-07-19 15:18:49.860 ICE connection state is closed
2021-07-19 15:19:21.619 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('192.168.0.106', 39647)) State.IN_PROGRESS -> State.FAILED
2021-07-19 15:19:21.705 Connection(2) Check CandidatePair(('172.28.0.2', 53740) -> ('120.89.90.198', 39647)) State.IN_PROGRESS -> State.FAILED
2021-07-19 15:19:21.706 Connection(2) ICE failed
2021-07-19 15:19:21.720 ICE connection state is failed
2021-07-19 15:19:21.721 ICE connection state is closed

@ajaichemmanam
Copy link

Can you check with streamlit 0.83 version. Seems like a general issue

@whitphx
Copy link
Owner

whitphx commented Aug 1, 2021

It worked in my environment.

Is it not a Google Colab specific problem, but a problem stated here?

@trisgelar
Copy link
Author

trisgelar commented Aug 12, 2021

I solve by creating TURN Server.

In case if anybody have same problem my solution are:

  1. Create TURN Server using this tutorial.
  2. Configure iceServers on RTCConfiguration
RTC_CONFIGURATION = RTCConfiguration(
    {
      "RTCIceServer": [{
        "urls": ["turn:turn.xxx.dev:5349"],
        "username": "user",
        "credential": "password",
      }]
    }
)

`

@vincedupuis
Copy link

hello @trisgelar
I installed a coturn server and make it sure it's working by looking at the logs
I tried to use the configuration you propose and I don't see any logs coming from coturn when I start and run the streamlit-webrtc app.
Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants