示例#1
0
        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));
        }
示例#2
0
        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);
        }