1 module spasm.bindings.mediasource;
2 
3 import spasm.types;
4 import spasm.bindings.common;
5 import spasm.bindings.dom;
6 import spasm.bindings.html;
7 
8 @safe:
9 nothrow:
10 
11 enum AppendMode {
12   segments,
13   sequence
14 }
15 enum EndOfStreamError {
16   network,
17   decode
18 }
19 struct MediaSource {
20   nothrow:
21   spasm.bindings.dom.EventTarget _parent;
22   alias _parent this;
23   this(Handle h) {
24     _parent = .EventTarget(h);
25   }
26   auto sourceBuffers()() {
27     return SourceBufferList(MediaSource_sourceBuffers_Get(this._parent));
28   }
29   auto activeSourceBuffers()() {
30     return SourceBufferList(MediaSource_activeSourceBuffers_Get(this._parent));
31   }
32   auto readyState()() {
33     return MediaSource_readyState_Get(this._parent);
34   }
35   void duration()(double duration) {
36     MediaSource_duration_Set(this._parent, duration);
37   }
38   auto duration()() {
39     return MediaSource_duration_Get(this._parent);
40   }
41   void onsourceopen()(EventHandler onsourceopen) {
42     MediaSource_onsourceopen_Set(this._parent, onsourceopen);
43   }
44   auto onsourceopen()() {
45     return MediaSource_onsourceopen_Get(this._parent);
46   }
47   void onsourceended()(EventHandler onsourceended) {
48     MediaSource_onsourceended_Set(this._parent, onsourceended);
49   }
50   auto onsourceended()() {
51     return MediaSource_onsourceended_Get(this._parent);
52   }
53   void onsourceclose()(EventHandler onsourceclose) {
54     MediaSource_onsourceclose_Set(this._parent, onsourceclose);
55   }
56   auto onsourceclose()() {
57     return MediaSource_onsourceclose_Get(this._parent);
58   }
59   auto addSourceBuffer()(string type) {
60     return SourceBuffer(MediaSource_addSourceBuffer(this._parent, type));
61   }
62   void removeSourceBuffer()(scope ref SourceBuffer sourceBuffer) {
63     MediaSource_removeSourceBuffer(this._parent, sourceBuffer._parent);
64   }
65   void endOfStream()(EndOfStreamError error) {
66     MediaSource_endOfStream(this._parent, error);
67   }
68   void endOfStream()() {
69     MediaSource_endOfStream_0(this._parent);
70   }
71   void setLiveSeekableRange()(double start, double end) {
72     MediaSource_setLiveSeekableRange(this._parent, start, end);
73   }
74   void clearLiveSeekableRange()() {
75     MediaSource_clearLiveSeekableRange(this._parent);
76   }
77   auto isTypeSupported()(string type) {
78     return MediaSource_isTypeSupported(this._parent, type);
79   }
80 }
81 enum ReadyState {
82   closed,
83   open,
84   ended
85 }
86 struct SourceBuffer {
87   nothrow:
88   spasm.bindings.dom.EventTarget _parent;
89   alias _parent this;
90   this(Handle h) {
91     _parent = .EventTarget(h);
92   }
93   void mode()(AppendMode mode) {
94     SourceBuffer_mode_Set(this._parent, mode);
95   }
96   auto mode()() {
97     return SourceBuffer_mode_Get(this._parent);
98   }
99   auto updating()() {
100     return SourceBuffer_updating_Get(this._parent);
101   }
102   auto buffered()() {
103     return TimeRanges(SourceBuffer_buffered_Get(this._parent));
104   }
105   void timestampOffset()(double timestampOffset) {
106     SourceBuffer_timestampOffset_Set(this._parent, timestampOffset);
107   }
108   auto timestampOffset()() {
109     return SourceBuffer_timestampOffset_Get(this._parent);
110   }
111   auto audioTracks()() {
112     return AudioTrackList(SourceBuffer_audioTracks_Get(this._parent));
113   }
114   auto videoTracks()() {
115     return VideoTrackList(SourceBuffer_videoTracks_Get(this._parent));
116   }
117   auto textTracks()() {
118     return TextTrackList(SourceBuffer_textTracks_Get(this._parent));
119   }
120   void appendWindowStart()(double appendWindowStart) {
121     SourceBuffer_appendWindowStart_Set(this._parent, appendWindowStart);
122   }
123   auto appendWindowStart()() {
124     return SourceBuffer_appendWindowStart_Get(this._parent);
125   }
126   void appendWindowEnd()(double appendWindowEnd) {
127     SourceBuffer_appendWindowEnd_Set(this._parent, appendWindowEnd);
128   }
129   auto appendWindowEnd()() {
130     return SourceBuffer_appendWindowEnd_Get(this._parent);
131   }
132   void onupdatestart()(EventHandler onupdatestart) {
133     SourceBuffer_onupdatestart_Set(this._parent, onupdatestart);
134   }
135   auto onupdatestart()() {
136     return SourceBuffer_onupdatestart_Get(this._parent);
137   }
138   void onupdate()(EventHandler onupdate) {
139     SourceBuffer_onupdate_Set(this._parent, onupdate);
140   }
141   auto onupdate()() {
142     return SourceBuffer_onupdate_Get(this._parent);
143   }
144   void onupdateend()(EventHandler onupdateend) {
145     SourceBuffer_onupdateend_Set(this._parent, onupdateend);
146   }
147   auto onupdateend()() {
148     return SourceBuffer_onupdateend_Get(this._parent);
149   }
150   void onerror()(EventHandler onerror) {
151     SourceBuffer_onerror_Set(this._parent, onerror);
152   }
153   auto onerror()() {
154     return SourceBuffer_onerror_Get(this._parent);
155   }
156   void onabort()(EventHandler onabort) {
157     SourceBuffer_onabort_Set(this._parent, onabort);
158   }
159   auto onabort()() {
160     return SourceBuffer_onabort_Get(this._parent);
161   }
162   void appendBuffer()(scope ref BufferSource data) {
163     SourceBuffer_appendBuffer(this._parent, data);
164   }
165   void abort()() {
166     SourceBuffer_abort(this._parent);
167   }
168   void remove()(double start, double end) {
169     SourceBuffer_remove(this._parent, start, end);
170   }
171 }
172 struct SourceBufferList {
173   nothrow:
174   spasm.bindings.dom.EventTarget _parent;
175   alias _parent this;
176   this(Handle h) {
177     _parent = .EventTarget(h);
178   }
179   auto length()() {
180     return SourceBufferList_length_Get(this._parent);
181   }
182   void onaddsourcebuffer()(EventHandler onaddsourcebuffer) {
183     SourceBufferList_onaddsourcebuffer_Set(this._parent, onaddsourcebuffer);
184   }
185   auto onaddsourcebuffer()() {
186     return SourceBufferList_onaddsourcebuffer_Get(this._parent);
187   }
188   void onremovesourcebuffer()(EventHandler onremovesourcebuffer) {
189     SourceBufferList_onremovesourcebuffer_Set(this._parent, onremovesourcebuffer);
190   }
191   auto onremovesourcebuffer()() {
192     return SourceBufferList_onremovesourcebuffer_Get(this._parent);
193   }
194   auto opIndex()(uint index) {
195     return SourceBuffer(SourceBufferList_getter__uint(this._parent, index));
196   }
197   auto opDispatch(uint index)() {
198     return SourceBuffer(SourceBufferList_getter__uint(this._parent, index));
199   }
200 }
201 
202 
203 extern (C) Handle MediaSource_sourceBuffers_Get(Handle);
204 extern (C) Handle MediaSource_activeSourceBuffers_Get(Handle);
205 extern (C) ReadyState MediaSource_readyState_Get(Handle);
206 extern (C) void MediaSource_duration_Set(Handle, double);
207 extern (C) double MediaSource_duration_Get(Handle);
208 extern (C) void MediaSource_onsourceopen_Set(Handle, EventHandler);
209 extern (C) EventHandler MediaSource_onsourceopen_Get(Handle);
210 extern (C) void MediaSource_onsourceended_Set(Handle, EventHandler);
211 extern (C) EventHandler MediaSource_onsourceended_Get(Handle);
212 extern (C) void MediaSource_onsourceclose_Set(Handle, EventHandler);
213 extern (C) EventHandler MediaSource_onsourceclose_Get(Handle);
214 extern (C) Handle MediaSource_addSourceBuffer(Handle, string);
215 extern (C) void MediaSource_removeSourceBuffer(Handle, Handle);
216 extern (C) void MediaSource_endOfStream(Handle, EndOfStreamError);
217 extern (C) void MediaSource_endOfStream_0(Handle);
218 extern (C) void MediaSource_setLiveSeekableRange(Handle, double, double);
219 extern (C) void MediaSource_clearLiveSeekableRange(Handle);
220 extern (C) bool MediaSource_isTypeSupported(Handle, string);
221 extern (C) void SourceBuffer_mode_Set(Handle, AppendMode);
222 extern (C) AppendMode SourceBuffer_mode_Get(Handle);
223 extern (C) bool SourceBuffer_updating_Get(Handle);
224 extern (C) Handle SourceBuffer_buffered_Get(Handle);
225 extern (C) void SourceBuffer_timestampOffset_Set(Handle, double);
226 extern (C) double SourceBuffer_timestampOffset_Get(Handle);
227 extern (C) Handle SourceBuffer_audioTracks_Get(Handle);
228 extern (C) Handle SourceBuffer_videoTracks_Get(Handle);
229 extern (C) Handle SourceBuffer_textTracks_Get(Handle);
230 extern (C) void SourceBuffer_appendWindowStart_Set(Handle, double);
231 extern (C) double SourceBuffer_appendWindowStart_Get(Handle);
232 extern (C) void SourceBuffer_appendWindowEnd_Set(Handle, double);
233 extern (C) double SourceBuffer_appendWindowEnd_Get(Handle);
234 extern (C) void SourceBuffer_onupdatestart_Set(Handle, EventHandler);
235 extern (C) EventHandler SourceBuffer_onupdatestart_Get(Handle);
236 extern (C) void SourceBuffer_onupdate_Set(Handle, EventHandler);
237 extern (C) EventHandler SourceBuffer_onupdate_Get(Handle);
238 extern (C) void SourceBuffer_onupdateend_Set(Handle, EventHandler);
239 extern (C) EventHandler SourceBuffer_onupdateend_Get(Handle);
240 extern (C) void SourceBuffer_onerror_Set(Handle, EventHandler);
241 extern (C) EventHandler SourceBuffer_onerror_Get(Handle);
242 extern (C) void SourceBuffer_onabort_Set(Handle, EventHandler);
243 extern (C) EventHandler SourceBuffer_onabort_Get(Handle);
244 extern (C) void SourceBuffer_appendBuffer(Handle, scope ref BufferSource);
245 extern (C) void SourceBuffer_abort(Handle);
246 extern (C) void SourceBuffer_remove(Handle, double, double);
247 extern (C) uint SourceBufferList_length_Get(Handle);
248 extern (C) void SourceBufferList_onaddsourcebuffer_Set(Handle, EventHandler);
249 extern (C) EventHandler SourceBufferList_onaddsourcebuffer_Get(Handle);
250 extern (C) void SourceBufferList_onremovesourcebuffer_Set(Handle, EventHandler);
251 extern (C) EventHandler SourceBufferList_onremovesourcebuffer_Get(Handle);
252 extern (C) Handle SourceBufferList_getter__uint(Handle, uint);