diff --git a/cmd/webrtc/README.md b/cmd/webrtc/README.md
new file mode 100644
index 00000000..8baf575c
--- /dev/null
+++ b/cmd/webrtc/README.md
@@ -0,0 +1,6 @@
+## Userful links
+
+- https://www.ietf.org/archive/id/draft-ietf-wish-whip-01.html
+- https://www.ietf.org/id/draft-murillo-whep-01.html
+- https://github.com/Glimesh/broadcast-box/
+- https://github.com/obsproject/obs-studio/pull/7926
diff --git a/cmd/webrtc/candidates.go b/cmd/webrtc/candidates.go
index 1ce249ea..af99ca0c 100644
--- a/cmd/webrtc/candidates.go
+++ b/cmd/webrtc/candidates.go
@@ -61,7 +61,7 @@ func asyncCandidates(tr *api.Transport, cons *webrtc.Conn) {
if candidates, ok := ctx["candidate"].([]string); ok {
// process candidates that receive before this moment
for _, candidate := range candidates {
- cons.AddCandidate(candidate)
+ _ = cons.AddCandidate(candidate)
}
// remove already processed candidates
diff --git a/pkg/tcp/request.go b/pkg/tcp/request.go
index 94e0bd25..f0b76edb 100644
--- a/pkg/tcp/request.go
+++ b/pkg/tcp/request.go
@@ -84,8 +84,7 @@ func Do(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", header)
- res, err = client.Do(req)
- if err != nil {
+ if res, err = client.Do(req); err != nil {
return nil, err
}
}
diff --git a/pkg/webrtc/README.md b/pkg/webrtc/README.md
new file mode 100644
index 00000000..24282e08
--- /dev/null
+++ b/pkg/webrtc/README.md
@@ -0,0 +1,11 @@
+## StateChange
+
+1. offer = pc.CreateOffer()
+2. pc.SetLocalDescription(offer)
+3. OnICEGatheringStateChange: gathering
+4. OnSignalingStateChange: have-local-offer
+*. OnICEGatheringStateChange: complete
+5. pc.SetRemoteDescription(answer)
+6. OnSignalingStateChange: stable
+7. OnICEConnectionStateChange: checking
+8. OnICEConnectionStateChange: connected
diff --git a/pkg/webrtc/server.go b/pkg/webrtc/server.go
index e1586e44..7021f078 100644
--- a/pkg/webrtc/server.go
+++ b/pkg/webrtc/server.go
@@ -57,7 +57,7 @@ func (c *Conn) GetAnswer() (answer string, err error) {
return
}
- return desc.SDP, nil
+ return c.pc.LocalDescription().SDP, nil
}
func (c *Conn) GetCompleteAnswer() (answer string, err error) {
diff --git a/www/webrtc-sync.html b/www/webrtc-sync.html
index f7bc3eb8..36cf1189 100644
--- a/www/webrtc-sync.html
+++ b/www/webrtc-sync.html
@@ -27,14 +27,17 @@
diff --git a/www/webrtc.html b/www/webrtc.html
index 39954bdc..1463b7b7 100644
--- a/www/webrtc.html
+++ b/www/webrtc.html
@@ -61,7 +61,7 @@
if (ev.candidate !== null) {
ws.send(JSON.stringify({
- type: 'webrtc/candidate', value: ev.candidate.toJSON().candidate
+ type: 'webrtc/candidate', value: ev.candidate.candidate
}));
}
}