VideoCommandΒΆ

VideoCommand controls the video player.

ret = VideoCommand(hVideo, ssCommand)
ret = VideoCommand(hVideo, ssCommand, option)

Return Value

The return value depends on the parameter ssCommand. Most commands return 0 for no error and a value greater than 0 for errors. The following command returns an error string:

ssErrorMessage = VideoCommand(hVideo, "geterror");

Parameters

hVideo

Identifies the video.

ssCommand

ssCommand is one of the following commands:

Command

Description

"play"

Play the video.

"stop"

Stop the video.

"pause"

Pause the video.

"resume"

Resume the video.

"getmode"

Retuns the mode, e.g. "stopped", "paused", "playing".

"getlen"

Returns the video length in milliseconds or frames.

"getpos"

Returns the current position in milliseconds or frames.

"seek"

Sets the position in a given video. The position is set in the arg parameter in milliseconds or frames.

"setspeed"

Sets the play back speed. arg set to 1000 is the normal speed. The value 2000 would increase the playback speed by 2x. Some video formats do not support the speed value, see comment.

"getspeed"

Returns the playback speed. 1000 is the normal speed.

"geterror"

In case an error occurred, the command returns the error text.

"width"

Returns the width in pixel of the scaled video.

"height"

Returns the height in pixel of the scaled video.

"widthsource"

Returns the width in pixel of the unscaled video.

"heightsource"

Returns the height in pixel of the unscaled video.

"getvolume"

Returns the sound volume.

"setvolume"

Sets the sound volume. arg must be a number in the range 0 to 1000.

"settimeformat"

Sets the time mode. arg must be "time" or "frames". Used for the commands "seek", "getpos", "getlen".

"gettimeformat"

Returns "time" or "frames". Time in milliseconds.

Internally used commands:

Command

Description

"open"

Opens a video. arg must be the complete file name. If the format is not supported, the value 296 is returned.

"getfilename"

Returns the complete file name of the video.

"poscallback"

Enables the VideoPosCallback(hVideo, pos) function. See VideoSetCallback.

"noposcallback"

Disables the callback function. See VideoSetCallback.

"isposcallback"

Checks if the callback function VideoPosCallback(hVideo, pos) is enabled.

"modecallback"

If the mode is changed the VideoModeCallback(hVideo, mode) function is invoked. See VideoSetCallback.

"nomodecallback"

Disables the callback function. See VideoSetCallback.

"ismodecallback"

Checks if the callback function VideoModeCallback(hVideo, mode) is enabled.

"showplaybar"

Displays the video control bar.

"hideplaybar"

Hides the video control bar. See "showplaybar". Default.

"isplaybar"

Checks if the control bar is enabled.

Comment

The video must be active, see VideoActivate.

Example

hDoc = DocCreate();
hPage = PageCreate();
DocAddPage(hDoc, hPage);
hLayer = PageGetAllLayers(hPage);
hVideo = VideoCreate();
LayerAddObjects(hLayer, hVideo);
VideoSetFileName(hVideo, GetRootDirectory() + "samples/Impact_movie.mpg");
VideoActivate(hVideo, TRUE);
VideoCommand(hVideo, "play")

History

Version

Description

R2013.3

New.

id-892879