private void HandleEncoderProbed(object sender, VideoEncoder.VideoProfileInfo profileInfo) { var dict = new VarDictionary(); dict.Set("name", "supportedProfiles"); VarArray js_profiles = new VarArray(); dict.Set("profiles", js_profiles); if (profileInfo.Result < 0) { LogError(profileInfo.Result, "Cannot get supported profiles"); PostMessage(dict); } if (profileInfo.VideoProfileDescriptions.Count > 0) { var idx = 0u; foreach (var profile in profileInfo.VideoProfileDescriptions) { js_profiles.Set(idx++, VideoProfileToString(profile.Profile)); } } PostMessage(dict); }
async Task UpdateNetworkList() { using (var networkMonitor = new PepperSharp.NetworkMonitor(this)) { var networkListInfo = await networkMonitor.UpdateNetworkListAsync(); if (networkListInfo.Result != PPError.Ok) { PostMessage($"UpdateNetworkList failed: {networkListInfo.Result}"); return; } using (var networkList = networkListInfo.NetworkList) { // Send the new network list to JavaScript. using (var varNetworkList = new VarArray()) { uint infoIndex = 0; foreach (var nic in networkList.NetworkInterfaces) { using (VarDictionary varNetwork = new VarDictionary()) { varNetwork.Set("displayName", nic.DisplayName); varNetwork.Set("name", nic.Name); varNetwork.Set("state", GetEnumAsString(typeof(NetworkInterfaceState), nic.State)); varNetwork.Set("type", GetEnumAsString(typeof(NetworkInterfaceType), nic.NetworkType)); varNetwork.Set("MTU", nic.MTU); using (var varIPAddresses = new VarArray()) { uint j = 0; foreach (var address in nic.NetAddresses) { varIPAddresses.Set(j++, address.DescriptionWithPort); } varNetwork.Set("ipAddresses", varIPAddresses); varNetworkList.Set(infoIndex++, varNetwork); } } } PostMessage(varNetworkList); } } } }