【问题标题】:Error when Play file .mp3 (StorageFile ) with BackgroundMediaPlayer in isolated storage windows phone 8.1 rt在隔离存储 windows phone 8.1 rt 中使用 BackgroundMediaPlayer 播放文件 .mp3 (StorageFile) 时出错
【发布时间】:2015-02-24 05:53:21
【问题描述】:

我使用 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”

请帮助我。Tks all.Sr 我的英语。

【问题讨论】:

    标签: windows-runtime windows-phone windows-phone-8.1


    【解决方案1】:

    我刚刚遇到了同样的问题 :) 当您从前台应用程序调用 SetStreamSource 时会发生这种情况。见 [https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn642090.aspx]。要播放文件中的音频,您需要向后台音频播放器发送消息(请参阅 [How to pass an object to background project in Windows Phone?)。

    【讨论】:

    • Tks 为了分享,我使用存储文件的传递路径(设备中的我的歌曲)从前景到背景混乱(Wp8.1 RT),它可以工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-16
    相关资源
    最近更新 更多