在隔离存储中使用 BackgroundMediaPlayer 播放文件 .mp3 (StorageFile) 时出错 windows phone 8.1 rt

Error when Play file .mp3 (StorageFile ) with BackgroundMediaPlayer in isolated storage windows phone 8.1 rt

我使用 Windows Phone 8.1 运行时 我在独立存储中获取我的歌曲

我的代码: storageFile 是隔离存储中的歌曲

IRandomAccessStream stream = await storagefile.OpenAsync(FileAccessMode.Read);
BackgroundMediaPlayer.Current.SetStreamSource(stream);
BackgroundMediaPlayer.Current.Play();

当我播放它时,它不起作用,例如照片(尝试模拟器和设备 lumina 520)

http://photoshare7.com/image/f5a

_消息: 无法将类型 'Windows.Media.Playback.MediaPlayer ' 的对象转换为类型 'Windows.Media.Playback.IMediaPlayerSource'

请帮助我。感谢all.Sr我的英语。

我只是 运行 遇到了同样的问题 :) 当您从前台应用程序调用 SetStreamSource 时会发生这种情况。参见 [https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642090.aspx]. To play audio from a file, you need to send background audio player a message (see [How to pass an object to background project in Windows Phone?).