private async void AudioStreamsFlyout_Closed(object sender, object e) { ListPickerFlyout f = (ListPickerFlyout)sender; object result = f.SelectedValue; if (result != null) { Player.AudioStreamExtended ase = (Player.AudioStreamExtended)result; await Player.SetAudioStream(GlobalVariables.CurrentPlayerState.PlayerType, ase.index); } }
public static async Task <List <Player.AudioStreamExtended> > GetAudioStreams() { JArray properties = new JArray("audiostreams", "currentaudiostream"); JObject result = await Player.GetProperties(GlobalVariables.CurrentPlayerState.PlayerType, properties); if (result != null) { JArray streams = (JArray)result["audiostreams"]; if (streams.HasValues) { List <Player.AudioStreamExtended> newstreams = new List <Player.AudioStreamExtended>(); foreach (JToken s in streams) { Player.AudioStreamExtended news = new Player.AudioStreamExtended(); news.index = (int)s["index"]; news.language = (string)s["language"]; news.name = (string)s["name"]; newstreams.Add(news); } JToken curstream = result["currentaudiostream"]; if (curstream.HasValues) { int id = (int)curstream["index"]; Player.AudioStreamExtended curitem = newstreams.FirstOrDefault(s => s.index == id); if (curitem != null) { curitem.isInUse = true; foreach (Player.AudioStreamExtended ase in newstreams) { if (ase.isInUse == null) { ase.isInUse = false; } } curitem.channels = (int)curstream["channels"]; curitem.codec = (string)curstream["codec"]; curitem.bitrate = (int)curstream["bitrate"]; } } return(newstreams); } } return(null); }