@@ -100,14 +100,22 @@ func main() {
100
100
panic (err )
101
101
}
102
102
103
+ // Create channel that is blocked until ICE Gathering is complete
104
+ gatherComplete := webrtc .GatheringCompletePromise (peerConnection )
105
+
103
106
// Sets the LocalDescription, and starts our UDP listeners
104
107
err = peerConnection .SetLocalDescription (answer )
105
108
if err != nil {
106
109
panic (err )
107
110
}
108
111
112
+ // Block until ICE Gathering is complete, disabling trickle ICE
113
+ // we do this because we only can exchange one signaling message
114
+ // in a production application you should exchange ICE Candidates via OnICECandidate
115
+ <- gatherComplete
116
+
109
117
// Get the LocalDescription and take it to base64 so we can paste in browser
110
- fmt .Println (signal .Encode (answer ))
118
+ fmt .Println (signal .Encode (* peerConnection . LocalDescription () ))
111
119
112
120
localTrack := <- localTrackChan
113
121
for {
@@ -140,13 +148,21 @@ func main() {
140
148
panic (err )
141
149
}
142
150
151
+ // Create channel that is blocked until ICE Gathering is complete
152
+ gatherComplete = webrtc .GatheringCompletePromise (peerConnection )
153
+
143
154
// Sets the LocalDescription, and starts our UDP listeners
144
155
err = peerConnection .SetLocalDescription (answer )
145
156
if err != nil {
146
157
panic (err )
147
158
}
148
159
160
+ // Block until ICE Gathering is complete, disabling trickle ICE
161
+ // we do this because we only can exchange one signaling message
162
+ // in a production application you should exchange ICE Candidates via OnICECandidate
163
+ <- gatherComplete
164
+
149
165
// Get the LocalDescription and take it to base64 so we can paste in browser
150
- fmt .Println (signal .Encode (answer ))
166
+ fmt .Println (signal .Encode (* peerConnection . LocalDescription () ))
151
167
}
152
168
}
0 commit comments