.. highlightlang:: us .. index:: VideoCommand .. _videocommand: VideoCommand ============ .. us.tag VideoCommand NOTREADYENGLISH New5503 video-commands :ref:`VideoCommand` controls the video player. .. function:: ret = VideoCommand(hVideo, ssCommand) ret = VideoCommand(hVideo, ssCommand, option) .. us.return **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"); .. us.params **Parameters** .. uparam:: hVideo Identifies the video. .. uparam:: ssCommand *ssCommand* is one of the following commands: .. list-table:: :header-rows: 1 * - 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: .. list-table:: :header-rows: 1 * - 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 :ref:`VideoSetCallback`. * - ``"noposcallback"`` - Disables the callback function. See :ref:`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 :ref:`VideoSetCallback`. * - ``"nomodecallback"`` - Disables the callback function. See :ref:`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. .. us.comment **Comment** The video must be active, see :ref:`VideoActivate`. .. us.example **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") .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2013.3 - New. .. seealso:: :ref:`overview-videos`, :ref:`VideoCreate`, :ref:`VideoActivate`, :ref:`VideoDestroy` :sub:`id-892879`