Table of Contents
© Vividas Technologies Pty Ltd
This guide provides information for enabling web pages with Vividas Video Streams. The guide is intended for web developers and web site administrators.
The guide is divided into the following sections:
Quick Start Guide - how to embed the Vividas Player in web page and play a media file.
Customising the Vividas Player - description of the player tag and parameters.
Upgrading from SDK 3.5 and earlier to SDK 4.x - additional help in upgrading older Vividas Player web pages to SDK 4.x.
Further Information about the Vividas Player - More information about the Vividas Player's capabilities, customising and communicating with the player.
Vividas Player Javascript API - reference to the player commands, properties and events.
![]() | Note |
|---|---|
See also http://www.vividas.com/sdk for additional information on deploying the Vividas Player in a web site. |
The Vividas Player that plays Vividas encoded media is embedded in a web page with
an <object> tag. This tag is either created on the fly in the PREFERRED
method with the startPlayerObjectTag javascript function, or it is
directly placed in the page by the web developer in SIMPLIFIED method.
The PREFERRED method used to initialise the Vividas Player depends on external script files scripts/core/api.js and scripts/core/java.js, [see this section for how to obtain a copy] which must be included in the <head> section of the web page. This may not suit some deployments on some servers.
The SIMPLIFIED method used to initialise the Vividas Player removes the dependency on on the script files. However this will disable support for the Java applet player on Internet Explorer for Windows, and all viewers will be required to install the Vividas Player plugin to watch video.
Both PREFERRED and SIMPLIFIED methods of implementation configure the player and control playback with the parameter (<param>) values within the object tag.
The recommended method for adding the Vividas Player to a web page is to copy and paste from the sample index_preferred.html or index_simplified.html [see this section for how to obtain a copy] provided with the Vividas Player SDK, then do the following;
The first step to integrating the Vividas Player into a web site is to download the Vividas Player SDK. This can be found at the following location.
After downloading, extract the files using your favourite archive program to a convienient location and continue to the next sections.
Open index_preferred.html in a text or web page editor.
Copy the following HTML code between the "start player javascript support files" and "end player javascript support files" comments.
<!-- start player javascript support files --> <script type="text/javascript" src="scripts/core/api.js"></script> <script type="text/javascript" src="scripts/core/java.js"></script> <!-- end player javascript support files -->
Paste into the <head> section of your web page.
Copy the following HTML code between the "start player object tag" and "end player object tag" comments.
<!-- start player object tag -->
<script type="text/javascript">startPlayerObjectTag("vivPlayer", 704, 430);</script>
<param name="sdkVersion" value="current"/>
<param name="backgroundImage" value="images/screen_bg_click.jpeg"/>
<param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv"/>
<div class="noplugin"><p><a href="http://player.vividas.com/download.php?noplugin=true">Click to install</a> </p></div>
</object>
<!-- end player object tag -->Paste the HTML code into your web page inside a div (<div></div>) tag within the <body> section of the web page.
![]() | Note |
|---|---|
Change the mediaURL value to contain the URL of your media file. |
![]() | Note |
|---|---|
The Vividas Player can be configured to automatically commence playback when the web page is loaded. This is enabled by adding the following parameter (<param>) to the object tag. |
<param name="autoplay" value="true"/>
Publish the web site by copying the customised web page (html) to your website and copy the scripts and images folders from the Vividas Player SDK to your website.
Your web page is now ready to play with Vividas video.
If you intend to deploy using the SIMPLIFIED method;
Open index_simplified.html in a text or web page editor.
Copy the following HTML code between the "start player object tag" and "end player object tag" comments.
<!-- start player object tag --> <object id="vivPlayer" type="application/x-vividas-player;version=4.0" codebase="http://player.vividas.com/download.php#Version=4,0,0,0" width="704" height="430"> <param name="sdkVersion" value="current"/> <param name="backgroundImage" value="http://update.vividas.com/sdk/images/screen_bg_click.jpeg"/> <param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv"/> <param name="playerEvents" value="false"/> <div class="noplugin"><p><a href="http://player.vividas.com/download.php?noplugin=true">Click to install</a> </p></div> </object> <!-- end player object tag -->
Paste the HTML code into your web page inside a div (<div></div>) tag within the <body> section of the web page.
Change the mediaURL value to contain the URL of your media file.
![]() | Note |
|---|---|
To further customise the player see the Customising the Vividas Player section of this document. |
![]() | Note |
|---|---|
The Vividas Player can be configured to automatically commence playback when the web page is loaded. This is enabled by adding the following <param> to the object tag. |
<param name="autoplay" value="true"/>
Publish the customised html to your website.
Your web page is now enabled with Vividas video.
This section describes in more detail options available for Vividas Player web page deployment. PREFERRED and SIMPLIFED methods of deployment are described separately.
A standard HTML <object> tag is used to embed the Vividas Player onto a web page. The opening HTML
element for the <object> tag is created dynamically by the
startPlayerObjectTag(id,width,height,localApplet) javascript function.
The default behaviour of the startPlayerObjectTag function is to write the
<object> tag for the installed Vividas Player plugin. However, if the browser is Internet Explorer
on Windows and the player plugin is not installed, the startPlayerObjectTag function
will write the <object> tag for the Vividas Player Java applet. This allows the Vividas Player to
play video without requiring plugin installation for users of Internet Explorer on Windows.
The original HTML is as follows;
<!-- start player object tag -->
<script type="text/javascript">startPlayerObjectTag("vivPlayer", 704, 430);</script>
<param name="sdkVersion" value="current"/>
<param name="backgroundImage" value="images/screen_bg_click.jpeg"/>
<param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv"/>
<div class="noplugin"><p><a href="http://player.vividas.com/download.php?noplugin=true">Click to install</a> </p></div>
</object>
<!-- end player object tag -->If the user has installed the Vividas Player then on Windows (IE8) it results in the following object tag being written.
<!-- start player object tag -->
<script type="text/javascript">startPlayerObjectTag("vivPlayer", 704, 430);</script>
<object id="vivPlayer" name="vivPlayer" codeBase="http://player.vividas.com/download.php#Version=4,0,0,0" width="704" height="430" type="application/x-vividas-player;version=4.0">
<param name="sdkVersion" value="current" />
<param name="backgroundImage" value="images/screen_bg_click.jpeg" />
<param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv" />
</object>
<!-- end player object tag -->If the user has not installed the Vividas Player then for IE8 it inserts the following code.
![]() | Note |
|---|---|
This version of the <object> tag is only written if Java is detected in the browser. |
<!-- start player object tag -->
<script type="text/javascript">startPlayerObjectTag("vivPlayer", 704, 430);</script>
<object id="vivPlayer" name="vivPlayer" width="704" height="430" type="application/x-java-applet">
<param name="code" value="PlayerApplet.class" />
<param name="archive" value="http://player.vividas.com/download.php?java=true&version=4.0.0.0" />
<param name="MAYSCRIPT" value="true" />
<param name="java_arguments" value="-Dsun.java2d.d3d=false" />
<param name="userAgentJava" value="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)" />
<param name="sdkVersion" value="current" />
<param name="backgroundImage" value="images/screen_bg_click.jpeg" />
<param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv" />
</object>
<!-- end player object tag -->The startPlayerObjectTag function contains a number of parameters to initialise
the player object:
| id | The DHTML id of the player object, default is 'vivPlayer'. The id is used to access the
player object via getElementById(id), and is used when the player generates
events to identify the player. If multiple Vividas Players are embedded in a single
web page they will require different ids.
|
| width | The player width, in pixels (eg width="650") or percent (eg width="100%"). Percentage is relative to the size of the HTML browser layout dimensions. |
| height | The player height, in pixels (eg height="384") or percent (eg height="100%"). Percentage is relative to the size of the HTML browser layout dimensions. |
| localApplet | Optional parameter, default=false. If localApplet is true, the Java plugin loads the applet from the 'player' subdirectory on the deployment website. If localApplet is false (default behaviour), the Java plugin loads the applet from the Vividas Player update website. 'localApplet' is used for locking the web page to a specific player version on the deployment website. The "player" folder is required to be copied to the website (along side "scripts" and "images" folders) for this feature to work correctly. |
The following code is the <object> tag declaration from the index_simplified.html sample web page.
<!-- start player object tag --> <object id="vivPlayer" type="application/x-vividas-player;version=4.0" codebase="http://player.vividas.com/download.php#Version=4,0,0,0" width="704" height="430"> <param name="sdkVersion" value="current"/> <param name="backgroundImage" value="images/screen_bg_click.jpeg"/> <param name="mediaURL" value="http://www.crash-test-department.com/sdkmedia/3001_Widescreen_Ultra_915.viv"/> <param name="playerEvents" value="false"/> <div class="noplugin"><p><a href="http://player.vividas.com/download.php?noplugin=true">Click to install</a> </p></div> </object> <!-- end player object tag -->
The tag contains a number of attributes to initialise the player object:
| id | The DHTML id of the player object, default is 'vivPlayer'. The id is used to access the
player object via getElementById(id), and is used when the player generates
events to identify the player. If multiple Vividas Players are embedded in a single
web page they will require different ids.
|
| type | The MIME type of the player object, currently 'application/x-vividas-player;version=4.0'. Changing this string is not supported by Vividas. |
| codebase | The URL for downloading the player installer, see Vividas Player Installation for more detail. Changing this string is not supported by Vividas. |
| width | The player width, in pixels (eg width="650") or percent (eg width="100%"). Percentage is relative to the size of the HTML browser layout dimensions. |
| height | The player height, in pixels (eg height="384") or percent (eg height="100%"). Percentage is relative to the size of the HTML browser layout dimensions. |
If the player events are required using the SIMPLIFIED deployment method, then the scripts/core/api.js script (see this section for downloading) must be included in the header of the web page. The <param> playerEvents will need to be modified as follows to enable player events;
<param name="playerEvents" value="true"/>
The Vividas Player controls can be either within the player window controlled via a "skin" or alternatively they can be placed within javascript and controlled from the browser via javascript.
By default the Vividas Player has a skin enabled. This is the prefered method of controlling the Vividas
Player. Alternatively, if the control is preferred via javascript, the javascript object methods
playClip() and terminate() can be used to start and stop playback
respectively. The Initialisation Property
"skin" should be set to "none" and the following code copied into an appropriate place
on your web page.
<a href = "javascript:document.getElementById('vivPlayer').playClip();">Play</a>
<a href = "javascript:document.getElementById('vivPlayer').terminate();">Stop</a>![]() | Note |
|---|---|
The 'vivplayer' element ID refers to the default object which is the Vividas Player. If there is more than one Vividas Player in the web page, then the object id will require changing, along with any javascript references to that object. |
The player can be configured via javascript calls, or via additional <param> tags inserted into the HTML code to embed the Vividas Player. The Vividas Player's Initialisation Properties and Loaded and Running Properties can be set using a <param> tag within the <object> tag.
Some of the player properties are defined as Initialisation Properties and can only be set using <param> tags in the HTML. This is because the player uses the param object properties whilst initialising. Two notable params tags include the splash screen and background image.
The complete list of player properties is given in the Player Properties section of this guide.
The Vividas Player <param> values can contain a custom option to modify the param's value.
If ',url' (note the comma) is appended to the parameter's name, the parameter's value will have the current page's base path prepended to it.
For example, the following code will allow the player to load a file for the 'endRedirectURL' parameter from a location relative to the web page.
<param name="endRedirectURL,url" value="redirect.html"/>
If ',preload' is appended to a parameter name, the file described by the parameter's value is downloaded and cached on the user's system during the player initialisation stage. ',preload' automatically implies ',url' and will automatically convert a relative URL to an absolute URL, if required.
For example, the following code will preload and cache a file for the 'skin' parameter, so that it can be reused by the player without additional downloads.
<param name="skin,preload" value="customskin.jpeg"/>
The Vividas Player <object> tag is written in part by the javascript function startPlayerObjectTag
. Part of what is written is the 'codebase' parameter that instructs the browser to install
the plugin from a player.vividas.com URL. The player.vividas.com webserver responds with a platform and browser
specific plugin installation package (eg .xpi for Firefox, .dmg for Safari on Mac) to allow the browser to install
and/or run the Vividas Player.
![]() | Note |
|---|---|
The player.vividas.com and update.vividas.com domain names MUST resolve to a valid IP address and be reachable from the deployed network for the Vividas Player to operate correctly. |
If plugin installation is blocked in the browser a standalone installer is available (.exe on Windows, .dmg on MacOS). The standalone installer can be downloaded from http://player.vividas.com/download.php?installer=true. The web browser will require restarting to complete standalone installation.
![]() | Note |
|---|---|
The download of the Vividas Player installer intelligently selects which package to download, depending on the browser and operating system that downloads it. If redistributing this package across multiple workstations, then the correct package should be selected and downloaded for the particular workstation. Contact Vividas if further help is required. |
For the web browser to install the Vividas Player plugin, they require installation (administrator) privileges. If installation privileges are not available, the user's system administrator can deploy the Vividas Player plugin using the standalone installer.
Plugin installation is a once only process. After installation, the player automatically downloads updates from update.vividas.com. To request a specific player version update for use in a web page, the sdkVersion <param> tag can be used to lock the player version.
To lock the Vividas Player version to a particular version of the SDK, replace the sdkVersion <param> tag with the following. Be sure to alter the value to the version number required.
<param name="sdkVersion" value="4.0.5"/>
The Vividas Player will resize to almost any space that is allocated to it on a web page. To fit the allocated size, the Vividas Player allocates a fixed size for the "skin" (if displayed) and resizes the video to maintain aspect ratio. The height for the default "skin" is 30 pixels.
To maintain aspect ratio the Vividas Player adds black bars or "dead space" either to the sides or to the top and bottom of the media. These are generally not desirable as they are poor usage of screen real estate.
To prevent black bars from being displayed, the optimal player dimensions should be calculated. The optimal player dimensions are the native size of the footage plus the size required for any skin (if displayed). This will provide the optimal player dimensions.
The quickest way of obtaining the native player size is to enter the following javascript code into URL bar of a browsers window and press enter, while the required media is playing. It will display an alert with the native width and height of the media.
javascript:alert("w: "+getPlayerObject().getProperty("frameWidth")+"h: "+getPlayerObject().getProperty("frameHeight"));Alternatively to get the native size of the footage from a web page can be achieved by creating a test page with the Vividas Player and adding the following code to the <BODY> section.
<h2><a href="javascript:NativeDimensions();">Get Native Video dimensions</a></h2>
Next, add the following code to the <HEAD> section of the web page. Be sure to change the MediaURL to the media you are putting into your page and make sure the player is playing prior to clicking the link.
<script type="text/javascript">
<!--
function NativeDimensions()
{
var text = 'The native dimensions are width:' +
getPlayerObject("vivPlayer").getPropertyInt("frameWidth") +
' height:' +
getPlayerObject("vivPlayer").getPropertyInt("frameHeight") ;
alert(text) ;
}
-->
</script>To learn more about the Vividas Player and its capabilities see the Further Information about the Vividas Player section of this document.
Vividas Player version 3.5.x and earlier used javascript to insert the entire player object into the web page. This is similar to the new PREFERRED method of integrating the Vividas Player into a web page, however the complete <object> tag rewrite technique has been replaced by the new partial <object> tag writing method. Existing supporting functions have been retained in the 4.x branch of the SDK to enable simple upgrading from the Vividas Player SDK versions 3.5.x and earlier.
An example of the Vividas Player version 4.x supporting a version 3.5 web page implementation is provided in the file 'tests/deprecated_index.html' contained in the SDK. (see this section for how to get the SDK)
Upgrading an existing website to the latest SDK (PREFERRED method) can be performed as follows.
Add the following include into the <head> section of the web page.
<script type="text/javascript" src="scripts/core/insert_api.js"></script> <script type="text/javascript" src="scripts/core/java.js"></script>
So it appears as follows; (the order is significant).
<script type="text/javascript" src="scripts/core/api.js"></script> <script type="text/javascript" src="scripts/core/insert_api.js"></script> <script type="text/javascript" src="scripts/core/java.js"></script>
Copy the contents of the Vividas Player SDK 4.x "player", "images" and "scripts" folder into the existing folders on the web site to be upgraded. Be sure to overwrite any existing files.
![]() | Note |
|---|---|
Preload messages are no longer supported by the Vividas Player SDK version 4.x and later. The function
|
![]() | Note |
|---|---|
If the web page contains any player object calling methods (that directly reference getPlayerObject()) then these will need to be upgraded to use the new player properties and commands. Refer to Vividas Player Javascript API for more information. |
![]() | Important |
|---|---|
Vividas recommends that any upgraded web site be fully tested prior to deploying to a live webserver. |
Prior to Vividas Player SDK 4.x release, the PlayerInstanceOptions javascript object was used to pass parameters
into the player. This has been depricated in version 4.x. Any Vividas Player SDK 3.5.x sites using this
object will require upgrading to using the setProperty() API present in version 4.x. The
setProperty() is described in section
Player Properties. See playPressedImpl() in api.js for a detailed example.
Javascript Playlist Support is deprecated (eg appendToPlaylist()), please see section
Vividas Media Formats for more information about playlists.
This section contains further information about the capabilities of the Vividas Player. In particular it contains information about programming the Vividas Player from javascript, the media formats the Vividas Player Supports and Player events.
The Vividas Player has 5 distinct states when present on a web page. These are as follows;
| State Name | Description |
|---|---|
| Uninitialised | This is when the Vividas player has either been not installed or not run (no security prompt accepted). There is no programmatic way of communicating with the player in this state, as it is not yet running. |
| Initialising | After the security prompt has been accepted and the player installer or Java applet has been given permission to run, then this is the state the Vividas Player enters. Here it downloads the required files for it to play media (player library) and to display correctly (skin files, background images etc). It also caches files at this point. |
| Loaded | After the initialisation is complete the Vividas Player enters the Loaded state. At this point it is waiting and able to play media. Alternatively if auto play has been set, it will skip straight to the Starting state. |
| Starting | This is the state where the Vividas Player attempts to download and playback Media. If it is downloading a playlist (see this section) it will download the list and then attempt to download the correct file. If it has been provided a file set, it will determine the correct bit rate to download. If it has been given a VivRights (see below) protected piece of media, it performs media authorisation. |
| Playing | The player has successfully downloaded and is decoding and presenting media. |
![]() | Note |
|---|---|
VivRights is another Vividas Product. It provides conditional viewing of .viv files, by requiring that the Vividas Player to obtain permission to decode a piece of media. Please contact Vividas for more information on this product. |
![]() | Important |
|---|---|
The following section is written for web developers, and it is assumed that the reader has a reasonable knowledge of HTML, Document Object Models (DOMs) and javascript. |
The Vividas Player is a well featured video player that has two levels of interfaces to configure and control the player.
There is a simple interface provided when the 'scripts/core/api.js' included in the web page. This file can be included manually (see below) and it is included by default with the PREFERRED method of implementation. This interface only operates for one video player instance per web page. See section Simple Playback Control using api.js for more information.
The Vividas Player Javascript Object contains a complete interface that permits configuring all settings of the Vividas Player. It requires considerable programming knowledge to use this interface, however full details are provided in the section Vividas Player Javascript API.
The 'scripts/core/api.js' support file included with the Player SDK contains convenient functions for starting playback and controlling the player. The sample host page tests/index_tests.html provides examples for using the functions in api.js. The first step is to include the api.js file. This is done as follows;
<script type="text/javascript" src="scripts/core/api.js"></script>
The functions are used to control a single player object on the host page that has the id 'vivPlayer'
Once playback has commenced, the following methods are available for controlling playback
| Function | Description |
|---|---|
| playPressed() | Start playing media. |
| stopPressed() | Stop the player |
| pausePressed() | Pause playback |
| resumePressed() | Resume playback |
| seekForward(milliseconds) | Skip forward by the offset in milliseconds |
| volumeIncreasePressed() | Increase the volume by 10% |
| volumeDecreasePressed() | Decrease the volume by 10% |
| fullscreenPressed() | Toggle the player between windowed and fullscreen playback |
![]() | Note |
|---|---|
This method and direct calls to the Vividas Player described in the section Vividas Player Javascript API are not mutually exclusive and can be combined on the same web page. |
![]() | Note |
|---|---|
This section is to be read in conjunction with the playlist documentation if you are planning on using playlist files. To read the playlist documentation, either read the file doc/sdk_playlist_guide.html from the Vividas Player SDK, or to view online, follow this link sdk_playlist_guide.html. |
The Vividas Player object plays media streams in '.viv' format. The player accepts single media files, or multiple media files in a playlist. The media types and the properties used to configure the media are:
On Demand .viv file - pre-encoded media file loaded from URL or local file. This media is selected with the player's 'mediaURL' property (parameter).
Live Stream .viv file - live streaming encoded media loaded from a URL (local file not supported). This media is selected with the player's mediaURL property (parameter).
Playlist XML file - One or more pieces of media described in an XML file conforming to the Vividas Playlist schema, loaded from a URL or local file. See sdk_playlist_guide.html included with the SDK for creating playlists using XML. This media is selected with the player's mediaURL property.
Playlist XML string - A javascript string containing a Vividas playlist XML structure, allowing playlists to be dynamically created in javascript. This media is selected using the player's playlistXML property.
The Vividas Player component can generate events when initialisating and playing that are sent to predefined javascript methods within the host page. A default implementation is included for convienience in scripts/core/api.js, and can be included if needed. If the javascript methods do not exist, a javascript runtime error is likely to be generated. Vividas Player events are enabled by default and can be disabled by setting the 'playerEvents' parameter to 'false' in the player object parameters.
Events include the HTML 'id' of the player object as a parameter, to handle events from multiple players.
![]() | Note |
|---|---|
Example implementations of these event handler functions are included in the 'scripts/optional/tests.js' source file. |
For details of specific events see section Player Events
The Vividas Player API are the methods exposed by the Player javascript object. These methods can be used to configure the player or to request the player perform an action. The Vividas Player has three sets of methods;
A "helper" group of methods that are a subset of the complete methods. These are provided for easy readability and simple understanding. Refer section Helper Methods
The Vividas Player also has a "complete" set of methods that provide full access to all the functionalities that
the player provides to the web browser. These APIs use three methods - getProperty(),
setProperty() and doCommand(). Refer section
Complete Player Interface Methods
A small set of functions that only provide information whilst the player is initialising. Refer section Initialisation Methods
The following section provides some examples of how to use the Vividas Player Javascript APIs
![]() | Note |
|---|---|
The test folder in the Vividas Player SDK archive contains other examples to demonstrate how various features of the Vividas Player can be integrated into a web page. |
To be able to interface with the player or instruct it to perform a command, firstly its javascript object has to be retrieved from the HTML Document Object Model (DOM). This is achieved as follows;
<script type="text/javascript">
var playerObject = document.getElementById('vivPlayer');
</script>The player object's properties are then configured, and playback started using setProperty() and
doCommand(). A property configured using setProperty() overrides the value set in the
player's object <param> tags. For example:
function play() {
var playerObject = document.getElementById('vivPlayer');
playerObject.setProperty("mediaURL","http://video.vividas.com/content.viv");
playerObject.setProperty("fullscreen", true);
playerObject.doCommand("playClip"); // or playerObject.playClip();
}The player can be controlled during playback using doCommand(). Many commands include a player
object helper method (eg pause)
function pause() {
var playerObject = document.getElementById('vivPlayer');
playerObject.doCommand("pause"); // or playerObject.pause();
}The player can be queried during playback for media properties or playback status using getProperty().
function getFrameRate() {
var playerObject = document.getElementById('vivPlayer');
return playerObject.getProperty("frameRate");
}The helper methods expose simple method names for common player commands.
| Method | Description |
|---|---|
| terminate() | Stop playback, equivalent to doCommand('terminate') |
| playClip() | Start playback, equivalent to doCommand('playClip') |
| pause() | Pause playback, equivalent to doCommand('pause') |
| resume() | Resume playback, equivalent to doCommand('resume') |
| toggleFullscreen() | Toggle between fullscreen and windowed playback, equivalent to doCommand('toggleFullscreen') |
| fastForward() | Fast forward playback, equivalent to doCommand('fastForward') |
| resetProperties() | Reset the player settings to the initial values set by the player object's <param> tags, equivalent to doCommand('resetProperties') |
The basic methods set and get player properties, and perform player commands. See Player Properties and Player Commands for a list of available names used by these methods.
| Method | Description |
|---|---|
| setProperty(name,value) | Set the player property 'name' to the supplied value. The value may be of any type (eg string, integer, boolean) as the player automatically converts the supplied javascript value to the correct type. |
| getProperty(name) | Get the player property 'name' as a string value |
| getPropertyInt(name) | Get the player property 'name' as an integer value |
| getPropertyInt64(name) | Get the player property 'name' as a 64bit integer value |
| getPropertyBoolean(name) | Get the player property 'name' as a boolean value |
| getPropertyDouble(name) | Get the player property 'name' as a double value |
| doCommand(name) | Perform the player command 'name' |
The inialisation methods are used during player installation and upgrade, and enable monitoring of the player.
| Method | Description |
|---|---|
| getLoadingProgress() | Get the download progress of the player library as a percentage [0..100] |
| getLoadingErrorCode() | Get the internal error code, returns '0' if no error. Error codes are described in scripts/core/errormessges.js. |
| getLoadingErrorString() | Get the internal error message, returns empty string if no error. |
| getVersionString() | Get the SDK version string |
| doEventPolling() | Query the player for events (required by Opera). see checkLoad() in scripts/core/api.js |
This section details the commands that are supported by the player's 'doCommand(name)' API
For more information on how to actually write the javascript to perform the calls to do commands on the Vividas Player, see section Vividas Player Javascript API
| Command | Description |
|---|---|
| playClip | Start playing media |
| terminate | Stop playing media |
| pause | Pause media playing |
| resume | Resume media playing |
| fastForward | Fast forward playing media |
| seekForward | Seek forward by the duration specified by the 'seekOffsetMS' property (defaults: 2500ms) |
| seekBackward | Seek backwards by the duration specified by the 'seekOffsetMS' property (defaults: 2500ms) |
| seekToLiveStream | Seek to the head of the live stream if seeking is enabled |
| advancePlaylist | Skip to the next entry in a playlist |
| externalMediaComplete | Notify the player when external media has completed (see
onExternalMedia() for more information)
|
| toggleFullscreen | Toggle between fullscreen and windowed playback. This command can also be replicated with the property "fullscreen" see section Loaded and Running Properties |
| increaseVolume | Increase the volume by 10 percent. This command can also be replicated with the property "volume" see section Loaded and Running Properties |
| decreaseVolume | Decrease the volume by 10 percent. This command can also be replicated with the property "volume" see section Loaded and Running Properties |
| resetProperties | Reset the player settings to their default values set by the player object's <param> tags |
This section details the properties that can be used to configure the player. The properties are classified into three groups:
Initialisation Properties that configure the player via a <param> statement within the <object> tag in the HTML that inserts the Vividas Player into a web page. See section; Initialisation Properties
Loaded and Running properties. If these properties are writable they can be set via setProperty() or
using the player's <param> tag values. If these properties are readable then they can be obtained by querying the
player's getProperty() method. Some of these properties require setting prior to the player
entering the playing state. This is explained further in section; Loaded and
Running Properties
Playing (only) properties can configure the Vividas Player via setProperty() when the Player is
Starting or Playing. Readable properties will return values via the getProperty() only when the player is
Starting or Playing. They will return 'undefined' if called when the player is in the "Loaded" or "Initialising"
states. See section Playing (Only) Properties for more informatrion.
For more information on how to actually write the javascript to perform the calls to set the properties or write the param values to configure the Vividas Player, see section Vividas Player Javascript API
The following properties can only be set via the player object HTML <param> parameters
| Property | Type | getProperty | setProperty | param | Description |
|---|---|---|---|---|---|
| sdkVersion | string, required | No | No | Yes | Control the version of the Vividas Player SDK to use for playback. This is used to lock the player to a specific version. If the value is 'current', the player uses the latest SDK available from Vividas (default is 'current') |
| backgroundImage | string | No | No | Yes | Set the jpeg image to display in the player area when the player is idle. The image must be a simple progressive encoded jpeg image, and the URL path may be absolute or relative to the host page. |
| resourcesURL | string | No | No | Yes | Override the default player text resources with a custom resource bundle provided by Vividas. This may be used for specific error messages, or internationalisation. The URL path may be absolute or relative to the host page. |
| splashURL | string | No | No | Yes | Customise the splash screen resource bundle to display while the player is loading media. The URL path may be absolute or relative to the host page. The splash screen resource format has been updated in SDK 4.0.5 |
| errorHandler | string | No | No | Yes | Configures the javascript function name to receive player error messages, see onPlayerError event. The player displays a system message box by default. Requires playerEvents = true |
| autoplay | boolean | No | No | Yes | Control the automatic playback of media after the player object has initialised. When true, the player will automatically play the media specified by the 'mediaURL' or 'playlistXML' property (default is false) |
| playerEvents | boolean | No | No | Yes | Control the generation of javascript events from the player object (default is true) |
These properties configure the Vividas Player after it is loaded and prior to playing. All the writeable parameters can be set at run time, however only a few will be recognised by the player while playing. These parameter types are denoted as "cached". If the parameters are written to when the player is playing, then they are cached until the next time the player is restarted or the media changes in a playlist. If a parameter is read, then the last written parameter is returned.
| Property | Type | getProperty | setProperty | param | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mediaURL | string | Yes (cached) | Yes (cached) | Yes | A URL of a .viv file or playlist file. Setting this property resets the playlistXML property. | |||||||||
| playlistXML | string | Yes (cached) | Yes (cached) | Yes | An XML string containing a complete playlist. Setting this property resets the mediaURL property. | |||||||||
| skin | string | No | Yes (cached) | Yes |
Used to customise the player skin resource bundle that contains the player pause bar and other player GUI elements. Possible values are;
| |||||||||
| clientID | string | No | Yes (cached) | Yes | The client identifier for VivRights protected media. | |||||||||
| endRedirectURL | string | Yes (cached) | Yes (cached) | Yes | Set the URL to open in a new browser tab or window when media playback has completed. This command is completed when the player returns to the loaded state. | |||||||||
| clickRedirectURL | string | Yes | Yes | Yes | Set the URL to open in a new browser tab or window when the media is clicked. | |||||||||
| googleAnalyticsTracker | string | No | Yes (cached) | Yes | The name of the javascript object created for Google Analytics statistics collection. This requires a Google Analytics account, contact Vividas for further information. | |||||||||
| googleAnalyticsSettings | string | No | Yes (cached) | Yes | Control the interval and threshold times for Google Analytics statistics collection. A comma separated list of timing values expressed in seconds, where the UD prefix sets the repeating update interval (default: 120), numerical values set threshold events sent once per clip, and END sets a threshold event 3 seconds before the clip completes. (eg UD30,10,20,END) | |||||||||
| splashDelay | integer | Yes (cached) | Yes (cached) | Yes | Minimum duration to display the splash screen in milliseconds (default: 0) | |||||||||
| prebufferMS | integer | Yes (cached) | Yes (cached) | Yes | Minimum duration of video data to initially pre-buffer from the playback stream in milliseconds (default: 4000) | |||||||||
| playbackStatus | integer | Yes | No | No |
Status feedback that returns the current player state. Possible values are:
| |||||||||
| fullscreenViewMode | integer | Yes (cached) | Yes (cached) | Yes |
Alters the display area of the fullscreen window. Available values are:
| |||||||||
| volume | integer | Yes | Yes | Yes | The current playback volume as a percent of system volume (default: 100) | |||||||||
| skinDisplay (media embedded skins) pauseBarDisplay (URL loaded skins) | integer | Yes (cached) | Yes (cached) | Yes |
Change the visibility of the player skin in windowed or fullscreen mode. Available options are:
| |||||||||
| seekOffsetMS | integer | Yes | Yes | Yes | This sets the time jump in milliseconds when 'seekForward' or 'seekBackward' is requested. (default: 2500) | |||||||||
| startFrame | 64bit Int | Yes (cached) | Yes (cached) | Yes | The frame number to start playback of the media from. This is ignored if the media is a playlist. It is only read when commencing media playback. | |||||||||
| endFrame | 64bit Int | Yes (cached) | Yes (cached) | Yes | The frame number that marks the end of the media. This is ignored if the media is a playlist. It is only read when commencing media playback. | |||||||||
| escapeExitFullscreen | boolean | Yes (cached) | Yes (cached) | Yes | Change the behaviour of the player when the Escape key is pressed while fullscreen. When true, the player will return to popup or embedded mode when the escape key is pressed. When false, the player will stop if the escape key is pressed while fullscreen. (default: true) | |||||||||
| seekable | boolean | Yes (cached) | Yes (cached) | Yes | Control the seek range of the player. When true, the player can seek to any valid media time. When false, the player can only seek to a media time that is currently buffered in memory (default: false) | |||||||||
| fullscreen | boolean | Yes | Yes | Yes | Control the windowed or fullscreen state of the player. (default: false) | |||||||||
| autoPlayCompletedLiveStream | boolean | Yes (cached) | Yes (cached) | Yes | This parameter controls the prompt that notifies the user that they are watching an archived live stream, as opposed to a live stream. If false, the user is prompted, unless a start frame is specified (default: false) | |||||||||
| embedded | boolean | Yes (cached) | Yes (cached) | Yes | Control the embedding of the player within the browser when not playing fullscreen. If true, the player displays within the browser window. If false, the player displays in a popup window (default: true) | |||||||||
| windowSwitchable | boolean | Yes (cached) | Yes (cached) | Yes | Control the viewer's ability to switch between fullscreen and windowed playback (default: true) | |||||||||
| showSplashScreen | boolean | Yes (cached) | Yes (cached) | Yes | Control whether to display the splash screen resource specified by 'splashURL' when the player is loading (default: true) | |||||||||
| clickPlay | boolean | Yes (cached) | Yes (cached) | Yes | Control whether to start playback when the loaded player background is clicked. If true, clicking the player background while the media is loading (splash screen is displayed) will stop the media loading. (default: true) |
The following properties can only be set or retrieved by the player object's setProperty() and
getProperty() methods when the player is starting or playing a video. If the player is stopped, the
properties return 'undefined'. Properties pertaining to playlists have been separated below.
| Property | Type | getProperty | setProperty | Description |
|---|---|---|---|---|
| movieLoadPercent | integer | Yes | No | The progress percent value [0..100] when media is loading and playback is commencing. |
| bufferLevel | integer | Yes | No | The amount of data in the internal stream buffer as a percentage of buffer size [0..100] |
| currentRate | integer | Yes | No | The detected download bitrate in bits per second. |
| mediaRate | integer | Yes | No | The predefined bitrate of the currently playing media in bits per second |
| frameWidth | integer | Yes | No | The native video width of the currently playing media |
| frameHeight | integer | Yes | No | The native video height of the currently playing media |
| currentFrame | 64bit Int | Yes | Yes | When retrieved this provides the current video frame being displayed. When set the stream seeks to the requested frame number (if seeking is enabled). |
| totalFrames | 64bit Int | Yes | No | The duration of the media in frames. For live streams, this value will increase as the stream is downloaded. |
| msPlayed | 64bit Int | Yes | No | The offset in milliseconds of the current frame from the start of the media. |
| frameRate | double | Yes | No | The frames per second of the current media. |
| utcStreamTime | double | Yes | Yes | When retrieved, this is the time value of the currently playing stream. For Live streams, UTC stream time is the stream creation time measured in seconds from 1970. This corresponds to the javascript Date() value clock. For On Demand streams, UTC stream time is the time in seconds relative to the start of the media. When set this causes the player to seek to the requested time (if seeking is enabled) |
| skinMessage | string | No | Yes | New feature, not complete. Each element in a player skin can be named and this function can send a message to each named skin element. The syntax of the command is "name|attribute|value". And currently only updating text items is supported. |
Playing properties pertaining to playlists and playlist functionality.
| Property | Type | getProperty | setProperty | Description |
|---|---|---|---|---|
| playlistMediaURL | string | Yes | No | This retrieves the URL of the .viv media file being currently played when playing an XML playlist. |
| playlistMediaType | string | Yes | No | The MIME type of the active Playlist File item when playing an XML playlist, if specified in the playlist. The MIME type is empty by default. |
| playlistMediaText | string | Yes | No | The Text data of the active Playlist MediaItem when playing an XML playlist, if specified in the playlist. The text is empty by default. |
| playlistSequenceID | string | Yes | Yes | The 'id' of the active SequenceItem when playing a playlist. When this property is set, the media switches to the SequenceItem with the requested 'id', if the SequenceItem is of type primary, append or onrequest. |
| playlistSequenceText | string | Yes | No | The Text data of the active Playlist SequenceItem when playing an XML playlist, if specified in the playlist. The text is empty by default. |
| clickedPlaylistMediaURL | string | Yes | No | The playlistMediaURL active when the player was last clicked |
| clickedPlaylistMediaType | string | Yes | No | The playlistMediaType active when the player was last clicked |
| clickedPlaylistMediaText | string | Yes | No | The playlistMediaText active when the player was last clicked |
| clickedPlaylistSequenceID | string | Yes | No | The playlistSequenceID active when the player was last clicked |
| clickedPlaylistSequenceText | string | Yes | No | The playlistSequenceText active when the player was last clicked |
| appendPlaylistXML | string | No | Yes | A playlist XML snippet to be appended to a currently running playlist |
Example implementations of these event handler functions are included in the 'scripts/optional/tests.js' source file. The following table documents the predefined events that the player can generate.