Comments (8)
So it looks like your websocket is closing at the last line there. The console output is not accurate however so once you see candidate fail (it isnt actually a fail) try to press play on the video since autoplay seems to be broken right now.
from lightspeed-react.
The problem was actually my firewall, after I disabled it stream has loaded immediately, so some required ports were blocked. 8080 and 8084 were already enabled, not sure what the rest should be.
Also, socket indeed closes every several seconds, causing player to reload, but it probably should be a separate issue.
from lightspeed-react.
Hmm that is weird. I haven't experienced the socket closing randomly before. I need to document the ports better, 8084, 8080, 80 and 65535 should be all of the ports needed.
from lightspeed-react.
8084, 8080, 80 and 65535 should be all of the ports needed.
Nope, not enough:
$ sudo ufw status
Status: active
To Action From
-- ------ ----
Nginx HTTPS ALLOW Anywhere
OpenSSH ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
8084 ALLOW Anywhere
8080 ALLOW Anywhere
65535 ALLOW Anywhere
Nginx HTTPS (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
8084 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
65535 (v6) ALLOW Anywhere (v6)
Still doesn't work before I run sudo ufw disable
.
However, through netstat I found out that each time websocket is opened lightspeed-webrtc listens on a random udp port. It seems that it's used for ICE gathering: https://github.com/pion/ice/blob/64a2cf0c473c3e860728f9aa5be6c9f64bb162fc/gather.go#L181
By default it's random (portmin = portmax = 0), but you can change the range by setting it in SettingEngine before creating peer connection:
index 6f006fe..c90a96c 100644
--- a/main.go
+++ b/main.go
@@ -168,7 +168,15 @@ func websocketHandler(w http.ResponseWriter, r *http.Request) {
defer c.Close() //nolint
// Create new PeerConnection
- peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{})
+ m := webrtc.MediaEngine{}
+ if err := m.RegisterDefaultCodecs(); err != nil {
+ log.Print(err)
+ return
+ }
+ s := webrtc.SettingEngine{}
+ s.SetEphemeralUDPPortRange(10000, 10010)
+ api := webrtc.NewAPI(webrtc.WithMediaEngine(&m), webrtc.WithSettingEngine(s))
+ peerConnection, err := api.NewPeerConnection(webrtc.Configuration{})
if err != nil {
log.Print(err)
return
With this patch the port stays within the range of 10000 to 10010, so I can allow it by running sudo ufw allow 10000:10010/udp
. I think for it to be useful values for portmin and portmax should be exposed for setting as command line arguments to lightspeed-webrtc.
from lightspeed-react.
Ah this makes sense thank you!
from lightspeed-react.
Looks like the issue is solved with GRVYDEV/Lightspeed-webrtc#17.
Default ICE ports are now 20000:20500 and can be changed through --ports argument to lightspeed-webrtc.
from lightspeed-react.
Looks like the issue is solved with GRVYDEV/Lightspeed-webrtc#17.
Default ICE ports are now 20000:20500 and can be changed through --ports argument to lightspeed-webrtc.
Yup!
from lightspeed-react.
Also, socket indeed closes every several seconds, causing player to reload, but it probably should be a separate issue.
@GRVYDEV I've opened GRVYDEV/Lightspeed-webrtc#22 to discuss this
from lightspeed-react.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightspeed-react.