Hi everyone.
Hi everyone.
I'm interested in using CloudFlare WebRTC for an existing application. The server is written in python using aiortc, so I tried to port the example index.html to python (the example works).
However I can't get my example to work.
sessions/new returns 500 "Backend error". The sdp should be valid, as SRS and Janus both are able to deal with it.
Scripts and logs are attached. In cloudflare.py replace app_id, app_secret and the url in MediaPlayer. Using python 3.11.9, aiortc==1.8.0
@Taylor9 Replies
Hi truebob,
Cool that you are trying Calls with aiortc!
The one difference between Janus and Calls is that Calls currently only support
bundle-only. Thus the different ICE credentials in the audio and video m-sections are causing a problem. We are checking if there is a workaround available.@drno I'm not seeing "bundle-only" in the offer created by chrome. Adding bundle-only to aiortc also still returns a 500 error, though I could have made a mistake.
Would you be able to provide guidance on what changes would have to be made? I can implement it in aiortc.
Attached are my aiortc and chrome local offers
Interesting finding. We think the problem is caused by the ICE credentials in the video m-section being different from the one in the audio m-section.
If you could try to validate that by removing the ICE crendetials from the video m-section that would be great.
I'll update our documentation to include the bundle constraint in the examples.
There is also another option/workaround we are still working on.
So here is another alternative: this example contains a different API call flow which gets an offer from Calls first (which should contain bundle-only with only one set of ICE credentials). https://github.com/cloudflare/calls-examples/blob/main/whip-whep-server/src/index.ts
I'm not sure how hard it is to extract from that example the logic for the regular example Calls app. But at least now you have two alternatives you can pursue.
Keep me posted if one of them works for you!
GitHub
calls-examples/whip-whep-server/src/index.ts at main · cloudflare/c...
Contribute to cloudflare/calls-examples development by creating an account on GitHub.
I can confirm removing ice credentials from the video section resolves the http error, though my crude change breaks aiortc. Patching aiortc to work properly is difficult due to structure of their code.
I had a look at the whip-whep example, but I can't figure out how it could work for us.
To clarify, our setup is as follows:
- the server sends audio/video to webrtc
- the client connects to webrtc afterwards, or might not connect at all in some cases.
The whephandler expects tracks to be available in LIVE_STORE. But I don't have any tracks, which look like they should be created by the whiphandler instead. As mentioned above, the client might or might not be connected, so we can't rely on the ordering here.
---
Assuming the above, I will investigate using another library. We could run that as a sidecar, and forwards from python to the sidecar, e.g. with udp
So it turns out the missing
bundle-only in Chrome is a really long standing open bug https://issues.webrtc.org/issues/42229651
Sorry @truebob I meant that the whip whep example contains a different API flow, where you don't attach anything to the initial request and then our server sends the SDP offer (which should contain the bundle-only attribute). I kind of already anticipated that the example is too convoluted. I only wanted to pass it out, because it is kind of documented. We will work on extracting that new API flow into a cleaner, simpler example.Is there any update on this? I really need an example of interaction between a Go client and the web, as I'm encountering the same 500 error.
Finally got around to update our documentation on this. If you got check out https://developers.cloudflare.com/calls/https-api/ you should see the old and the new flow. Unfortunately for the first client which starts to push a track the browser/client continues to be the offerer (I had understood our plans there differently). Our call examples also got updated accordingly https://github.com/cloudflare/calls-examples
Cloudflare Docs
Connection API | Cloudflare Calls docs
Cloudflare Calls simplifies the management of peer connections and media tracks through HTTPS API endpoints. These endpoints allow developers to efficiently manage sessions, add or remove tracks, and gather session information.
GitHub
GitHub - cloudflare/calls-examples
Contribute to cloudflare/calls-examples development by creating an account on GitHub.
@iris do you know if your 500 response is caused by the same bundle-only problem from aiortc? Or could it be another 500 error?
Sorry it took so long: we recently deployed a new Calls server version, which should no longer have problems with aiortc's SDP offers. @iris FYI