c# - How can I play video files? -
I like playing video files, such as AVI, through my C # program. Is it possible to run such video files?
You should be able to control the media player
Example of running the audio, you should customize it in the video:
// [C #] WMPLib.WindowsMedia Player Player; Private Zero Playfile (string URL) {player = new WMPLB. Windows Media Player (); Player.PlayStateChange + = NewWMPLib._WMPOCXEvents_PlayStateChangeEventHandler (Player_PlayStateChange); Player.MediaError + = NewWMPLib._WMPOCXEvents_MediaErrorEventHandler (Player_MediaError); Player. URL = url; Player.controls.play (); } Private Zero form 1_load (Object Sender, System.EventArgs E) {// TODO Insert a valid path in the row given below. ;: PlayFile ("\ myaudio.wma c" @) Private Zero Player_playStateChange (Int NewState) {if ((WMPLib.WMPPlayState) NewState == WMPLib.WMPPlayState.wmppsStopped} {this.Close (); }} Private Zero PlayerMedia error (object pMediaObject) {message box. Show ("Can not play media file."); This.Close (); }
A little more information is available on MSDN
Comments
Post a Comment