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

WebRTC and getUserMedia within Service Worker #670

Closed
lewispham opened this issue Apr 2, 2015 · 12 comments
Closed

WebRTC and getUserMedia within Service Worker #670

lewispham opened this issue Apr 2, 2015 · 12 comments
Milestone

Comments

@lewispham
Copy link

I wonder why WebRTC and getUserMedia can not be used inside Service Worker. Is this a matter of time? Or are there any unsolvable technical problems?

@feross
Copy link

feross commented May 25, 2015

👍

@wanderview
Copy link
Member

As far as I can tell, neither of these is spec'd on workers of any kind, let alone SW. Also, having access to these in the background without a window open would seem to be something of a security/privacy issue for the user.

@feross
Copy link

feross commented May 25, 2015

neither of these is spec'd on workers of any kind

Which is what this issue is about :)

having access to these in the background without a window open would seem to be something of a security/privacy issue

Using WebRTC data channels in a worker is no different from a security/privacy perspective than using Websockets. There's no user permission prompt to open a WebRTC data channel.

@feross
Copy link

feross commented May 25, 2015

I'm not sure what @Tresdin meant by using getUserMedia in a worker – maybe he can clarify? It seems less useful than WebRTC data channels.

Data channels are basically drop-in replacements for Websockets, except they're peer-to-peer. Being able to open a WebRTC data channel would support the use case of "peer assisted delivery" for apps like PeerCDN.

@auchenberg
Copy link

👍

We need it to make functionality like this possible: https://twitter.com/auchenberg/status/602648208158756864

@wanderview
Copy link
Member

I think you need to discuss this with the webrtc folks first. I'm not familiar enough with webrtc to know if there are reasons data channels are not exposed on workers. If they are willing to spec it then I think the ServiceWorkers would get it automatically by virtue of extending the Worker interface. (It might take some time to implement, of course.)

You can open a webrtc issue here:

https://github.com/w3c/webrtc-pc/issues

Or you could email their mailing list:

https://lists.w3.org/Archives/Public/public-webrtc/

@feross
Copy link

feross commented May 25, 2015

Issue opened: w3c/webrtc-pc#230

@lewispham
Copy link
Author

@feross I agreed with your point that getUserMedia is less useful. But it is still mandatory for establishing a video/audio call.

@ALL Unfortunately, though using WebRTC data channels or WebSocket within Web Workers is a great idea, I still recommend not to use these APIs inside ServiceWorker due to its temporarily activated lifetime.

@wanderview
Copy link
Member

@feross I agreed with your point that getUserMedia is less useful. But it is still mandatory for establishing a video/audio call.

How are you going to have a video call without a window to show the video in?

Is there a reason you can't use .openWindow() from the service worker and then do the video call in the window as you would normally?

@lewispham
Copy link
Author

How are you going to have a video call without a window to show the video in?

I did not say that video calls can be established without a window. I just meant that handling MediaStream within workers is needed.

Is there a reason you can't use .openWindow() from the service worker and then do the video call in the window as you would normally?

There will be no reason for not using your suggestion if WebRTC is unavailable within ServiceWorker.

@slightlyoff slightlyoff added this to the Future ideas milestone Oct 28, 2015
@eligrey
Copy link

eligrey commented Mar 2, 2016

I would love to work on implementing something using @feross's WebTorrent + ServiceWorkers where users can simply click a button to "donate bandwidth" for large files for open source groups websites. Easy user-friendly seeding for people who don't want to download a torrent client would be amazing.

As soon as this becomes possible, I intend to start working on such a thing.

@jakearchibald
Copy link
Contributor

I'm going to close this since there's nothing for us to do here, all the work is in w3c/webrtc-pc#230

If the usage being discussed here requires the service worker to be constantly running, that seems like an abuse of SW, which is built to handle events, then shut down.

Shared workers are the ones that stick around.

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

7 participants