积极答复者
在做8.0的音乐播放请问如何传递网络音乐的播放列表给后台音频播放代理?

问题
答案
-
不是的。播放列表是在自定义的AudioPlayer类中,歌曲切换操作也是在那个类中进行的。同样的,和系统后台的AudioPlayerAgent沟通的也是那个AudioPlayer类。
AudioPlayerAgent只负责音乐方面基本功能的操作,其他的都是在自定义的AudioPlayer中实现。例子的代码就是这样做的。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 向宽平 2015年4月8日 6:03
全部回复
-
你好,
一般来说我们都是在app代码里的audioplayer封装类中传递这个List的,我不确定你是不是也是这么做的。这里有个演示文档说明了如何创建播放列表,然后如何传递给后台音频代理,请看一看那个"实现音频代理"小节。https://msdn.microsoft.com/zh-cn/library/windows/apps/hh202978(v=vs.105).aspx
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
你好,
示例代码中继承AudioPlayerAgent类,实现了自己的AudioPlayer代理类。就是示例代码中的MyAudioPlaybackAgent工程。
在工程中使用静态的数组来保存音乐集合,AudioPlayer通过currentTrackNumber变量来找到当前应该播放的歌曲。
在播放下一首的方法中,首先增加currentTrackNumber变量来找到下一首歌曲在集合中的位置,然后判断索引是不是溢出了集合,如果是就回到第一首。然后调用播放方法实现换歌。上一首的方法也是如此。
private void PlayNextTrack(BackgroundAudioPlayer player) { if (++currentTrackNumber >= _playList.Count) { currentTrackNumber = 0; } PlayTrack(player); }
这个代理类写好后,系统就可以根据你提供的方法在后台播放音乐了。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
后台音频代理类型里面有个静态的集合,你只要把从服务器获取的歌曲集合同步到那个静态的集合里面就可以了,然后重新设置一下currentTrackNumber来指向你当前想要播放的歌曲。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
不是的。播放列表是在自定义的AudioPlayer类中,歌曲切换操作也是在那个类中进行的。同样的,和系统后台的AudioPlayerAgent沟通的也是那个AudioPlayer类。
AudioPlayerAgent只负责音乐方面基本功能的操作,其他的都是在自定义的AudioPlayer中实现。例子的代码就是这样做的。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 向宽平 2015年4月8日 6:03