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