windows-store-apps - 更新专辑封面 Windows 8.1 Store 应用程序

标签 windows-store-apps background-audio albumart

我正在尝试更新 Windows 8.1 应用商店应用程序 (C#/Xaml) 中背景播放轨道的专辑封面,但尽管没有异常(exception),但图像不会在小传输弹出窗口中更新...

这是我正在执行的更新代码:

    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();

DownloadFile 方法执行时没有任何问题,如果我导航到本地文件夹,图像确实会被下载。我想也许我使用了错误的 URI,但当我将它分配给缩略图时,我没有遇到任何异常...

这里可能出了什么问题?非常感谢

最佳答案

事实上,这个问题我困扰了很长时间,但今天终于解决了,在之前的应用程序上花费了大约 20 多个小时才使其正常工作。如果您使用以下代码更新缩略图,则可以使用 html 链接:

updater.thumbnail = Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(new Windows.Foundation.Uri("http://www.example.com/logo.jpg"));

该函数的完整代码为:

//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();

}

关于windows-store-apps - 更新专辑封面 Windows 8.1 Store 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22571599/

相关文章:

c# - ListView - 如何将项目添加到列表的前面

c# - 在动画中使用时模糊的文本 block

file-io - 在 Windows 8 RT 中替换或重新创建文件会保留旧的 DateCreated 值

android - PWA 在后台播放媒体

android - flutter 音频服务: AudioProcessingState not updating after completely playing media item

Bash:FFmpeg:自动化专辑艺术标签

c# - 制作自己的 Windows 8 应用程序主题

c# - 是什么导致在BackgroundAudioPlayer.get_Position()出现System.Runtime.InteropServices.COMException?

android - 从 Google Play 音乐获取封面艺术

android - picasso 无法加载专辑封面