mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-09 00:30:08 +08:00
v4 first commit
This commit is contained in:
24
io.go
Normal file
24
io.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user