Copyright © 2001-2019 MultiMedia Soft

VideoPlayer.Load method

Previous pageReturn to chapter overviewNext page

Remarks

 

Loads a video from the specified file. Depending upon the codec and the duration of the video clip to load, due to the fact that the loading is performed inside the main application's thread, the call to this method could cause a temporary freeze of the container application user interface: in order to avoid this issue, the use of the VideoPlayer.LoadSync method should be preferred.

 

Video loading and rendering is performed through DirectShow so, in order to load a certain video format (like MPEG, MP4, AVI, etc.) the specific codec must be available on the target system or calls to this method would fail. One of the best packages containing most audio and video codecs for DirectShow is K-Lite Codec Pack and can be downloaded for free from the following link.

 

IMPORTANT NOTE ABOUT CODECS AND WINDOWS 7: When dealing with Windows 7, also if you have installed K-Lite and configured ffdshow to manage a specific format (for example the MPEG-2 format or the H.264 format used in some MP4 video clip), DirectShow will continue using the default decoder named "Microsoft DTV-DVD Video Decoder": the quality of this decoder is quite poor and doesn't support the VMR-9 video renderer used for mixing/blending video clips so a call to this method could return back an error when the involved player has been added to a video mixer through the VideoPlayer.AttachToVideoMixer method; inside Appendix B you will find a few guidelines that could be of help in order to manage DirectShow configuration through K-Lite provided tools.

 

A successful call to this method will fire the SoundLoaded event.

 

In order to be able to apply special effects like equalizers or DMO effects, the audio stream must be in Stereo or Mono so, for this reason, 5.1 and 7.1 video files are automatically resampled to Stereo. If you should need keeping 5.1 or 7.1 channels configuration, you would have to set the EnableMixingFeatures property to False.

 

For further details about the use of the embedded video player see the VideoPlayer object section.

For details about video clips rendering refer to the How to play video files through DirectShow tutorial.

 

 

Syntax

 

[Visual Basic]

control.VideoPlayer.Load (

nPlayer as Integer,

strFilename as String

) as enumErrorCodes


 

[C++]

short control.VideoPlayer.Load (

short nPlayer,

LPCTSTR strFilename

);


 

 

 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the player that will use the video player.

strFilename

String containing the name of the song file to load. It can be a full path name (ex. c:\mysounds\sound.mp3) or a filename (ex: sound.mp3) if the SoundsDirectory property has already been specified.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful