Mplayer Events and Functions - majorsilence/MPlayerControl GitHub Wiki
The MPlayer object has several events, functions, and properties.
int handle = (int)this.Handle;
MPlayer play = new MPlayer(handle, MplayerBackends.Direct3D, @"\\path\to\mplayer.exe");
If we have the play object above the following events and functions are available.
Events
- CurrentPosition - Event is raised when the files time position changes
- VideoExited - Event is raised when the end of file is reached. Also works with audio files.
Functions
- MPlayer(int wid, MplayerBackends backend) - Initialize MPlayer object
- wid - handle of gui object that video will play on
- MPlayer(int wid, MplayerBackends backend, string mplayerPath) - Initialize MPlayer object
- wid - handle of gui object that video will play on
- MPlayer(int wid, MplayerBackends backend, string mplayerPath, bool loadMplayer) - Initialize MPlayer object
- loadMplayer - Load mplayer.exe immediately in the background.
- int CurrentPlayingFileLength() - Retrieves the number of seconds of the current playing video.
- int GetCurrentPosition() - Get the current position in the file being played.
- It is highly recommended to use the CurrentPosition event instead.
- void LoadFile(string filePath) - Starts a new video/audio file immediately. Requires that Play has been called.
- void MovePosition(int timePosition) - Move to a new position in the video in seconds.
- void Mute() - Toggle Mute.
- void Pause() - Pause the current video. If paused it will unpause.
- void Play(string filePath) - Load and start playing a video.
- void Quit() - Close MPlayer instance.
- void Seek(int value, Seek type) - Seek a new position. Seek to some place in the movie.
- Seek.Relative is a relative seek of +/- value seconds (default).
- Seek.Percentage is a seek to value % in the movie.
- Seek.Percentage is a seek to value % in the movie.
- void SetSize(int width, int height) - Change the width and height of the playing video.
- void Stop() - Stop the current video.
- void SwitchAudioTrack(int track) - Switch the audio track that is playing in the video.
- Use the Discover class to find this information
- void SwitchSubtitle(int sub) - Switch the subtitles that are displayed in the video.
- Use the Discover class to find this information
- void ToggleFullScreen() - Toggle Fullscreen.
- void Volume(int volumn) - Changes volume. Accepts a volume value of 0 - 100.
Properties
- int CurrentStatus - The current status of the player. Paused, Playing, Stopped.
- bool FullScreen - Get if the video is full is screen or not. Set video to play in fullscreen.
- bool MplayerRunning - Is mplayer already running? True or False.