コード例 #1
0
 public IRTCDataChannel CreateDataChannel(string label, RTCDataChannelInit options = null) =>
 RTCDataChannel.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "createDataChannel",
                                                                       new object[]
 {
     label,
     options
 }));
コード例 #2
0
 public IRTCRtpSender AddTrack(IMediaStreamTrack track, IMediaStream stream) =>
 RTCRtpSender.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "addTrack",
                                                                     new object[]
 {
     ((MediaStreamTrack)track).NativeObject,
     ((MediaStream)stream).NativeObject
 }));
コード例 #3
0
ファイル: Blob.cs プロジェクト: melihercan/WebRTCme
 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)));
 }
コード例 #4
0
ファイル: MediaStream.cs プロジェクト: melihercan/WebRTCme
        public IMediaStreamTrack[] GetVideoTracks()
        {
            var jsObjectRefGetVideoTracks        = JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getVideoTracks");
            var jsObjectRefMediaStreamTrackArray = JsRuntime.GetJsPropertyArray(jsObjectRefGetVideoTracks);

            return(jsObjectRefMediaStreamTrackArray
                   .Select(jsObjectRef => MediaStreamTrack.Create(JsRuntime, jsObjectRef))
                   .ToArray());
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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());
        }
コード例 #8
0
ファイル: RTCRtpReceiver.cs プロジェクト: melihercan/WebRTCme
        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());
        }
コード例 #9
0
        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
            })));
        }
コード例 #10
0
ファイル: RTCRtpReceiver.cs プロジェクト: melihercan/WebRTCme
 /*static*/
 public RTCRtpCapabilities GetCapabilities(string kind) =>
 JsRuntime.CallJsMethod <RTCRtpCapabilities>("RTCRtpReceiver", "getCapabilities", kind);
コード例 #11
0
ファイル: RTCRtpReceiver.cs プロジェクト: melihercan/WebRTCme
 public RTCRtpReceiveParameters GetParameters() => JsRuntime.CallJsMethod <RTCRtpReceiveParameters>(
     NativeObject, "getParameters");
コード例 #12
0
 public IRTCIceCandidatePair GetSelectedCandidatePair() =>
 RTCIceCandidatePair.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject,
                                                                            "getSelectedCandidatePair"));
コード例 #13
0
 public RTCIceParameters GetRemoteParameters() =>
 JsRuntime.CallJsMethod <RTCIceParameters>(NativeObject, "getRemoteParameters");
コード例 #14
0
 public RTCConfiguration GetConfiguration() =>
 JsRuntime.CallJsMethod <RTCConfiguration>(NativeObject, "getConfiguration");
コード例 #15
0
ファイル: MediaStream.cs プロジェクト: melihercan/WebRTCme
 public IMediaStreamTrack GetTrackById(string id) =>
 MediaStreamTrack.Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "getTranckById", id));
コード例 #16
0
ファイル: MediaStream.cs プロジェクト: melihercan/WebRTCme
 public IMediaStream Clone() =>
 Create(JsRuntime, JsRuntime.CallJsMethod <JsObjectRef>(NativeObject, "clone"));