maxcountryman_web_sys/features/
gen_RtcRtpSynchronizationSource.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpSynchronizationSource)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `RtcRtpSynchronizationSource` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
11    pub type RtcRtpSynchronizationSource;
12}
13impl RtcRtpSynchronizationSource {
14    #[doc = "Construct a new `RtcRtpSynchronizationSource`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
17    pub fn new(source: u32, timestamp: f64) -> Self {
18        #[allow(unused_mut)]
19        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20        ret.source(source);
21        ret.timestamp(timestamp);
22        ret
23    }
24    #[doc = "Change the `audioLevel` field of this object."]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
27    pub fn audio_level(&mut self, val: f64) -> &mut Self {
28        use wasm_bindgen::JsValue;
29        let r = ::js_sys::Reflect::set(
30            self.as_ref(),
31            &JsValue::from("audioLevel"),
32            &JsValue::from(val),
33        );
34        debug_assert!(
35            r.is_ok(),
36            "setting properties should never fail on our dictionary objects"
37        );
38        let _ = r;
39        self
40    }
41    #[doc = "Change the `source` field of this object."]
42    #[doc = ""]
43    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
44    pub fn source(&mut self, val: u32) -> &mut Self {
45        use wasm_bindgen::JsValue;
46        let r =
47            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val));
48        debug_assert!(
49            r.is_ok(),
50            "setting properties should never fail on our dictionary objects"
51        );
52        let _ = r;
53        self
54    }
55    #[doc = "Change the `timestamp` field of this object."]
56    #[doc = ""]
57    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
58    pub fn timestamp(&mut self, val: f64) -> &mut Self {
59        use wasm_bindgen::JsValue;
60        let r = ::js_sys::Reflect::set(
61            self.as_ref(),
62            &JsValue::from("timestamp"),
63            &JsValue::from(val),
64        );
65        debug_assert!(
66            r.is_ok(),
67            "setting properties should never fail on our dictionary objects"
68        );
69        let _ = r;
70        self
71    }
72    #[doc = "Change the `voiceActivityFlag` field of this object."]
73    #[doc = ""]
74    #[doc = "*This API requires the following crate features to be activated: `RtcRtpSynchronizationSource`*"]
75    pub fn voice_activity_flag(&mut self, val: Option<bool>) -> &mut Self {
76        use wasm_bindgen::JsValue;
77        let r = ::js_sys::Reflect::set(
78            self.as_ref(),
79            &JsValue::from("voiceActivityFlag"),
80            &JsValue::from(val),
81        );
82        debug_assert!(
83            r.is_ok(),
84            "setting properties should never fail on our dictionary objects"
85        );
86        let _ = r;
87        self
88    }
89}