public static async ValueTask <RTCPeerConnection> Create(IJSRuntime jsRuntime, object config) { var window = await jsRuntime.GetWindowPropertyRef("window").ConfigureAwait(false); var jsRef = await jsRuntime.InvokeInstanceMethodGetRef(window, "newRTCPeerConnection", config) .ConfigureAwait(false); return(await jsRuntime.GetInstanceContent <RTCPeerConnection>(jsRef, SerializationSpec) .ConfigureAwait(false)); }
/// <summary> /// Create a WindowInterop instance that can be used for using Browser API /// </summary> /// <param name="jsRuntime"></param> /// <returns></returns> public static async ValueTask <WindowInterop> Window(this IJSRuntime jsRuntime) { var jsObjectRef = await jsRuntime.GetWindowPropertyRef("window").ConfigureAwait(false); var wsInterop = await jsRuntime.GetInstanceProperty <WindowInterop>(jsObjectRef, "self", WindowInterop.SerializationSpec).ConfigureAwait(false); wsInterop.SetJsRuntime(jsRuntime, jsObjectRef); return(wsInterop); }
public static async ValueTask <MediaStreamTrack> Create(IJSRuntime jsRuntime) { var window = await jsRuntime.GetWindowPropertyRef("window").ConfigureAwait(false); var jsObj = await jsRuntime.InvokeInstanceMethodGetRef(window, "newMediaStreamTrack") .ConfigureAwait(false); var ret = await jsRuntime.GetInstanceContent <MediaStreamTrack>(jsObj, SerializationSpec) .ConfigureAwait(false); ret.SetJsRuntime(jsRuntime, jsObj); await ret.ConfigCallbacks().ConfigureAwait(false); return(ret); }