deno icon indicating copy to clipboard operation
deno copied to clipboard

WebRTC Integrating

Open xueqingxiao opened this issue 6 years ago • 27 comments
trafficstars

Reference: WebRTC Native API samples client & server both side

xueqingxiao avatar Jan 29 '19 08:01 xueqingxiao

Shouldn't this be in user land?

balupton avatar Apr 07 '19 01:04 balupton

@balupton Is WebRTC not part of the standard browser interface? How would one implement this in userland?

davidcallanan avatar May 18 '20 13:05 davidcallanan

I would check out https://github.com/shinyoshiaki/werift-webrtc. Long term you are going to have a pretty high burden using Google's WebRTC implementation via FFI. Also the security issues that have come with it.

I am happy to help also! If anyone wants to grok WebRTC more I wrote WebRTC for the Curious and work on Pion. Pion isn't relevant at all for deno, but happy to throw in stuff that I learned along the way writing it.

Sean-Der avatar Sep 19 '20 19:09 Sean-Der

Shouldn't this be in user land?

...

@balupton Is WebRTC not part of the standard browser interface? How would one implement this in userland?

std/ws is a thing so it probably could be user-land, however if it is it should be a std user land since this can be considered a standard interface.

jcc10 avatar Dec 02 '20 23:12 jcc10

std/ws is a thing

std/ws is a server, not a client. for client we have the web WS API. WebRTC shouldnt be a module, but a built-in.

crowlKats avatar Dec 02 '20 23:12 crowlKats

std/ws is a server, not a client.

Well originally it had both, but I do get and agree with your point.

I actually just dug through the source-code to check and I was under the incorrect assumption that the websocket client was some sort of ts shim that was just auto-included. So that's good to know.

jcc10 avatar Dec 04 '20 10:12 jcc10

Why was the feat label replaced with cli and suggestion labels?

regnaio avatar Dec 22 '20 18:12 regnaio

Because we have not made a decision on if this will be implemented or not. feat label is only used for issues that we have decided should be implemented.

lucacasonato avatar Dec 22 '20 19:12 lucacasonato

Maybe this will be of value one day: https://github.com/webrtc-rs/webrtc

richardanaya avatar Jan 23 '21 19:01 richardanaya

webrtc is now a W3C standard recommendation , please consider integrate at least datachannel via usrsctp which is used by Chrome and almost all the others

lin7sh avatar Jan 29 '21 04:01 lin7sh

Can we integrate this?

Danue1 avatar Jul 05 '21 09:07 Danue1

@mko-io usrsctp is being replaced with dcnet in Chrome. Might be worth exploring if integrating that is easier!

Sean-Der avatar Jul 20 '21 17:07 Sean-Der

I'm waiting for it.

rojvv avatar Oct 10 '21 07:10 rojvv

I'm excited for it!

richardanaya avatar Oct 10 '21 16:10 richardanaya

Hey guys, I assume this is not a priority at all for Deno core ? It would be really nice to have this.

PodaruDragos avatar Mar 11 '22 09:03 PodaruDragos

Yes, this isnt a priority. I am keeping an eye on this, and we probably would use the WebRTC crate, but this wont happen anytime soon as there are other priorities

crowlKats avatar Mar 11 '22 11:03 crowlKats

Yes, this isnt a priority. I am keeping an eye on this, and we probably would use the WebRTC crate, but this wont happen anytime soon as there are other priorities

Cool, thanks for answering. I was just asking since webGPU was added, I thought this might be an api that is more "important" since it's already a standard.

PodaruDragos avatar Mar 11 '22 12:03 PodaruDragos

any plan add mediasoup to denoland ?

chanphiromsok avatar Aug 21 '22 12:08 chanphiromsok

You're about to see WebRTC + AV1 replace RTMP + HLS, I think. The big companies are about to WHIP it into shape.

I've tested Cloudflare WebRTC Stream it's much lower latency than RTMP, feels like AV1 + WebRTC is coming.

