Is there a way to stop a video at a particular position using Windows Media Player SDK? I am using C# for embedding the player and trying to see if the IWMPControls3 Interface has any stopping capability at a particular point in terms of position or time. If it can be done, then how to do it?
Asked
Active
Viewed 2,773 times
0
-
1Why no to use pause and then put_currentPosition ? – Kirill V. Lyadvinsky Jul 16 '09 at 16:52
-
1Assume that you pause and set currentposition and video starts playing from that position. Now, how to stop the video at some other position? – Arvind Jul 16 '09 at 17:04
-
You can read from the position as well. Set a timer to read the position, then stop the player when it reaches the position you care about. – John Fisher Jul 16 '09 at 17:34
2 Answers
0
It certainly can be done, though I no longer remember the techniques. There are ways that you can access the data in the stream well enough to reconstruct the audio and individual frames of video. People have written systems where the user can type a precise time and frame number and the video player jumps to that spot.
Since your question was "is there a way", the answer is "Yes". However, I can't remember enough of the specifics to tell you how to do it.

John Fisher
- 22,355
- 2
- 39
- 64
0
Like I explained in the same question here, you can use a timer to control the CurrentPosition:
private Timer tmrWmpPlayerPosition;
private TimeSpan StopPosition;
private void btn_Click(object sender, EventArgs e)
{
wmpPlayer.Ctlcontrols.currentPosition = 4;
StopPosition=TimeSpan.Parse("00:20:20");
StopWmpPlayerTimer();
StartWmpPlayerTimer();
}
private void tmrWmpPlayerPosition_Tick(object sender, EventArgs e)
{
if ((Convert.ToInt32(StopPosition.TotalSeconds) != Convert.ToInt32(wmpPlayer.Ctlcontrols.currentPosition))) return;
wmpPlayer.Ctlcontrols.pause();
StopWmpPlayerTimer();
}
private void StartWmpPlayerTimer()
{
tmrWmpPlayerPosition = new Timer();
tmrWmpPlayerPosition.Tick += new EventHandler(tmrWmpPlayerPosition_Tick);
tmrWmpPlayerPosition.Enabled = true;
tmrWmpPlayerPosition.Interval = 1000;
tmrWmpPlayerPosition.Start();
}
private void StopWmpPlayerTimer()
{
if (tmrWmpPlayerPosition != null)
tmrWmpPlayerPosition.Dispose();
tmrWmpPlayerPosition = null;
}