1 module libwasm.bindings.RTCRtpTransceiver; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.MediaStream; 7 import libwasm.bindings.RTCRtpReceiver; 8 import libwasm.bindings.RTCRtpSender; 9 10 @safe: 11 nothrow: 12 13 struct RTCRtpTransceiver { 14 nothrow: 15 JsHandle handle; 16 alias handle this; 17 this(Handle h) { 18 this.handle = JsHandle(h); 19 } 20 Optional!(string) mid()() { 21 return Object_Getter__OptionalString(this.handle, "mid"); 22 } 23 auto sender()() { 24 return RTCRtpSender(Object_Getter__Handle(this.handle, "sender")); 25 } 26 auto receiver()() { 27 return RTCRtpReceiver(Object_Getter__Handle(this.handle, "receiver")); 28 } 29 bool stopped()() { 30 return Object_Getter__bool(this.handle, "stopped"); 31 } 32 void direction()(RTCRtpTransceiverDirection direction) { 33 Object_Call_int__void(this.handle, "direction", direction); 34 } 35 RTCRtpTransceiverDirection direction()() { 36 return Object_Getter__int(this.handle, "direction"); 37 } 38 Optional!(RTCRtpTransceiverDirection) currentDirection()() { 39 return RTCRtpTransceiver_currentDirection_Get(this.handle); 40 } 41 void stop()() { 42 Object_Call__void(this.handle, "stop"); 43 } 44 void setRemoteTrackId()(string trackId) { 45 Object_Call_string__void(this.handle, "setRemoteTrackId", trackId); 46 } 47 bool remoteTrackIdIs()(string trackId) { 48 return Object_Call_string__bool(this.handle, "remoteTrackIdIs", trackId); 49 } 50 string getRemoteTrackId()() { 51 return Object_Getter__string(this.handle, "getRemoteTrackId"); 52 } 53 void setAddTrackMagic()() { 54 Object_Call__void(this.handle, "setAddTrackMagic"); 55 } 56 bool addTrackMagic()() { 57 return Object_Getter__bool(this.handle, "addTrackMagic"); 58 } 59 void shouldRemove()(bool shouldRemove) { 60 Object_Call_bool__void(this.handle, "shouldRemove", shouldRemove); 61 } 62 bool shouldRemove()() { 63 return Object_Getter__bool(this.handle, "shouldRemove"); 64 } 65 void setCurrentDirection()(RTCRtpTransceiverDirection direction) { 66 Object_Call_int__void(this.handle, "setCurrentDirection", direction); 67 } 68 void setDirectionInternal()(RTCRtpTransceiverDirection direction) { 69 Object_Call_int__void(this.handle, "setDirectionInternal", direction); 70 } 71 void setMid()(string mid) { 72 Object_Call_string__void(this.handle, "setMid", mid); 73 } 74 void unsetMid()() { 75 Object_Call__void(this.handle, "unsetMid"); 76 } 77 void setStopped()() { 78 Object_Call__void(this.handle, "setStopped"); 79 } 80 string getKind()() { 81 return Object_Getter__string(this.handle, "getKind"); 82 } 83 bool hasBeenUsedToSend()() { 84 return Object_Getter__bool(this.handle, "hasBeenUsedToSend"); 85 } 86 void sync()() { 87 Object_Call__void(this.handle, "sync"); 88 } 89 void insertDTMF()(string tones, uint duration /* = 100 */, uint interToneGap /* = 70 */) { 90 Serialize_Object_VarArgCall!void(this.handle, "insertDTMF", "string;uint;uint", tuple(tones, duration, interToneGap)); 91 } 92 void insertDTMF()(string tones, uint duration /* = 100 */) { 93 Object_Call_string_uint__void(this.handle, "insertDTMF", tones, duration); 94 } 95 void insertDTMF()(string tones) { 96 Object_Call_string__void(this.handle, "insertDTMF", tones); 97 } 98 } 99 enum RTCRtpTransceiverDirection { 100 sendrecv, 101 sendonly, 102 recvonly, 103 inactive 104 } 105 struct RTCRtpTransceiverInit { 106 nothrow: 107 JsHandle handle; 108 alias handle this; 109 this(Handle h) { 110 this.handle = JsHandle(h); 111 } 112 static auto create() { 113 return RTCRtpTransceiverInit(libwasm_add__object()); 114 } 115 void direction()(RTCRtpTransceiverDirection direction) { 116 Object_Call_int__void(this.handle, "direction", direction); 117 } 118 RTCRtpTransceiverDirection direction()() { 119 return Object_Getter__int(this.handle, "direction"); 120 } 121 void streams()(scope ref Sequence!(MediaStream) streams) { 122 Object_Call_Handle__void(this.handle, "streams", streams.handle); 123 } 124 auto streams()() { 125 return Sequence!(MediaStream)(Object_Getter__Handle(this.handle, "streams")); 126 } 127 } 128 129 130 extern (C) Optional!(RTCRtpTransceiverDirection) RTCRtpTransceiver_currentDirection_Get(Handle);