public IRTCDataChannel CreateDataChannel(string label, RTCDataChannelInit options = null) => RTCDataChannel.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "createDataChannel", new object[] { label, options }));
public IRTCRtpSender AddTrack(IMediaStreamTrack track, IMediaStream stream) => RTCRtpSender.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "addTrack", new object[] { ((MediaStreamTrack)track).NativeObject, ((MediaStream)stream).NativeObject }));
public IBlob Slice(int start = 0, int end = 0, string contentType = "") { if (end == 0) { end = Size; } return(Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "slice", start, end, contentType))); }
public IMediaStreamTrack[] GetVideoTracks() { var jsObjectRefGetVideoTracks = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getVideoTracks"); var jsObjectRefMediaStreamTrackArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetVideoTracks); return(jsObjectRefMediaStreamTrackArray .Select(jsObjectRef => MediaStreamTrack.Create(JsRuntime, jsObjectRef)) .ToArray()); }
public IRTCIceCandidate[] GetRemoteCandidates() { var jsObjectRefGetRemoteCandidates = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getRemoteCandidates"); var jsObjectRefIceCandidateArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetRemoteCandidates); var iceCandidates = jsObjectRefIceCandidateArray .Select(jsObjectRef => RTCIceCandidate.Create(JsRuntime, jsObjectRef)) .ToArray(); JsRuntime.DeleteJsObjectRef(jsObjectRefGetRemoteCandidates.JsObjectRefId); return(iceCandidates); }
public IRTCRtpTransceiver[] GetTransceivers() { var jsObjectRefGetTransceivers = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getTransceivers"); var jsObjectRefRtpTransceiverArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetTransceivers); var rtpTransceivers = jsObjectRefRtpTransceiverArray .Select(jsObjectRef => RTCRtpTransceiver.Create(JsRuntime, jsObjectRef)) .ToArray(); JsRuntime.DeleteJsObjectRef(jsObjectRefGetTransceivers.JsObjectRefId); return(rtpTransceivers); }
public RTCIceServer[] GetDefaultIceServers() { var iceServers = new List <RTCIceServer>(); var jsObjectRefGetDefaultIceServers = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getDefaultIceServers"); var jsObjectRefIceServerArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetDefaultIceServers); foreach (var jsObjectRefIceServer in jsObjectRefIceServerArray) { iceServers.Add(JsRuntime.GetJsPropertyValue <RTCIceServer>(jsObjectRefIceServer, null)); JsRuntime.DeleteJsObjectRef(jsObjectRefIceServer.JsObjectRefId); } JsRuntime.DeleteJsObjectRef(jsObjectRefGetDefaultIceServers.JsObjectRefId); return(iceServers.ToArray()); }
public RTCRtpContributingSource[] GetContributingSources() { var rtpContributingSources = new List <RTCRtpContributingSource>(); var jsObjectRefGetContributingSources = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getContributingSources"); var jsObjectRefRtpContributingSourceArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetContributingSources); foreach (var jsObjectRefRtpContributingSource in jsObjectRefRtpContributingSourceArray) { rtpContributingSources.Add(JsRuntime.GetJsPropertyValue <RTCRtpContributingSource>( jsObjectRefRtpContributingSource, null)); JsRuntime.DeleteJsObjectRef(jsObjectRefRtpContributingSource.JsObjectRefId); } JsRuntime.DeleteJsObjectRef(jsObjectRefGetContributingSources.JsObjectRefId); return(rtpContributingSources.ToArray()); }
public IRTCRtpTransceiver AddTransceiver(IMediaStreamTrack track, RTCRtpTransceiverInit init) { object nativeInit = init; if (init is not null && init.Streams is not null) { // Convert Streams to native. var nativeStreams = init.Streams.Select(s => ((MediaStream)s).NativeObject).ToArray(); nativeInit = new { init.Direction, init.SendEncodings, nativeStreams }; } return(RTCRtpTransceiver.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "addTransceiver", new object[] { ((MediaStreamTrack)track).NativeObject, nativeInit }))); }
/*static*/ public RTCRtpCapabilities GetCapabilities(string kind) => JsRuntime.CallJsMethod <RTCRtpCapabilities>("RTCRtpReceiver", "getCapabilities", kind);
public RTCRtpReceiveParameters GetParameters() => JsRuntime.CallJsMethod <RTCRtpReceiveParameters>( NativeObject, "getParameters");
public IRTCIceCandidatePair GetSelectedCandidatePair() => RTCIceCandidatePair.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getSelectedCandidatePair"));
public RTCIceParameters GetRemoteParameters() => JsRuntime.CallJsMethod <RTCIceParameters>(NativeObject, "getRemoteParameters");
public RTCConfiguration GetConfiguration() => JsRuntime.CallJsMethod <RTCConfiguration>(NativeObject, "getConfiguration");
public IMediaStreamTrack GetTrackById(string id) => MediaStreamTrack.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getTranckById", id));
public IMediaStream Clone() => Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "clone"));