1 module libwasm.bindings.MediaSource; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.EventHandler; 7 import libwasm.bindings.EventTarget; 8 import libwasm.bindings.SourceBuffer; 9 import libwasm.bindings.SourceBufferList; 10 11 @safe: 12 nothrow: 13 14 struct MediaSource { 15 nothrow: 16 libwasm.bindings.EventTarget.EventTarget _parent; 17 alias _parent this; 18 this(Handle h) { 19 _parent = .EventTarget(h); 20 } 21 auto sourceBuffers()() { 22 return SourceBufferList(Object_Getter__Handle(this._parent, "sourceBuffers")); 23 } 24 auto activeSourceBuffers()() { 25 return SourceBufferList(Object_Getter__Handle(this._parent, "activeSourceBuffers")); 26 } 27 MediaSourceReadyState readyState()() { 28 return Object_Getter__int(this._parent, "readyState"); 29 } 30 void duration()(double duration) { 31 Object_Call_double__void(this._parent, "duration", duration); 32 } 33 double duration()() { 34 return Object_Getter__double(this._parent, "duration"); 35 } 36 void onsourceopen(T0)(scope auto ref Optional!(T0) onsourceopen) if (isTOrPointer!(T0, EventHandlerNonNull)) { 37 Object_Call_EventHandler__void(this._parent, "onsourceopen", !onsourceopen.empty, onsourceopen.front); 38 } 39 EventHandler onsourceopen()() { 40 return Object_Getter__EventHandler(this._parent, "onsourceopen"); 41 } 42 void onsourceended(T0)(scope auto ref Optional!(T0) onsourceended) if (isTOrPointer!(T0, EventHandlerNonNull)) { 43 Object_Call_EventHandler__void(this._parent, "onsourceended", !onsourceended.empty, onsourceended.front); 44 } 45 EventHandler onsourceended()() { 46 return Object_Getter__EventHandler(this._parent, "onsourceended"); 47 } 48 void onsourceclosed(T0)(scope auto ref Optional!(T0) onsourceclosed) if (isTOrPointer!(T0, EventHandlerNonNull)) { 49 Object_Call_EventHandler__void(this._parent, "onsourceclosed", !onsourceclosed.empty, onsourceclosed.front); 50 } 51 EventHandler onsourceclosed()() { 52 return Object_Getter__EventHandler(this._parent, "onsourceclosed"); 53 } 54 auto addSourceBuffer()(string type) { 55 return SourceBuffer(Object_Call_string__Handle(this._parent, "addSourceBuffer", type)); 56 } 57 void removeSourceBuffer()(scope ref SourceBuffer sourceBuffer) { 58 Object_Call_Handle__void(this._parent, "removeSourceBuffer", sourceBuffer._parent); 59 } 60 void endOfStream()(MediaSourceEndOfStreamError error) { 61 Object_Call_int__void(this._parent, "endOfStream", error); 62 } 63 void endOfStream()() { 64 Object_Call__void(this._parent, "endOfStream"); 65 } 66 void setLiveSeekableRange()(double start, double end) { 67 Object_Call_double_double__void(this._parent, "setLiveSeekableRange", start, end); 68 } 69 void clearLiveSeekableRange()() { 70 Object_Call__void(this._parent, "clearLiveSeekableRange"); 71 } 72 bool isTypeSupported()(string type) { 73 return Object_Call_string__bool(this._parent, "isTypeSupported", type); 74 } 75 string mozDebugReaderData()() { 76 return Object_Getter__string(this._parent, "mozDebugReaderData"); 77 } 78 } 79 enum MediaSourceEndOfStreamError { 80 network, 81 decode 82 } 83 enum MediaSourceReadyState { 84 closed, 85 open, 86 ended 87 } 88 89