Skip to content

Commit 97c05b5

Browse files
Add bindings for MediaStreamTrack.getCapabilities (#4236)
1 parent 3dc8c29 commit 97c05b5

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* Added support for C-style enums with negative discriminants.
1818
[#4204](https://github.com/rustwasm/wasm-bindgen/pull/4204)
1919

20+
* Added bindings for `MediaStreamTrack.getCapabilities`.
21+
[#4236](https://github.com/rustwasm/wasm-bindgen/pull/4236)
22+
2023
### Changed
2124

2225
* String enums now generate private TypeScript types but only if used.

crates/web-sys/src/features/gen_MediaStreamTrack.rs

+12
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ extern "C" {
129129
#[doc = ""]
130130
#[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`*"]
131131
pub fn clone(this: &MediaStreamTrack) -> MediaStreamTrack;
132+
#[cfg(web_sys_unstable_apis)]
133+
#[cfg(feature = "MediaTrackCapabilities")]
134+
# [wasm_bindgen (method , structural , js_class = "MediaStreamTrack" , js_name = getCapabilities)]
135+
#[doc = "The `getCapabilities()` method."]
136+
#[doc = ""]
137+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getCapabilities)"]
138+
#[doc = ""]
139+
#[doc = "*This API requires the following crate features to be activated: `MediaStreamTrack`, `MediaTrackCapabilities`*"]
140+
#[doc = ""]
141+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
142+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
143+
pub fn get_capabilities(this: &MediaStreamTrack) -> MediaTrackCapabilities;
132144
#[cfg(feature = "MediaTrackConstraints")]
133145
# [wasm_bindgen (method , structural , js_class = "MediaStreamTrack" , js_name = getConstraints)]
134146
#[doc = "The `getConstraints()` method."]

crates/web-sys/src/features/gen_MediaTrackCapabilities.rs

+24
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ extern "C" {
5353
#[wasm_bindgen(method, setter = "autoGainControl")]
5454
pub fn set_auto_gain_control(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
5555
#[cfg(web_sys_unstable_apis)]
56+
#[doc = "Get the `backgroundBlur` field of this object."]
57+
#[doc = ""]
58+
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
59+
#[doc = ""]
60+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
61+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
62+
#[wasm_bindgen(method, getter = "backgroundBlur")]
63+
pub fn get_background_blur(this: &MediaTrackCapabilities) -> Option<::js_sys::Array>;
64+
#[cfg(web_sys_unstable_apis)]
65+
#[doc = "Change the `backgroundBlur` field of this object."]
66+
#[doc = ""]
67+
#[doc = "*This API requires the following crate features to be activated: `MediaTrackCapabilities`*"]
68+
#[doc = ""]
69+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
70+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
71+
#[wasm_bindgen(method, setter = "backgroundBlur")]
72+
pub fn set_background_blur(this: &MediaTrackCapabilities, val: &::wasm_bindgen::JsValue);
73+
#[cfg(web_sys_unstable_apis)]
5674
#[cfg(feature = "ULongRange")]
5775
#[doc = "Get the `channelCount` field of this object."]
5876
#[doc = ""]
@@ -328,6 +346,12 @@ impl MediaTrackCapabilities {
328346
self
329347
}
330348
#[cfg(web_sys_unstable_apis)]
349+
#[deprecated = "Use `set_background_blur()` instead."]
350+
pub fn background_blur(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
351+
self.set_background_blur(val);
352+
self
353+
}
354+
#[cfg(web_sys_unstable_apis)]
331355
#[cfg(feature = "ULongRange")]
332356
#[deprecated = "Use `set_channel_count()` instead."]
333357
pub fn channel_count(&mut self, val: &ULongRange) -> &mut Self {

crates/web-sys/webidls/unstable/MediaTrackCapabilities.webidl

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* https://w3c.github.io/mediacapture-main/#dom-mediatrackcapabilities
88
*/
99

10+
partial interface MediaStreamTrack {
11+
MediaTrackCapabilities getCapabilities ();
12+
};
13+
1014
dictionary ULongRange {
1115
[Clamp] unsigned long max;
1216
[Clamp] unsigned long min;
@@ -33,4 +37,5 @@ dictionary MediaTrackCapabilities {
3337
ULongRange channelCount;
3438
DOMString deviceId;
3539
DOMString groupId;
40+
sequence<boolean> backgroundBlur;
3641
};

0 commit comments

Comments
 (0)