blah blah blah is here! blah blah » Close

up0down
link

using Microsoft.DirectX.AudioVideoPlayback;


private Video _video = null;

// open a new video
_video = new Video(openFileDialog1.FileName);

_video.Play();


I can play video with the above code, but I want the video to repeat itself. That is, when it has reached the end, I want the video to start all over again. How do I do that?

thanks.

last answered 2 years ago

1 answers

up1down
link

Make a timer of interval like 10msec where you check the current video state and Position, so whenever the video is running and the position is near the end restart the video.

if (_video.CurrentPosition> _video.Duration-0.2 && _video.State = Microsoft.DirectX.AudioVideoPlayback.StateFlags.Running) { _video.Stop(); _video.Play(); }

thanks, it works. There should be 2 equal signs. if (_video.CurrentPosition> _video.Duration-0.2 && _video.State == Microsoft.DirectX.AudioVideoPlayback.StateFlags.Running) { _video.Stop(); _video.Play(); }

Feedback