You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
496 B
24 lines
496 B
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
|
|
}
|
|
|