Пример #1
0
 public async Task <string> Text()
 {
     ////var bytes = await ArrayBuffer();
     ////return Encoding.UTF8.GetString(bytes);
     ///
     return(await JsRuntime.CallJsMethodAsync <string>(NativeObject, "text"));
 }
Пример #2
0
        public async Task <RTCSessionDescriptionInit> CreateOffer(RTCOfferOptions options)
        {
            var jsObjectRef = await JsRuntime.CallJsMethodAsync <JsObjectRef>(NativeObject,
                                                                              "createOffer", options);

            var descriptor = JsRuntime.GetJsPropertyValue <RTCSessionDescriptionInit>(jsObjectRef, null);

            JsRuntime.DeleteJsObjectRef(jsObjectRef.JsObjectRefId);
            return(descriptor);
        }
Пример #3
0
        public async Task <MediaDeviceInfo[]> EnumerateDevices()
        {
            var mediaDeviceInfos = new List <MediaDeviceInfo>();
            var jsObjectRef      = await JsRuntime.CallJsMethodAsync <JsObjectRef>(NativeObject, "enumerateDevices");

            var jsObjectRefMediaDeviceInfoArray = JsRuntime.GetJsPropertyArray(jsObjectRef);

            foreach (var jsObjectRefMediaDeviceInfo in jsObjectRefMediaDeviceInfoArray)
            {
                mediaDeviceInfos.Add(JsRuntime.GetJsPropertyValue <MediaDeviceInfo>
                                         (jsObjectRefMediaDeviceInfo, null));
                JsRuntime.DeleteJsObjectRef(jsObjectRefMediaDeviceInfo.JsObjectRefId);
            }
            JsRuntime.DeleteJsObjectRef(jsObjectRef.JsObjectRefId);
            return(mediaDeviceInfos.ToArray());
        }
Пример #4
0
 public async Task <IRTCStatsReport> GetStats() =>
 await Task.FromResult(RTCStatsReport.Create(JsRuntime, await JsRuntime.CallJsMethodAsync <JsObjectRef>(
                                                 NativeObject, "getStats")));
Пример #5
0
 public async Task <IMediaStream> GetUserMedia(MediaStreamConstraints constraints) =>
 await Task.FromResult(MediaStream.Create(JsRuntime,
                                          await JsRuntime.CallJsMethodAsync <JsObjectRef>(NativeObject, "getUserMedia", constraints)));
Пример #6
0
 /*static*/
 public async Task <IRTCCertificate> GenerateCertificate(Dictionary <string, object> keygenAlgorithm) =>
 await Task.FromResult(RTCCertificate.Create(JsRuntime, await JsRuntime.CallJsMethodAsync <JsObjectRef>(
                                                 "RTCPeerConnection", "generateCertificate", keygenAlgorithm)));
Пример #7
0
 /// <summary>
 /// ///////////////////////////////// THIS IS A HACK, REMOVE THIS ONCE JS callbacks are implemented.
 /// Currenlty the call is implemented in JsInterop.js file, remove that too
 /// </summary>
 /// <returns></returns>
 public async Task <string> GetStatsHack()
 {
     return(await JsRuntime.CallJsMethodAsync <string>(NativeObject, "getStats"));
 }