mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00
Add ICE candidate event handlers
Add OnICECandidate and OnICEGatheringStateChange methods to PeerConnection. The main goal of this change is to improve API compatibility with the JavaScript/Wasm bindings. It does not actually add trickle ICE support or change the ICE candidate gathering process, which is still synchronous in the Go implementation. Rather, it fires the appropriate events similar to they way they would be fired in a true trickle ICE process. Remove unused OnNegotiationNeeded event handler. This handler is not required for most applications and would be difficult to implement in Go. This commit removes the handler from the JavaScript/Wasm bindings, which leads to a more similar API for Go and JavaScript/Wasm. Add OnICEGatheringStateChange to the JavaScript/Wasm bindings. Also changes the Go implementation so that the function signatures match.
This commit is contained in:
14
js_utils.go
14
js_utils.go
@@ -92,6 +92,20 @@ func valueToUint8OrZero(val js.Value) uint8 {
|
||||
return uint8(val.Int())
|
||||
}
|
||||
|
||||
func valueToUint16OrZero(val js.Value) uint16 {
|
||||
if val == js.Null() || val == js.Undefined() {
|
||||
return 0
|
||||
}
|
||||
return uint16(val.Int())
|
||||
}
|
||||
|
||||
func valueToUint32OrZero(val js.Value) uint32 {
|
||||
if val == js.Null() || val == js.Undefined() {
|
||||
return 0
|
||||
}
|
||||
return uint32(val.Int())
|
||||
}
|
||||
|
||||
func valueToStrings(val js.Value) []string {
|
||||
result := make([]string, val.Length())
|
||||
for i := 0; i < val.Length(); i++ {
|
||||
|
Reference in New Issue
Block a user