开发者

Is there any way to replay a video in Windows Media Control?

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.wmp开发者_开发技巧psMediaEnded)
        {
            Form1_Load(null, null);
        }
    }
    private void PlayFile(String url)
    {
        mediaPlayer.URL = url;
        mediaPlayer.Ctlcontrols.play();
    }

Any ideas?


mediaPlayer.settings.setMode("loop", true); 

This code snippet does all job. Thanks for answers..


Try setting mediaPlayer.Ctlcontrols.currentPosition to 0.

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)
    {
        mediaPlayer.Ctlcontrols.currentPosition = 0;
        mediaPlayer.Ctlcontrols.play();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