开发者

How to jump X second with axWindowsMediaPlayer in C#

开发者 https://www.devze.com 2023-01-28 01:15 出处:网络
I am using axWindowsMediaPlayer, and I have a video loaded, but I wa开发者_运维百科nt to jump X seconds.So, for example, if the current time is 1 minute into the video, I want to jump to 1 minute 10 s

I am using axWindowsMediaPlayer, and I have a video loaded, but I wa开发者_运维百科nt to jump X seconds. So, for example, if the current time is 1 minute into the video, I want to jump to 1 minute 10 seconds.


Okay, I found my solution. I was actually running it correctly, but I was not accounting for the time it takes to load the video.

Specifically, the needed code is like

axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 10;

However I wrote a function to check to see if the video had finished loading and attached a timer to it

private bool isPlaying()
{
   return axWindowsMediaPlayer1.playState == WMPPlayState.wmppsReady || axWindowsMediaPlayer1.playState == WMPPlayState.wmppsPlaying;
}

Then called my skip function when I got a true.

0

精彩评论

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

关注公众号