C# Class Business.MpcPlayerBusiness

Provides API control over MPC-HC.
Make sure to change these MPC-HC settings (View | Options) - Player, disable "Remember file position" - Playback, check "Repeat forever" - If using madVR for enhanced quality, Playback Output, set DirectShow Video to madVR.
Inheritance: Business.IMediaPlayerBusiness
Show file Open project: mysteryx93/NaturalGroundingPlayer

Private Properties

Property Type Description
GetForegroundWindow System.IntPtr
Player_MPC_CurrentPosition void
Player_MPC_NowPlaying void
Player_MPC_Running void
SetForegroundWindow bool
player_MPC_Play void
player_MPC_Stop void
timerDisablePosTimeout_Tick void
timerGetPosition_Tick void
timerPlayTimeout_Tick void

Public Methods

Method Description
Close ( ) : void
Hide ( ) : void
MpcPlayerBusiness ( ) : System

Initializes a new instance of the MpcPlayer class.

PlayVideoAsync ( Media video, bool enableAutoPitch ) : Task
PlayVideoAsync ( string fileName ) : Task

Plays specified video file. To use only when playing files outside the Natural Grounding folder.

SetPath ( ) : void
SetPositionAsync ( double value ) : Task
Show ( ) : void

Private Methods

Method Description
GetForegroundWindow ( ) : IntPtr
Player_MPC_CurrentPosition ( MPC msg ) : void

Raise PositionChanged event.

Player_MPC_NowPlaying ( MPC msg ) : void

When playing new file, update CurrentVideo.Length and raise NowPlaying event.

Player_MPC_Running ( ) : void

When player is restored after closing, open previous file and restore position.

SetForegroundWindow ( IntPtr hWnd ) : bool
player_MPC_Play ( MPC msg ) : void

Raise the Resume event.

player_MPC_Stop ( MPC msg ) : void

Raise the Pause event.

timerDisablePosTimeout_Tick ( object sender, EventArgs e ) : void

Ensures the position tracking timer isn't disabled for more than 5 seconds.

timerGetPosition_Tick ( object sender, EventArgs e ) : void

Occurs every second. Detects end position, start position or restore position.

timerPlayTimeout_Tick ( object sender, EventArgs e ) : void

Occurs 5 seconds after the last video started to ensure the player returns into usable state if play failed.

Method Details

Close() public method

public Close ( ) : void
return void

Hide() public method

public Hide ( ) : void
return void

MpcPlayerBusiness() public method

Initializes a new instance of the MpcPlayer class.
public MpcPlayerBusiness ( ) : System
return System

PlayVideoAsync() public method

public PlayVideoAsync ( Media video, bool enableAutoPitch ) : Task
video DataAccess.Media
enableAutoPitch bool
return Task

PlayVideoAsync() public method

Plays specified video file. To use only when playing files outside the Natural Grounding folder.
public PlayVideoAsync ( string fileName ) : Task
fileName string The path of the file to play.
return Task

SetPath() public method

public SetPath ( ) : void
return void

SetPositionAsync() public method

public SetPositionAsync ( double value ) : Task
value double
return Task

Show() public method

public Show ( ) : void
return void