Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

(Draft)

Table of Contents
stylesquare

The Frequency JavaScript video player provides a JavaScript class and a set of constructs that makes short form video playback with advertisement a simple task.

The sequence to using the Frequency JavaScript Player is as follows:

  1.  
  2.  

Player initialization

Code Block
languagejs
titleExample
firstline1
linenumberstrue
new Frequency.Player(
        undefined, {
            video: {
                url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
                startPosition: 50,
                autoplay: true
            },
            events: {
                onStateChange: function (state) {
                },
                onProgress: function (currentTime) {
                },(...)
            }
        }
    );

...

ParamTypeDescriptionDefault
urlStringVideo file URL. 
startPositionNumberVideo start position.0
autoplayBooleanPlayer will/will not start playing right after loading video file.false

 

Events

Frequency.Player.Events

EventTypeDescription
onErrorFunctionAn error occured.
onReadyFunctionJS player ready for actions.
onMediaReadyFunctionMedia player ready.
onStateChangeFunctionPlayer state has changed.
onProgressFunctionPlayers progress changed.

 

States

StateValue 
UNKNOWNundefinedPlayer state is unknown, player setup process did not finished.
UNSTARTED-1Player media ready but pending play action.
ENDED0Player finished playback.
PLAYING1Player is currently playing a video.
PAUSED2Player paused.
BUFFERING3Player is buffering.
LOCKED4Player locked by internal action.

 

Methods

MethodReturn TypeDescription
play()VoidPlays the currently loaded video.
pause()VoidPauses the currently playing video.
seekTo(time:Number)VoidSeeks to a specified time in the video (in seconds).
getDuration()NumberReturns the duration of the currently playing video (in seconds).
getState()NumberReturns video players current state.
getCurrentTime()NumberReturns the elapsed time since the video start (in seconds).
loadVideo(url:String)VoidLoads video url specified by url string.
addEventListener(event:String, callback:String)VoidAdds a listener function for the specified event (see: Player events).
removeEventListener(event:String, callback:StringVoidRemoves a listener function for the specified event.

...