Add ICE connection state change notification and timeouts

This commit is contained in:
Sean DuBois
2018-06-30 02:57:47 -07:00
parent 6cd9d069c1
commit 5bf9d5af34
10 changed files with 286 additions and 123 deletions

View File

@@ -8,6 +8,7 @@ import (
"sync/atomic"
"github.com/pions/webrtc"
"github.com/pions/webrtc/pkg/ice"
"github.com/pions/webrtc/pkg/rtp"
)
@@ -49,6 +50,12 @@ func main() {
}
}
// Set the handler for ICE connection state
// This will notify you when the peer has connected/disconnected
peerConnection.OnICEConnectionStateChange = func(connectionState ice.ConnectionState) {
fmt.Printf("Connection State has changed %s \n", connectionState.String())
}
// Set the remote SessionDescription
if err := peerConnection.SetRemoteDescription(string(sd)); err != nil {
panic(err)