public async Task <string> Text() { ////var bytes = await ArrayBuffer(); ////return Encoding.UTF8.GetString(bytes); /// return(await JsRuntime.CallJsMethodAsync <string>(NativeObject, "text")); }
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); }
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()); }
public async Task <IRTCStatsReport> GetStats() => await Task.FromResult(RTCStatsReport.Create(JsRuntime, await JsRuntime.CallJsMethodAsync <JsObjectRef>( NativeObject, "getStats")));
public async Task <IMediaStream> GetUserMedia(MediaStreamConstraints constraints) => await Task.FromResult(MediaStream.Create(JsRuntime, await JsRuntime.CallJsMethodAsync <JsObjectRef>(NativeObject, "getUserMedia", constraints)));
/*static*/ public async Task <IRTCCertificate> GenerateCertificate(Dictionary <string, object> keygenAlgorithm) => await Task.FromResult(RTCCertificate.Create(JsRuntime, await JsRuntime.CallJsMethodAsync <JsObjectRef>( "RTCPeerConnection", "generateCertificate", keygenAlgorithm)));
/// <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")); }