HDW Player Download

Javascript API

HDW Player is still trying to better the Examples section. Mail your ideas to [email protected]

Users can control embedded HDW Player via JavaScript calls made to the JavaScript API. Calls can be made to play, pause, seek to a certain time in a video, set the volume, mute the player, and other useful functions.

Getting Started

To use Javascript API, you need to embed HDW Player to your Web Page first. Please refer Add to your Own Page guidelines to add the player to your Web Page.

Then, you need to enable Javascript API by adding &api=true to the swf path. Now your swf path would be :

swf : 'player/player.swf&api=true'

When the player is ready, the API will call the onPlayerReady callback function in where you can start executing API methods.

Please check below for the List of Available API Properties, Methods and Events.

Playback controls and player settings

Plays the currently loaded video.

Pauses the currently playing video.

Stops and cancels loading of the current video.

Seeks to a specified time in the video.

The seconds parameter identifies the time from which the video should start playing.
If the player has already buffered the portion of the video to which the user is advancing, then the player will start playing the video at the closest keyframe to the specified time. This behavior is governed by the seek() method of the Flash player's NetStream object. In practice, this means that the player could advance to a keyframe just before or just after the specified time.

Switch the playback to the loadedPlaylist Item. index refer to the XML index from the playlist.

Our Current API doesn't allow you to load your Video through any API methods. Instead, you need to use Playlist XML functionality of HDW Player as a Video Provider for the Player. Then you can load any playlist item by using this method.

Completely destroy the API Player. If this function is executed then the player won't work anymore until it is reloaded again.

Changing the player volume

Mutes the player.

Unmutes the player.

Sets the volume. Accepts an integer between 0 and 100.

Returns the player's current volume, an integer between 0 and 100. Note that getVolume() will return the volume even if the player is muted.

Playback status

Returns the number of bytes loaded for the current video.

Returns the size in bytes of the currently loaded/playing video.

Returns the elapsed time in seconds since the video started playing.

Returns the duration in seconds of the currently playing video. Note that getDuration() will return 0 until the video's metadata is loaded, which normally happens just after the video starts playing.

Adding an event listener

player.addEventListener(event:String, listener:String):Void
Adds a listener function for the specified event. The Events section below identifies the different events that the player might fire. The listener is a string that specifies the function that will execute when the specified event fires.


This event is fired whenever the player's state changes without any javascript events such as play, pause, etc.. Possible values are

    Invoked when the video start playing.
    Invoked when the video is paused.
    Invoked when the video is bufferring.
    Invoked when the video is stopped.
    Invoked when the playlist item is changed.

Invoked when the playback faced any trouble.

Check the working Example of this API at Here.