Windows phone 8 WP-将音频从url保存到IsoStorage,然后由后台代理播放
我获取音频流:Windows phone 8 WP-将音频从url保存到IsoStorage,然后由后台代理播放,windows-phone-8,windows-phone,audio-streaming,windows-phone-8-emulator,Windows Phone 8,Windows Phone,Audio Streaming,Windows Phone 8 Emulator,我获取音频流: public static Task<Stream> DownloadFile(Uri url) { var tcs = new TaskCompletionSource<Stream>(); var wc = new WebClient(); wc.OpenReadCompleted += (s, e) => { if (e.Error != null) tcs.TrySetException(e.E
public static Task<Stream> DownloadFile(Uri url)
{
var tcs = new TaskCompletionSource<Stream>();
var wc = new WebClient();
wc.OpenReadCompleted += (s, e) =>
{
if (e.Error != null) tcs.TrySetException(e.Error);
else if (e.Cancelled) tcs.TrySetCanceled();
else tcs.TrySetResult(e.Result);
};
wc.OpenReadAsync(url);
return tcs.Task;
}
我再次将有关播放列表的序列化信息保存到IsoStorage中,在后台音频播放器中,我对其进行反序列化并获取有关曲目的信息。一切似乎都很好。我在AudioPlayer中获取播放列表属性中的所有内容
问题是当我尝试播放曲目时。更准确地说,当我点击下一个曲目按钮。问题是,下一首歌并不总是开始播放。例如,当我添加断点时
方法OnPlayStateChanged(…)
:
播放列表类
public class PlayList
{
public List<TrackSimple> Tracks { get; set; }
public PlayList()
{
Tracks = new List<TrackSimple>();
}
}
公共类播放列表
{
公共列表轨道{get;set;}
公共播放列表()
{
Tracks=新列表();
}
}
您使用的是哪种播放列表(或播放列表文件)?如果是您的意思,我为我的播放列表添加了类。
case PlayState.Stopped:
break; <-- breakpoint is here
public class TrackSimple
{
public string Title { get; set; }
public string Artist { get; set; }
public string Album { get; set; }
public string TrackLink { get; set; }
public string CoverUri { get; set; }
public TrackSimple()
{
}
public TrackSimple(string title, string artist, string album, string trackLink, string coverUri)
{
Title = title;
Artist = artist;
Album = album;
TrackLink = trackLink;
CoverUri = coverUri;
}
}
public class PlayList
{
public List<TrackSimple> Tracks { get; set; }
public PlayList()
{
Tracks = new List<TrackSimple>();
}
}