v4 first commit

This commit is contained in:
dexter
2022-03-22 09:23:19 +08:00
parent e7e1ac1858
commit 742b8fb01d
6 changed files with 357 additions and 459 deletions

24
io.go Normal file
View File

@@ -0,0 +1,24 @@
package webrtc
import (
. "github.com/pion/webrtc/v3"
)
type WebRTCIO struct {
*PeerConnection
SDP string
}
func (IO *WebRTCIO) GetAnswer() (string, error) {
// Sets the LocalDescription, and starts our UDP listeners
answer, err := IO.CreateAnswer(nil)
if err != nil {
return "", err
}
gatherComplete := GatheringCompletePromise(IO.PeerConnection)
if err := IO.SetLocalDescription(answer); err != nil {
return "", err
}
<-gatherComplete
return IO.LocalDescription().SDP, nil
}