Clipstream™ Video JavaScript methods

All examples assume that the name of the applet (object) is Clipstream Video.

<applet
mayscript
codebase="http://www.videoclipstream.com/"
archive="videoclipstream.zip"
code="videoclipstream.class"
alt="The Clipstream Video Movie Player Applet"
name="Clipstream Video"
width="240" height="320">
[... parameter list ...]
<param name="CallbackOnPlay" value="callOnStart();">
</applet>

Method Description
stop_video Stop the video stream
play_video Start the video stream
pause_video Pause the video stream
toggle_video Play/stop - if stopped will play, if playing will stop
toggle_pause_video Play/pause - if paused will play, if playing will pause
get_currentstreamurl Returns the name of the current video stream
set_callbackOnPlay Set the JavaScript method to call on play
set_callbackOnTimer Set the JavaScript method to call on timer
set_callbackOnStop Set the JavaScript method to call on stop
get_pos Returns the current position in the video stream (in milliseconds)
seek_video Set the video stream to value specified (in milliseconds)
seek_video_percentage Set the video stream to value specified (in percent)
toggle_audio (boolean) Toggle the audio on or off
toggle_audio Toggle the audio on and off
get_length Returns current clip's length (in milliseconds)
get_status Returns current clip's status
get_audio Get the current audio status


stop_video

Stop the video stream

Prototype

void stop_video(void)

Parameters

None

Returns

Nothing

Description

Call this function to stop the video stream. Same as pressing the stop button on the applet control panel.

Example

document.videoclipstream.stop_audio();


Top

play_video

Start the video stream

Prototype

void play_video(int vidNum, String newPlayFunction);

Parameters

vidNum - integer value of which video to play from parameter list, 0 for auto detect.
newPlayFunction - a string with the name of the JavaScript function to call on play.

Returns

Nothing

Description

Call this function to start the video stream. Same as pressing the play button on the applet controll panel.

Example

document.videoclipstream.play_video(0,null);


Top

pause_video

Pause the video stream

Prototype

void pause_video(void);

Parameters

None

Returns

Nothing

Description

Call this function to pause the video stream. Same as pressing the pause button on the applet.

Example

document.videoclipstream.pause_video();


Top

toggle_video

Play/stop - if stopped will play, if playing will stop

Prototype

void toggle_video(void);

Parameters

None

Returns

Nothing

Description

This function will start the video if the applet is stopped or stop the video if it's playing. Useful if you want one button outside the applet to start and stop the video.

Example

document.videoclipstream.toggle_video();


Top

toggle_pause_video

Play/pause - if paused will play, if playing will pause

Prototype

void toggle_pause_video(void);

Parameters

None

Returns

Nothing

Description

This function will start the video if the applet is stopped or pause the video if it's playing. Useful if you want one button outside the applet to start and pause the video.

Example

document.videoclipstream.toggle_video_pause();


Top

get_currentstreamurl

Returns the name of the current video stream

Prototype

String get_currentstreamurl(void);

Parameters

None

Returns

A string with the URL of the current video file

Description

Use this function to get the name of the file being played (returned as a URL)

Example

var currentFile = document.videoclipstream.get_currentstreamurl();


Top

set_callbackOnPlay

Set the JavaScript method to call on play

Prototype

void set_callbackOnPlay(String newFunction);

Parameters

newFunction - a string with the name of the new JavaScript function to call on play.

Returns

Nothing

Description

Overrides the value specified in the applet parameter CallbackOnPlay. This function will be called by the applet when playback is started

Example

document.videoclipstream.set_callbackOnPlay("playFunc()");


Top

set_callbackOnTimer

Set the JavaScript method to call on timer

Prototype

void set_callbackOnTimer(String timerFunction, double x);

Parameters

timerFunction - JavaScript function to call when timer is triggered
x - time in seconds when to trigger the callback function specified by timerFunction

Returns

Nothing

Description

You can start a timer and tell the applet to call a specific function when the timer is triggered.

Example

document.videoclipstream.set_callbackOnTimer("timerFunction()", 30);


Top

set_callbackOnStop

Set the JavaScript method to call on stop

Prototype

void set_callbackOnStop(String stopFunction);

Parameters

stopFunction - a string with the name of the new JavaScript function to call.

Returns

Nothing

Description

This function will be called by the applet when playback is stopped.

Example

document.videoclipstream.set_callbackOnStop("stopFunc()");


Top

get_pos

Returns the current position in the video stream (in milliseconds)

Prototype

int get_pos(void);

Parameters

None

Returns

Integer value specifying the current position of the video stream in milliseconds.

Description

Call this function to determine current position.

Example

var currentPosition = document.videoclipstream.get_pos();


Top

seek_video

Set the video stream to value specified (in milliseconds)

Prototype

void seek_video(int newPos);

Parameters

newPos - integer value specifying the new position of the video stream (in milliseconds).

Returns

Nothing

Description: Used to set the playback position of the current video stream in milliseconds.

Example

document.videoclipstream.seek_video(8000);


Top

seek_video_percentage

Set the video stream to value specified (in percent)

Prototype

void seek_video(double newPercent);

Parameters

newPercent - value specifying the new position of the video stream (in percent). Valid values range from 0 to 1.

Returns

Nothing

Description

Used to set the playback position of the current video stream as a percentage.

Example

document.videoclipstream.seek_video_percentage(0.5);



Top

toggle_audio (Boolean)

Toggle the audio on or off

Prototype

void toggle_audio(bool boolValue);

Parameters

boolValue - true or false, true will enable audio, false will disable.

Returns

Nothing

Description

Used to turn the audio specifically (as opposed to either) on or off during video playback.

Example

document.videoclipstream.toggle_audio(true);



Top

toggle_audio

Toggle the audio on and off

Prototype

void toggle_audio(void);

Parameters

None

Returns

Nothing

Description

Used to toggle the audio either on or off during video playback. If audio is enabled, will disable. If disabled, will enable.

Example

document.videoclipstream.toggle_audio();


Top


get_audio

Get the current status of the audio stream.

Prototype

bool get_audio();

Parameters

None

Returns

A boolean value, true or false.

Description

Will return the current status of the audio stream, true means the audio is playing, false if it's disabled.

Example

var audioStatus = document.videoclipstream.get_audio();


get_status

Get the current clip's status.

Parameters

None

Returns

play/pause/idle

Description

Will return the status of the stream.


get_length

Get the current clip's length.

Parameters

None

Returns

Integer, in milliseconds.

Description

Returns the length of the stream.


Go to Java.com Go to dsny.com