private void AudioTracks_SelectedIndexChanged(ISingleSelectMediaTrackList sender, object args) { MediaPlaybackAudioTrackList list = sender as MediaPlaybackAudioTrackList; AudioTrack audioTrack = list[sender.SelectedIndex]; MediaPlaybackItem mpItem = audioTrack.PlaybackItem; var contentId = (Guid)mpItem.Source.CustomProperties["contentId"]; string audioCodec = audioTrack.GetEncodingProperties().Subtype; var msg = $"The newly selected audio track of {contentId} has Codec {audioCodec}"; var language = audioTrack.Language; if (!String.IsNullOrEmpty(language)) { // Transform the language code into a UI-localized language name. msg += ", Language: " + (new Language(language)).DisplayName; } Log(msg); }
private void AudioTracks_SelectedIndexChanged(ISingleSelectMediaTrackList sender, object args) { MediaPlaybackAudioTrackList list = sender as MediaPlaybackAudioTrackList; AudioTrack audioTrack = list[sender.SelectedIndex]; MediaPlaybackItem mpItem = audioTrack.PlaybackItem; object customValue; mpItem.Source.CustomProperties.TryGetValue("contentId", out customValue); string contentId = (string)customValue; string audioCodec = audioTrack.GetEncodingProperties().Subtype; var msg = $"The newly selected audio track of {contentId} has Codec {audioCodec}"; var language = audioTrack.Language; if (!String.IsNullOrEmpty(language)) { // Transform the language code into a UI-localized language name. msg += ", Language: " + (new Language(language)).DisplayName; } logView.Log(msg, LogViewLoggingLevel.Information); }