有没有办法在 Windows Media Control 中重播视频?
如何在 Windows Media 控件中重播视频?我尝试用这种方法来做?但它不起作用
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, System.EventArgs e)
{
//mediaPlayer.currentPlaylist = mediaPlayer.mediaCollection.getByName("Dastan");
//mediaPlayer.URL = @"C:\Documents and Settings\Администратор\Мои документы\Моя музыка\Мои списки воспроизведения\Dastan.wpl";
//mediaPlayer.uiMode = "none";
PlayFile(@"C:\Documents and Settings\Администратор\Мои документы\Моя музыка\Мои списки воспроизведения\Dastan.wpl");
}
private void mediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if ((WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsPlaying)
{
mediaPlayer.fullScreen = true;
mediaPlayer.Ctlenabled = false;
}
else if ((WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsMediaEnded)
{
Form1_Load(null, null);
}
}
private void PlayFile(String url)
{
mediaPlayer.URL = url;
mediaPlayer.Ctlcontrols.play();
}
有什么想法吗?
How I can replay a video in Windows Media control? I try to do it by this way? but it doesn't work
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, System.EventArgs e)
{
//mediaPlayer.currentPlaylist = mediaPlayer.mediaCollection.getByName("Dastan");
//mediaPlayer.URL = @"C:\Documents and Settings\Администратор\Мои документы\Моя музыка\Мои списки воспроизведения\Dastan.wpl";
//mediaPlayer.uiMode = "none";
PlayFile(@"C:\Documents and Settings\Администратор\Мои документы\Моя музыка\Мои списки воспроизведения\Dastan.wpl");
}
private void mediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if ((WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsPlaying)
{
mediaPlayer.fullScreen = true;
mediaPlayer.Ctlenabled = false;
}
else if ((WMPLib.WMPPlayState)e.newState == WMPPlayState.wmppsMediaEnded)
{
Form1_Load(null, null);
}
}
private void PlayFile(String url)
{
mediaPlayer.URL = url;
mediaPlayer.Ctlcontrols.play();
}
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此代码片段完成了所有工作。谢谢各位的解答..
This code snippet does all job. Thanks for answers..
尝试将 mediaPlayer.Ctlcontrols.currentPosition 设置为 0。
Try setting mediaPlayer.Ctlcontrols.currentPosition to 0.