Skip to content
Permalink
Browse files

Remove OnIceComplete in favour of OnIceGatheringStateChange

Follows up 065ca21

Closes #27
  • Loading branch information...
arlolra committed May 14, 2019
1 parent 0c5ebb1 commit 68a6fb1b4353657c205bd7f6eba67630a5702bf2
Showing with 10 additions and 21 deletions.
  1. +10 −15 demo/chat/chat.go
  2. +0 −6 peerconnection.go
@@ -40,9 +40,9 @@ const (
// creation, followed by subsequent individual ICE candidates.
//
// However, to ease the user's copy & paste experience, in this case we forgo
// the trickle ICE and wait for OnIceComplete to fire, which will contain
// a full SDP mesasge with all ICE candidates, so the user only has to copy
// one message.
// the trickle ICE and wait for IceGatheringStateComplete to fire, which will
// contain a full SDP mesasge with all ICE candidates, so the user only has to
// copy one message.
//

func generateOffer() {
@@ -210,19 +210,14 @@ func start(instigator bool) {
}
// Once all ICE candidates are prepared, they need to be sent to the remote
// peer which will attempt reaching the local peer through NATs.
pc.OnIceComplete = func() {
fmt.Println("Finished gathering ICE candidates.")
sdp := pc.LocalDescription().Serialize()
signalSend(sdp)
}
/*
pc.OnIceGatheringStateChange = func(state webrtc.IceGatheringState) {
fmt.Println("Ice Gathering State:", state)
if webrtc.IceGatheringStateComplete == state {
// send local description.
}
pc.OnIceGatheringStateChange = func(state webrtc.IceGatheringState) {
fmt.Println("Ice Gathering State:", state)
if webrtc.IceGatheringStateComplete == state {
fmt.Println("Finished gathering ICE candidates.")
sdp := pc.LocalDescription().Serialize()
signalSend(sdp)
}
*/
}
// A DataChannel is generated through this callback only when the remote peer
// has initiated the creation of the data channel.
pc.OnDataChannel = func(channel *webrtc.DataChannel) {
@@ -130,7 +130,6 @@ type PeerConnection struct {
OnNegotiationNeeded func()
OnIceCandidate func(IceCandidate)
OnIceCandidateError func()
OnIceComplete func() // Possibly to be removed.
OnSignalingStateChange func(SignalingState)
OnIceConnectionStateChange func(IceConnectionState)
OnIceGatheringStateChange func(IceGatheringState)
@@ -515,11 +514,6 @@ func cgoOnIceGatheringStateChange(p int, state IceGatheringState) {
if nil != pc.OnIceGatheringStateChange {
pc.OnIceGatheringStateChange(state)
}
// Although OnIceComplete is to be deprecated in the native API, and no longer
// part of the w3 spec, keeping it for go seems easier for the users.
if IceGatheringStateComplete == state && nil != pc.OnIceComplete {
pc.OnIceComplete()
}
}

//export cgoOnDataChannel

0 comments on commit 68a6fb1

Please sign in to comment.
You can’t perform that action at this time.