From 591fa6628c5c8bde763e17de268286cd5e525f28 Mon Sep 17 00:00:00 2001 From: Daniel Krol Date: Wed, 8 Apr 2020 13:42:01 -0400 Subject: [PATCH] Instructions and correct error message for localhost --- README.md | 5 +++-- static/js/webrtc.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2c7db66a..461cdf7d 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ To set an element or class to listen for an init event set `ep_webrtc.listenClas To enable webrtc with a URL parameter append the following to your pad URL ``?av=YES`` -# contributing +# developing and contributing -Please submit bug reports or patches at https://github.com/ether/ep_webrtc/issues +On your browser, you should use `localhost` instead of `0.0.0.0`. This is because webrtc generally requires a secure connection (https), but [an exception is made](https://w3c.github.io/webappsec-secure-contexts/#localhost) specifically for localhost and domains that end in `.localhost`. +Please submit bug reports or patches at https://github.com/ether/ep_webrtc/issues diff --git a/static/js/webrtc.js b/static/js/webrtc.js index 0d8e1079..32aa8744 100644 --- a/static/js/webrtc.js +++ b/static/js/webrtc.js @@ -538,9 +538,9 @@ var rtc = (function() { } }); }) - .catch(function() { + .catch(function(err) { var reason = "Sorry, we couldnt't find a suitable camera on your device. If you have a camera, make sure it set up correctly and refresh this website to retry."; - if(location.protocol !== "https:") reason = "Sorry, you need to install SSL certificates for your Etherpad instance to use WebRTC"; + if(err.name !== "NotFoundError") reason = "Sorry, you need to install SSL certificates for your Etherpad instance to use WebRTC"; $("#rtcbox") .empty()