mirror of
https://github.com/m1k1o/neko.git
synced 2025-07-31 07:19:06 +02:00
fix webrtc client gathering, #259.
This commit is contained in:
parent
0cebe465a2
commit
9daf83cc52
9 changed files with 70 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
package webrtc
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
|
@ -49,6 +50,16 @@ func (peer *Peer) SetAnswer(sdp string) error {
|
|||
return peer.connection.SetRemoteDescription(webrtc.SessionDescription{SDP: sdp, Type: webrtc.SDPTypeAnswer})
|
||||
}
|
||||
|
||||
func (peer *Peer) SetCandidate(candidateString string) error {
|
||||
var candidate webrtc.ICECandidateInit
|
||||
err := json.Unmarshal([]byte(candidateString), &candidate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return peer.connection.AddICECandidate(candidate)
|
||||
}
|
||||
|
||||
func (peer *Peer) WriteData(v interface{}) error {
|
||||
peer.mu.Lock()
|
||||
defer peer.mu.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue