private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if (lSongs.Count == 0)
{
return;
}
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
{
int index = PlayList.SelectedIndex;
index++;
if (index > lSongs.Count - 1)
{
PlayList.SelectedIndex = 0;
axWindowsMediaPlayer1.URL = lSongs[0];
}
else
{
PlayList.SelectedIndex = index;
axWindowsMediaPlayer1.URL = lSongs[index];
}
}
if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsReady)
{
axWindowsMediaPlayer1.Ctlcontrols.play();//异常来自HRESULT:0xC00D1054
}
}
看看是否跨线程调用
这个问题吧,其实跟VS自身控件可能有关, 你可能也是在看苏坤老师的视频吧? 我用的解决方式, 就是采用了play自带的功能来做的, 因为刚学, 所以其他功能依然和教程一样, 除了自动播放
lSong.Add("http://www.duomi.com/third-ajaxthird-play?id=24729144"); lSong.Add("http://www.duomi.com/third-ajaxthird-play?id=12874764"); lSong.Add("http://www.duomi.com/third-ajaxthird-play?id=20602192"); lis_songsPlayer.Items.AddRange(new string[] { "music1", "music2", "music3" }); foreach (var item in lSong) { var songItem = as_MusicPlay.newMedia(item); as_MusicPlay.currentPlaylist.appendItem(songItem); } as_MusicPlay.Ctlcontrols.play();
是啊 你的可以自动播放吗 可以和你qq聊下吗 我的还没有解决 呵呵 我扣771598985 谢谢
请问解决了吗?我也遇到这个问题了