WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Equivalent of `webrtc/candidate` with HTTP API

Open dzek69 opened this issue 7 months ago • 3 comments

I'm writing my own frontend around go2rtc, I do not expose anything besides 8555 port directly to the internet, I wrap the API calls with my server, which authenticates the users, etc. I only want to use WebRTC.

The only problem I'm having is that I do not want to use websockets. With HTTP I can access POST /api/webrtc?src={src} to exchange offer/answer sdp, but I need to do the same for ICE candidates, like you do here: https://github.com/AlexxIT/go2rtc/blob/master/www/video-rtc.js#L496

The problem is I don't see a http endpoint to do so.

Am I blind again? Is there a workaround? Or can you provide such an endpoint?

Thanks!

dzek69 avatar May 19 '25 19:05 dzek69

  1. This is wrong repo for your question.
  2. There is an example of a synchronous API https://github.com/AlexxIT/go2rtc/blob/master/www/webrtc-sync.html

AlexxIT avatar May 20 '25 07:05 AlexxIT

Sorry for posting in the wrong place, I was searching for a solution and I mixed the tabs I think.

Anyway - waiting for ICE gathering works, thanks, but it's less "realtime", do you think having HTTP API for that would be possible?

dzek69 avatar May 27 '25 10:05 dzek69

In theory, the WHEP/WHIP standards meant that candidates were exchanged via a PATCH request. I was just too lazy to implement it.

https://github.com/AlexxIT/go2rtc/blob/ae8145f26696ffc19a13fea4a21b4a5306fc0e3a/internal/webrtc/server.go#L37-L39

Now it's time to look into what has changed in the world of WebRTC standards since then. As far as I know, they have been changed. Haven't looked into this issue though.

AlexxIT avatar May 28 '25 14:05 AlexxIT