How to jump X second with axWindowsMediaPlayer in C#

梦想的初衷 提交于 2020-01-11 03:58:06

问题


I am using axWindowsMediaPlayer, and I have a video loaded, but I want 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.


回答1:


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.



来源:https://stackoverflow.com/questions/4308785/how-to-jump-x-second-with-axwindowsmediaplayer-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!