Skip to main content

web_sys/features/
gen_MediaSource.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    #[wasm_bindgen(
8        extends = "EventTarget",
9        extends = "::js_sys::Object",
10        js_name = "MediaSource",
11        typescript_type = "MediaSource"
12    )]
13    #[derive(Debug, Clone, PartialEq, Eq)]
14    #[doc = "The `MediaSource` class."]
15    #[doc = ""]
16    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource)"]
17    #[doc = ""]
18    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
19    pub type MediaSource;
20    #[cfg(feature = "SourceBufferList")]
21    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "sourceBuffers")]
22    #[doc = "Getter for the `sourceBuffers` field of this object."]
23    #[doc = ""]
24    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/sourceBuffers)"]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `SourceBufferList`*"]
27    pub fn source_buffers(this: &MediaSource) -> SourceBufferList;
28    #[cfg(feature = "SourceBufferList")]
29    #[wasm_bindgen(
30        method,
31        getter,
32        js_class = "MediaSource",
33        js_name = "activeSourceBuffers"
34    )]
35    #[doc = "Getter for the `activeSourceBuffers` field of this object."]
36    #[doc = ""]
37    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/activeSourceBuffers)"]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `SourceBufferList`*"]
40    pub fn active_source_buffers(this: &MediaSource) -> SourceBufferList;
41    #[cfg(feature = "MediaSourceReadyState")]
42    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "readyState")]
43    #[doc = "Getter for the `readyState` field of this object."]
44    #[doc = ""]
45    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/readyState)"]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `MediaSourceReadyState`*"]
48    pub fn ready_state(this: &MediaSource) -> MediaSourceReadyState;
49    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "duration")]
50    #[doc = "Getter for the `duration` field of this object."]
51    #[doc = ""]
52    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/duration)"]
53    #[doc = ""]
54    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
55    pub fn duration(this: &MediaSource) -> f64;
56    #[wasm_bindgen(method, setter, js_class = "MediaSource", js_name = "duration")]
57    #[doc = "Setter for the `duration` field of this object."]
58    #[doc = ""]
59    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/duration)"]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
62    pub fn set_duration(this: &MediaSource, value: f64);
63    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "onsourceopen")]
64    #[doc = "Getter for the `onsourceopen` field of this object."]
65    #[doc = ""]
66    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceopen)"]
67    #[doc = ""]
68    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
69    pub fn onsourceopen(this: &MediaSource) -> Option<::js_sys::Function>;
70    #[wasm_bindgen(method, setter, js_class = "MediaSource", js_name = "onsourceopen")]
71    #[doc = "Setter for the `onsourceopen` field of this object."]
72    #[doc = ""]
73    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceopen)"]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
76    pub fn set_onsourceopen(this: &MediaSource, value: Option<&::js_sys::Function>);
77    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "onsourceended")]
78    #[doc = "Getter for the `onsourceended` field of this object."]
79    #[doc = ""]
80    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceended)"]
81    #[doc = ""]
82    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
83    pub fn onsourceended(this: &MediaSource) -> Option<::js_sys::Function>;
84    #[wasm_bindgen(method, setter, js_class = "MediaSource", js_name = "onsourceended")]
85    #[doc = "Setter for the `onsourceended` field of this object."]
86    #[doc = ""]
87    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceended)"]
88    #[doc = ""]
89    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
90    pub fn set_onsourceended(this: &MediaSource, value: Option<&::js_sys::Function>);
91    #[wasm_bindgen(method, getter, js_class = "MediaSource", js_name = "onsourceclose")]
92    #[doc = "Getter for the `onsourceclose` field of this object."]
93    #[doc = ""]
94    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceclose)"]
95    #[doc = ""]
96    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
97    pub fn onsourceclose(this: &MediaSource) -> Option<::js_sys::Function>;
98    #[wasm_bindgen(method, setter, js_class = "MediaSource", js_name = "onsourceclose")]
99    #[doc = "Setter for the `onsourceclose` field of this object."]
100    #[doc = ""]
101    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/onsourceclose)"]
102    #[doc = ""]
103    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
104    pub fn set_onsourceclose(this: &MediaSource, value: Option<&::js_sys::Function>);
105    #[wasm_bindgen(catch, constructor, js_class = "MediaSource")]
106    #[doc = "The `new MediaSource(..)` constructor, creating a new instance of `MediaSource`."]
107    #[doc = ""]
108    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/MediaSource)"]
109    #[doc = ""]
110    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
111    pub fn new() -> Result<MediaSource, JsValue>;
112    #[cfg(feature = "SourceBuffer")]
113    #[wasm_bindgen(catch, method, js_class = "MediaSource", js_name = "addSourceBuffer")]
114    #[doc = "The `addSourceBuffer()` method."]
115    #[doc = ""]
116    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/addSourceBuffer)"]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `SourceBuffer`*"]
119    pub fn add_source_buffer(this: &MediaSource, type_: &str) -> Result<SourceBuffer, JsValue>;
120    #[wasm_bindgen(
121        catch,
122        method,
123        js_class = "MediaSource",
124        js_name = "clearLiveSeekableRange"
125    )]
126    #[doc = "The `clearLiveSeekableRange()` method."]
127    #[doc = ""]
128    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/clearLiveSeekableRange)"]
129    #[doc = ""]
130    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
131    pub fn clear_live_seekable_range(this: &MediaSource) -> Result<(), JsValue>;
132    #[wasm_bindgen(catch, method, js_class = "MediaSource", js_name = "endOfStream")]
133    #[doc = "The `endOfStream()` method."]
134    #[doc = ""]
135    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/endOfStream)"]
136    #[doc = ""]
137    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
138    pub fn end_of_stream(this: &MediaSource) -> Result<(), JsValue>;
139    #[cfg(feature = "MediaSourceEndOfStreamError")]
140    #[wasm_bindgen(catch, method, js_class = "MediaSource", js_name = "endOfStream")]
141    #[doc = "The `endOfStream()` method."]
142    #[doc = ""]
143    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/endOfStream)"]
144    #[doc = ""]
145    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `MediaSourceEndOfStreamError`*"]
146    pub fn end_of_stream_with_error(
147        this: &MediaSource,
148        error: MediaSourceEndOfStreamError,
149    ) -> Result<(), JsValue>;
150    #[wasm_bindgen(
151        static_method_of = "MediaSource",
152        js_class = "MediaSource",
153        js_name = "isTypeSupported"
154    )]
155    #[doc = "The `isTypeSupported()` method."]
156    #[doc = ""]
157    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/isTypeSupported_static)"]
158    #[doc = ""]
159    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
160    pub fn is_type_supported(type_: &str) -> bool;
161    #[cfg(feature = "SourceBuffer")]
162    #[wasm_bindgen(
163        catch,
164        method,
165        js_class = "MediaSource",
166        js_name = "removeSourceBuffer"
167    )]
168    #[doc = "The `removeSourceBuffer()` method."]
169    #[doc = ""]
170    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/removeSourceBuffer)"]
171    #[doc = ""]
172    #[doc = "*This API requires the following crate features to be activated: `MediaSource`, `SourceBuffer`*"]
173    pub fn remove_source_buffer(
174        this: &MediaSource,
175        source_buffer: &SourceBuffer,
176    ) -> Result<(), JsValue>;
177    #[wasm_bindgen(
178        catch,
179        method,
180        js_class = "MediaSource",
181        js_name = "setLiveSeekableRange"
182    )]
183    #[doc = "The `setLiveSeekableRange()` method."]
184    #[doc = ""]
185    #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange)"]
186    #[doc = ""]
187    #[doc = "*This API requires the following crate features to be activated: `MediaSource`*"]
188    pub fn set_live_seekable_range(this: &MediaSource, start: f64, end: f64)
189        -> Result<(), JsValue>;
190}