Reputation: 4815
I'm trying to update the album art for a background playing track in Windows 8.1 Store app (C#/Xaml) but although I get no exceptions, the image doesn't update in the little transport popup...
this is the code I'm executing to update it:
var track = App.MediaPlayer.Tag as Track;
await App.Api.Cache.DownloadFile("currentalbumart.png", new Uri(track.medium_image_url));
// Get the updater.
SystemMediaTransportControlsDisplayUpdater updater = App.SystemControls.DisplayUpdater;
updater.Type = MediaPlaybackType.Music;
updater.MusicProperties.AlbumArtist = track.artist;
updater.MusicProperties.Title = track.name;
updater.Thumbnail = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appdata:///local/currentalbumart.png"));
updater.Update();
The DownloadFile method executes without any issue, and if I navigate to the local folder, indeed the image does get downloaded. I thought perhaps I'm using the wrong URI to it, but I don't get any exceptions when I assign it to the thumbnail...
what might be wrong here? many thanks
Upvotes: 2
Views: 2162
Reputation: 2646
I actually had this problem for ages but finally fixed it today, after about 20+hours on previous apps to get it working. If you use the following code to update your thumbnail, you can use a html link:
updater.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new Windows.Foundation.Uri("http://www.example.com/logo.jpg"));
This leaves the full code for the function to be:
//Used to update the media controls etc
function UpdateSongInfoManually(artist,songName,AlbumArtist, SongArt) {
// Get the updater.
var updater = systemMediaControls.displayUpdater;
updater.type = 1; //1=Music
// Music metadata.
updater.musicProperties.AlbumArtist = artist;
updater.musicProperties.AlbumArtist = mixName;
updater.musicProperties.Title = songTitle;
updater.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new Windows.Foundation.Uri(MixArt));
// Set the album art thumbnail.
// RandomAccessStreamReference is defined in Windows.Storage.Streams
//updater.Thumbnail =
// RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Music/music1_AlbumArt.jpg"));
// Update the system media transport controls.
updater.update();
}
Upvotes: 2
Reputation: 103
I have a similar problem in a Windows 8.1 Phone (Store) app. First I tried to copy MP3 files (with ID3 tags) and a folder.jpg file as album art using Windows Explorer to the Phones Music library (Music//). Using standard Music app everything works fine. Than I tried to do the same inside the app I am developing. I download mp3 and jpg file from a server and stored them into the music library. I verified the result with the phones standard Music App. The ID3 tags are detected correctly but the album art jpg file is not shown. And now the thing becomes completely magic. Using Explorer I copied the jpg file to the PC and checked it. Jpg looks fine. Than I copied it back to the phone. And now standard music app shows correct album art !! Maybe it has something to do with file security.
Upvotes: 0