From 20c010db6fdc441b9f7c63ffe030763a9ba5687d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Wa=C5=9Bniowski?= Date: Mon, 16 Sep 2024 14:06:55 +0200 Subject: [PATCH] Add bindings for `RTCPeerConnection.setConfiguration()` (#4105) --- CHANGELOG.md | 3 +++ .../src/features/gen_RtcPeerConnection.rs | 18 ++++++++++++++++++ .../webidls/enabled/RTCPeerConnection.webidl | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b36510e80..20fb6ba7308 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add bindings for `RTCPeerConnection.setConfiguration(RTCConfiguration)` method. + [#4105](https://github.com/rustwasm/wasm-bindgen/pull/4105) + * Add bindings to `RTCRtpTransceiverDirection.stopped`. [#4102](https://github.com/rustwasm/wasm-bindgen/pull/4102) diff --git a/crates/web-sys/src/features/gen_RtcPeerConnection.rs b/crates/web-sys/src/features/gen_RtcPeerConnection.rs index 89396ac4560..5c98c638706 100644 --- a/crates/web-sys/src/features/gen_RtcPeerConnection.rs +++ b/crates/web-sys/src/features/gen_RtcPeerConnection.rs @@ -775,6 +775,24 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`, `RtcRtpSender`*"] pub fn remove_track(this: &RtcPeerConnection, sender: &RtcRtpSender); + # [wasm_bindgen (catch , method , structural , js_class = "RTCPeerConnection" , js_name = setConfiguration)] + #[doc = "The `setConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcPeerConnection`*"] + pub fn set_configuration(this: &RtcPeerConnection) -> Result<(), JsValue>; + #[cfg(feature = "RtcConfiguration")] + # [wasm_bindgen (catch , method , structural , js_class = "RTCPeerConnection" , js_name = setConfiguration)] + #[doc = "The `setConfiguration()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setConfiguration)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcConfiguration`, `RtcPeerConnection`*"] + pub fn set_configuration_with_configuration( + this: &RtcPeerConnection, + configuration: &RtcConfiguration, + ) -> Result<(), JsValue>; # [wasm_bindgen (method , structural , js_class = "RTCPeerConnection" , js_name = setIdentityProvider)] #[doc = "The `setIdentityProvider()` method."] #[doc = ""] diff --git a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl index b91563e99c3..e9bf55a7e1d 100644 --- a/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl +++ b/crates/web-sys/webidls/enabled/RTCPeerConnection.webidl @@ -107,7 +107,9 @@ interface RTCPeerConnection : EventTarget { [ChromeOnly] attribute DOMString id; - RTCConfiguration getConfiguration (); + [Throws] + undefined setConfiguration(optional RTCConfiguration configuration = {}); + RTCConfiguration getConfiguration (); [Deprecated="RTCPeerConnectionGetStreams"] sequence getLocalStreams (); [Deprecated="RTCPeerConnectionGetStreams"]