Code refactoring for webrtc candidates

This commit is contained in:
Alexey Khit
2022-12-01 23:41:12 +03:00
parent 8c6729027b
commit 999e81c2dd
4 changed files with 17 additions and 31 deletions

View File

@@ -108,14 +108,8 @@ func (c *Conn) AddTrack(media *streamer.Media, track *streamer.Track) *streamer.
//
func (c *Conn) Push(msg interface{}) {
if msg := msg.(*streamer.Message); msg != nil {
if msg.Type == MsgTypeCandidate {
_ = c.Conn.AddICECandidate(webrtc.ICECandidateInit{
Candidate: msg.Value.(string),
})
}
}
func (c *Conn) AddCandidate(candidate string) {
_ = c.Conn.AddICECandidate(webrtc.ICECandidateInit{Candidate: candidate})
}
func (c *Conn) MarshalJSON() ([]byte, error) {