Imagine being able to play a video from Deno serverside WebRTC (Rasberry Pi) to a Browser, would be spicy! Or open a port from an IP camera without RTSP/RTMP direct to a browser device with sub second latency and no HLS. Double Spicy!

drinkmorewaters avatar Jan 11 '23 11:01 drinkmorewaters

@crowlKats my apologies for tagging you like this, more than 1 year has passed since I asked about some updates. I know if there were updates on this someone would have informed us.

I am asking this again not to sound demanding or rude, but this is such an exciting feature and it would be so cool to have a native way of building SFU's in deno. Were they any internal discussions about the potential inclusion in deno ?

PodaruDragos avatar Apr 21 '23 15:04 PodaruDragos

No, there have been no discussions about this, as it is not a priority. Also, the involvement of this project is unknown, but likely quite complex.

crowlKats avatar Apr 24 '23 14:04 crowlKats

Some of the fun of WebRTC is better left out of Deno at the moment...

  • https://github.com/w3c/webappsec-csp/issues/92
  • https://www.security.org/vpn/webrtc-leak/

There's a webrtc: 'block' CSP in a spec but it hasn't made its way to browsers yet. Deno, not using CSPs, should probably have a similar off switch when this gets implemented. https://wpt.fyi/results/content-security-policy/webrtc?label=experimental&label=master&aligned

benatkin avatar Aug 30 '24 21:08 benatkin

Maybe it should always be in userland. That's what I'm thinking. It's a privacy nightmare not just for the reason I mentioned. I gave the lone thumbs up to the comment suggesting this.

Edit: OTOH if Deno started implementing it right now and added new permission(s) for it, maybe that would shine a light on how the browser needs to have ways to control the permissions using Content Security Policies and/or permission policies (currently there is a permission for the media parts of videoconferencing but not the network connectivity of WebRTC). But it would be an unusual thing to use to determine the roadmap...

benatkin avatar Sep 14 '24 22:09 benatkin

VPN should be extremely bad for webRTC leak. Such VPNs probably already don't exist because the creators know that people will not pay and use if it has leak and because this leak issue is old and well-known. No one VPN I tested had webRTC leak. Anyway, servers don't use VPN.

oleedd avatar Sep 15 '24 08:09 oleedd

WebRTC and related APIs (MediaStreamTrackGenerator(), MediaRecorder()) can be the second reason after Typescript why people might prefer Deno over Node.js. It is weird that it is not a priority. What's the snag in copying these APIs from Chromium?

oleedd avatar Sep 16 '24 18:09 oleedd

Any updates on this , I am more than interested in this topic for one of my projects

SerJaimeLannister avatar Oct 12 '24 04:10 SerJaimeLannister

I believe WebRTC support is especially important following the recent unveiling of OpenAI's Realtime API, which underlays advanced voice mode in ChatGPT. Lots of us will want to integrate with this new service. Currently, the only path forward seems to be utilizing some kind of intermediate relay such as LiveKit. Alternatively, one could use web sockets, but this isn't as reliable for the use case of audio streaming. I understand that there's likely a long list of other important items following the release of Deno 2 (congratulations btw), but I figured I'd suggest revisiting this one.

harrysolovay avatar Oct 21 '24 05:10 harrysolovay

I've made a WebRTC library for Node/Bun a while back: https://www.npmjs.com/package/webrtc-polyfill, it seems to work on Deno just fine as well, however I've only ever used it for RTCDataChannel.send, so the MediaStream implementation was never tested, I welcome any contributions.

It is roughly x3.4 quicker than wrtc and ~x1.2 quicker than google's webrtc impl. It is however single-threaded [for the most part]

It uses libdatachannel which is known to take some liberties with how it implements WebRTC, but from my testing it was compatible with any WebRTC consuming library I've tried

ThaUnknown avatar Jan 19 '25 16:01 ThaUnknown