Copyright © 2005-2019 MultiMedia Soft

VideoPlayer.LoadSyncForTempoChange method

Previous pageReturn to chapter overviewNext page

Remarks

 

Loads a video from the specified file and predispose it for use with tempo, playback rate and pitch change. In order to avoid a temporary freeze of the container application user interface, the loading is performed inside a secondary thread so, when this call will return, the video will not be still available and it's recommended waiting for the CallbackForPlayersEvents delegate being invoked with the nEvent parameter set to EV_SOUND_SYNC_LOADED before making further calls for starting playback or for obtaining information about the loaded video.

 

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.

 

NOTE ABOUT TEMPO AND PLAYBACK RATE CHANGE: It's important to note that not all of the video codecs are able to manage playback rate change correctly: for example certain kind of AVI codecs will loose synchronism between audio and video when calling the Effects.PlaybackTempoSet or the Effects.PlaybackRateSet methods: this is not a limitation of our control but a defect of the codec when running the video at a speed different than normal. Furthermore, other video codecs are not fast enough in order to provide enough PCM sound data for tempo and/or playback rate change so you could experience "stuttering" during playback: when dealing with codecs that cause stuttering during playback it would be a better solution using the VideoPlayer.Load method.

 

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

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

 

 

Syntax

 

[Visual Basic]

Public Function LoadSyncForTempoChange (

nPlayerIndex as Int16,

strFilename as string

) as enumErrorCodes


 

[C#]

public enumErrorCodes LoadSyncForTempoChange (

Int16 nPlayerIndex,

string strFilename

);


 

[C++]

public: enumErrorCodes LoadSyncForTempoChange (

Int16 nPlayerIndex,

string strFilename

);


 

Parameter

Description

 

 

nPlayerIndex

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 (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.