WP 8.1有BackgroundMediaPlayer播放背景音樂。BackgroundMediaPlayer設置媒體庫項目的開放的源
http://www.jayway.com/2014/04/24/windows-phone-8-1-for-developers-the-background-media-player/
在本教程中作者建立MS-APPX源播放的歌曲:
BackgroundMediaPlayer.Current.SetUriSource(new Uri("ms-appx:///Assets/Media/Ring01.wma"));
成功。 但是,我怎樣才能SetUriSource與音樂庫音頻?僅使用SetUriSource,因爲:
新的背景播放器有三種播放歌曲的簡單方法。 SetFileSource,SetStreamSource和SetUriSource。只有其中的一個可以從前臺應用程序調用,即SetUriSource方法。其他人需要從你的任務中使用。原因是後臺播放器沒有訪問SetFIleSource或SetStreamSource所在的內存,除非它在任務中設置。
我在哪裏可以閱讀有關先進WP8.1? 謝謝你的提前。
不幸的是,它不工作。新的URI(pathSource,UriKind.RelativeOrAbsolute)有這個字符串:{文件:/// C:/數據/用戶/公共/音樂/ CD - 1/Test001.mp3} – sahap
但是,新的URI(「MS-APPX:// /Assets/Media/Ring01.wma「)工作正常。 – sahap
@RegisteredUser正如我測試它工作得很好。你可以試試:'新的Uri(@「C:/ Data/Users/Public/Music/CD-1/Test001.mp3」,UriKind.RelativeOrAbsolute)'?你有沒有加入MusicLibrary功能? – Romasz