public async Task LoadSong(string hashed, string songFileExt) { string filetype = mbApiInterface.NowPlaying_GetFileProperty(FilePropertyType.Kind).Replace(" audio file", ""); string samplerate = mbApiInterface.NowPlaying_GetFileProperty(FilePropertyType.SampleRate); string bitrate = mbApiInterface.NowPlaying_GetFileProperty(FilePropertyType.Bitrate); string channels = mbApiInterface.NowPlaying_GetFileProperty(FilePropertyType.Channels); string properties = ""; string nextSong = mbApiInterface.NowPlayingList_GetFileTag(mbApiInterface.NowPlayingList_GetNextIndex(1), MetaDataType.TrackTitle) + " by " + mbApiInterface.NowPlayingList_GetFileTag(mbApiInterface.NowPlayingList_GetNextIndex(1), MetaDataType.Artist); nextSong = nextSong == " by " || nextSong == null ? "End of List" : nextSong; if (filetype == "FLAC") { using (FlacFile file = new FlacFile(mbApiInterface.NowPlaying_GetFileUrl())) { properties = filetype + " " + file.StreamInfo.BitsPerSample.ToString() + " bit, " + samplerate + ", " + bitrate + ", " + channels; } } else { properties = filetype + " " + samplerate + ", " + bitrate + ", " + channels; } string[] temp = null; mbApiInterface.NowPlayingList_QueryFilesEx("", ref temp); int size = temp.Count(); try { await mediaChannel.LoadAsync( new MediaInformation() { ContentId = HttpUtility.UrlPathEncode(mediaContentURL + hashed + songFileExt), StreamType = StreamType.Buffered, Duration = mbApiInterface.NowPlaying_GetDuration() / 1000, Metadata = new MusicTrackMediaMetadata { Artist = mbApiInterface.NowPlaying_GetFileTag(MetaDataType.Artist), Title = mbApiInterface.NowPlaying_GetFileTag(MetaDataType.TrackTitle), AlbumName = mbApiInterface.NowPlaying_GetFileTag(MetaDataType.Album), Images = new[] { new GoogleCast.Models.Image { Url = mediaContentURL + hashed + ".jpg" } }, }, CustomData = new Dictionary <string, string>() { { "Properties", properties }, { "Position", (mbApiInterface.NowPlayingList_GetCurrentIndex() + 1).ToString() + " / " + size.ToString() }, { "Next", nextSong } } }); filenameStack.Push(hashed.ToString()); } catch (OperationCanceledException) { Debug.WriteLine("Requested to close"); } catch (Exception e) { Debug.WriteLine(e.Message); } }