The StreamingVideoProvider Javascript API provides a clear and reliable Javascript interface through which your 3rd party applications are able to control StreamingVideoProvider media players, get status information and handle player events. 

The StreamingVideoProvider Javascript API provides a clear and reliable Javascript interface through which your 3rd party applications are able to control StreamingVideoProvider media players, get status information and handle player events. 

You can implement any part of this API interface in your own application / website depending on your needs.

The StreamingVideoProvider Javascript API is implemented as a set of Javascript methods – Setters, Getters and Listeners for handling player events.

MEDIA PLAYER JAVASCRIPT API FEATURES

  1. Media Player Control – Play, replay, stop, pause, toggle, adjust, mute, unmute, toggle audio...
  2. Set Media Player Parameters – Volume, video ID, seek to and play/pause...
  3. Get Media Player Information – Is playing, is paused, is complete, is muted, is live...
  4. Get Media Player Parameters – Volume, videoID, stream time/duration...
  5. Event Handling – Player started, playhead update/ending/complete, enter/close fullscreen...

📝 Note: The Javascript API is included in the standard library of all embedded Media Players and does not require you to add any additional Javascript file.

MEDIA PLAYER INTERFACE

All Javascript player calls are available through the SVPDynamicPlayer object. Instance of this object is available from any media player embed code.

Example

var vars = {clip_id:"4b3c211a46ef",player_color1:"#c8c8c8",...};
var svp_player = new SVPDynamicPlayer("player4b3c211a46ef", "", "640", "379", {...}, vars);svp_player.execute();


📝 Note: Javascript player calls are not accessible immediately after page loading due to the actual loading of the media player is shortly thereafter - there is a player event notification (See Player Events and Event Handlers section). 

The SVPDynamicPlayer object can be obtained from another global object SvpPlayerInstances (also included in standard media player library). This object has a method called getPlayerInstance which returns SVPDynamicPlayer object by videoID.

Example

var svp_player = SvpPlayerInstances. getPlayerInstance("4b3c211a46ef");

📝 Note: It is very useful to make Javascript player method calls in a page with more than one media player published.

PLAYER CONTROL METHODS

Example

svp_player.play();


Methods
- Descriptions:

  • play() - Start media playback.
  • pause() - Pause media playback.
  • stop() - Stop media playback.
  • toggle() - If media playback is started, pause the player. If media playback is paused, start the player.
  • replay() - Restart media playback from the beginning.
  • adjust() - Adjust media playback (Only for Flash based Players).
  • toggleAudio() - If audio playback is started, mute the audio. If audio playback is muted, start the audio.
  • mute() - Toggle volume muting.
  • unMute() - Increase volume to 100%.

SETTERS

Example

svp_player.setVolume(50);

Methods - Descriptions:

  • seekToAndPlay(seconds) - Seek from beginning to the media and start playback. (Seek time is specified in seconds)
  • seekToAndPause(seconds) - Seek from beginning of media and pause playback. (Seek time is specified in seconds)
  • setVolume(volume) - Set volume. (Volume has to be in the 0-100 range)
  • setVideoID(videoID) - Load media with ID given by the videoID parameter. 

GETTERS

Example

var playerVolume = svp_player.getVolume();

Methods - Descriptions:

  • isPlaying() - Return true if player is playing media.
  • isPaused() - Return true if player is paused.
  • isComplete() - Return true if media playback is reached end.
  • isMuted() - Return true if audio playback is muted.
  • isLive - Return true if media is broadcasting (Live Streams, WebTV, IP Cameras).
  • getVideoID() - Get the videoID of current playing media.
  • getStreamTime() - Get the current media playback position (in seconds).
  • getStreamDuration() - Get the media length in seconds.
  • getVomume() - Get the current volume setting.

PLAYER EVENTS & EVENT HANDLERS

  • Player events are items that transpire based on a player action. 
  • Player events are normally used in combination with functions (event handlers), and the function will not be executed before the event occurs
  • Player event handlers are registered by player event listener method through SVPDynamicPlayer object. For this purpose addPlayerEventListener method is provided:
addPlayerEventListener(eventName, eventHandler);


Example

svp_player.addPlayerEventListener('PLAYER.STARTED', function(event){
                        alert('Player started successfully!');
}
);


All supported player events are listed in table below: 

Event Name - Descriptions:

  • PLAYER.STARTED - This event is triggered when player is loaded.
  • ENTER_FULLSCREEN - This event is triggered when player enters in fullscreen mode.
  • CLOSE_FULLSCREEN - This event is triggered when player closes fullscreen mode.
  • PLAYHEAD.UPDATE - This event is triggered with media playback. 📝 Note: Event can be triggered several times in seconds
  • PLAYHEAD.COMPLETE - This event is triggered when media playback has reached end.
  • PLAYHEAD.ENDING - This event is triggered when media playback is reaching end of playback.
  • LIVE.CONNECTED - This event is triggered when player is connected to live feed (Live Streams, WebTV, IP Cameras)..
  • PLAYER_HAS_SLIDES - This event is triggered when player has slides.
  • SLIDE.CHANGE - This event is triggered when slide has to be changed.

Did this answer your question?