Player Tutorial

The Player object allows playback, control and modification of broadcast streams. Audio, visual, stream details, and error returns can all be fine-tuned using this object.

Overview

Audience

This tutorial is intended for application developers who need to use the player object or display video content as part of their application. The reader is expected to be familiar with HTML, JavaScript programming, and the OpenTV OS CCOM API. The reader is also expected to be familiar with XML, root-and-branch directory structures, and general object-oriented software programming principles.

Purpose

This tutorial:

  • Outlines a step-by-step process for using the player manager and player object
  • Outlines a step-by-step process for enabling an application to display a video
  • Describes several common use cases
  • Includes sample code

Using the Player Object

In order to understand how the player object works in conjunction with the player manager object, a Complete Code Sample is included and sections of it will be discussed in some detail.

The sample code does the following:

  1. Creates a player manager object.
  2. Registers events for the player manager object using the addEventListener() method.
  3. Using the player manager object, a player object instance is created.
  4. Registers events for the player object using the addEventListener() method.
  5. Uses the created player instance to call player methods.
  6. Accesses the created-player instance properties.

These actions are described in greater detail in the following sections.

Step 1: Create a player manager object

The first step in accessing the player object is to create a player manager object, which then creates and helps control the player object.

The initialization function does this in a straightforward way:

function init()
    {
    CCOM = document.getElementById("CCOM");
    // get a reference to the objects
    var playerMan = CCOM.PlayerManager;

Here, the code generates a new player manager object, which is named playerMan.

Step 2: Register player manager object events

Next, the code registers all possible Player Manager object events.

playerMan.addEventListener("onPlayerInstanceCreated",onPlayerInstanceCreated);
playerMan.addEventListener("onPlayerInstanceCreateFailure",onPlayerInstanceCreateFailure);
playerMan.addEventListener("onPlayerInstanceDestroyed",onPlayerInstanceDestroyed);
playerMan.addEventListener("onPlayerInstanceDestroyFailure",onPlayerInstanceDestroyFailure);

Refer to the Player Manager object documentation for a full description of its events and methods.

Step 3: Define actions for the events.

When events occur they are handled by the respective event handler registered using addEventListener() in Step 2.

onPlayerInstanceCreated = function(e)
    {
    addText("onPlayerInstanceCreated event received");
    addText("-------- onPlayerInstanceCreated----------");
    addText("Connection:" + e.playerInfo.connection);
    addText("ObjectPath:" + e.playerInfo.objectPath);
    addText("Interface:" + e.playerInfo.interface);
    addText("destUri:" + e.playerInfo.destUri);
    }

onPlayerInstanceCreateFailure = function(e)
    {
    addText("onPlayerInstanceCreateFailure event received" + e.destUri);
    }

This code snippet shows how the application processes events from the Player Manager object. The "e" object contains additional details about each event, depending on the event itself (refer to the Player Manager documentation for more details). The addText() function prints the event details to terminal for illustrative purposes.

Step 4: Get a player object instance

After the Player Manager object is created and its events registered, it is time to use it to create a player object.

function getInstance()
    {
    var res;
    res = playerMan.getInstance({destUri: "display://0"});
    if(res.error)
        addText("Failed to getInstance: " + res.error.domain + res.error.name + res.error.message);
    else
        {
        var playerInst;
        playerInst = res.instance;
        }
    }

This code uses the Player Manager object method getInstance to create a player instance for the specified destination URI, which is “display://0”.

If there is no problem in creating the player instance, it is set equal to playerInst.

Step 5: Register player events

Analogous to registering the Player Manager object events in step 2, events for the player instance must be registered.

playerInst.addEventListener("onPlayStarted",onPlayStarted);
playerInst.addEventListener("onPlayStopped",onPlayStopped);
playerInst.addEventListener("onPlayError",onPlayError);
playerInst.addEventListener("onPlayStartFailed",onPlayStartFailed);
playerInst.addEventListener("onPlayStopFailed",onPlayStopFailed);
playerInst.addEventListener("onStreamStarted",onStreamStarted);
playerInst.addEventListener("onStreamStopped",onStreamStopped);
playerInst.addEventListener("onStreamError",onStreamError);
playerInst.addEventListener("onStreamStartFailed",onStreamStartFailed);
playerInst.addEventListener("onStreamStopFailed",onStreamStopFailed);

This is a partial list of player events registered with addEventListener().

Step 6: Use the player instance to call player methods

The Player instance can now be used to call various Player methods. The OK and Failed events can be registered for each method, and used to find out if the method call succeeded or not.

In the following sample, setStreamControlOK and setStreamControlFailed events are registered for the setStreamControl() method, and then the setStreamControl() method is called, with a command string (dvb_st) and data object (hide is set to be true).

The code also collects error messages and indicates whether the method succeeded.

function setStreamControl()
    {
    playerInst.addEventListener("setStreamControlOK", function(e)
        {addText("setStreamControlOK recieved");});
    playerInst.addEventListener("setStreamControlFailed", function(e)
        {addText("setStreamControlFailed recieved");});
    res = playerInst.setStreamControl("dvb_st", {hide: true});
    if(res.error)
        addText("Failed to setStreamControl: " + res.error.domain + " " + res.error.name + 
            " "+ res.error.message);
    else
        addText("-------------Success calling setStreamControl-------------");
    }

In a similar way, the stop() method is called in the following code snippet, and stops the stream currently being played.

function stop()
    {
    playerInst.addEventListener("stopOK", function(e){addText("-------------stopOK
        recieved-------------");});
    playerInst.addEventListener("stopFailed", function(e){addText("~~~~~~~~~~~~~~ stopFailed
        recieved ~~~~~~~~~~~~~~");});
    playerInst.stop();
    }

Again, the method is registered for its OK/Failed event, and the method call is made. As stop() does not take any input parameters, it is left empty.

Step 7: Access the Player instance properties

The various properties of the player instance are retrieved and displayed as in the following sample code.

function getOtherProperties()
    {
    var playerList = playerMan.playerList;
    addText("PlayerManager: playerList = " + playerList.length);
    [...]

    addText("Player: destUri = " + playerInst.destUri);
    addText("Player: sourceUri = " + playerInst.sourceUri);
    addText("Player: speed = " + playerInst.speed);
    addText("Player: buffer Level = " + playerInst.bufferingLevel);
    addText("Player: position = " + playerInst.position);
    addText("Player: duration = " + playerInst.duration);

Here the player instance calls various properties and displays them: destUri (the current destination URI of this player), sourceUri (the current source URI of the content being played), speed, bufferingLevel, etc. They are added to the display string vis addText along with a label (“Player: destUri =”) etc.

How to access a live stream from a Player instance

If you have an application which needs to grab control of a live stream from a current player instance, use the following procedure.

First, get the existing player instance using the get_instance() method, and give an existing player instance the same destination URI. For example:

var playerInst, dupPlayerInst;
res = playerMan.getInstance({destUri: "display://0"});
playerInst = res.instance;
res = playerMan.getInstance({destUri: "display://0"});
dupPlayerInst = res.instance; 

Both playerInst and dupPlayerInst are now pointing to the same instance in OpenTV OS, and dupPlayerInst can be used to stop the stream.

How to collect analytics about bitrate changes

If an application which needs to collect analytics about bitrate or resolution changes, use the following procedure.

The application can get a player instance using the example above. With that player instance you can register an action with the onContentProfileChanged event and parse the data provided in the action. For example:

playerInst.addEventListener("onContentProfileChanged",onContentProfileChanged);

onContentProfileChanged = function(e){
        addText("-------------onContentProfileChanged-------------");
        addText("height  = " + e.contentProfileChangedInfo.height);
        addText("width   = " + e.contentProfileChangedInfo.width);
        addText("bitRate = " + e.contentProfileChangedInfo.bitRate);
}

How to get notification when the capping bitrate specified is lesser than the least available bitrate of the content

Limiting the bandwidth usage based on the video window size during streaming of Dash/HLS/MSS content is the OTT profile capping feature. When the capping bitrate specified is lesser than the least available bitrate of the content, application can get notified by registering to the onCappingBitrateNotAvailable event from Player as below:

playerInst.addEventListener("onCappingBitrateNotAvailable", onCappingBitrateNotAvailable);

onCappingBitrateNotAvailable = function(e){
    alert("Recieved --onCappingBitrateNotAvailable--\n"+"playSessionHandle: " + e.cappingBitrateNotAvailableInfo.playSessionHandle + "\n" +"Capping Bitrate: " + e.cappingBitrateNotAvailableInfo.cappingBitrate + "\n" + "Applied Bitrate: " + e.cappingBitrateNotAvailableInfo.appliedBitrate);
}

How to control the quality of the video played on a given player instance

The application can use player method "setMaxResolution()" to dynamically update the maximum resolution on an ongoing video playback. An example of such a use case would be application limiting the maximum resolution of playback when the window is resized.

Note: The maximum resolution specified here should not exceed the maximum decoder resolution supported on this player instance. The player property, "maxDecoderResolution", can be used to retrieve the maximum supported decoder resolution.

The application can get a player instance using the example above. With the retrieved player instance use the following code while the content is playing.


var res; res = playerInst.setMaxResolution(playerInst.VIDEO_RESOLUTION_1080P); if(res.error) alert("Failed to set max resolution :" + res.error.domain + " " + res.error.name + " "+ res.error.message); else alert("Success calling setMaxResolution()");

How to get the maximum resolution supported from the video decoder.

The application can use the player property "maxDecoderResolution" to get the maximum supported resolution of the video decoder associated with this player instance.

The application can get a player instance using the example above. With the retrieved player instance use the following code while the content is playing.


var resolution; resolution = playerInst.maxDecoderResolution; alert("max resolution supported by video decoder is :" + resolution);

Using Asymmetric Decode Feature

The Asymmetric Decode feature provides the applications the flexibility to specify the type of decoder and maximum resolution cap for a given playback when initiating the playback of the content. The application has an option to choose between a decoder capable of decoding UHD content or a decoder that only supports SD and HD. The application can control asymmetric decoding by specifying desired decoder in the source URI. The source URI specified by "sourceUri", in the play() method, has the format protocol://content?key1=value1&key2=value2....

The key, value pair in the URI are optional parameters. For the asymmetric decode feature the supported keys are "decoderType" and "maxResolution". The maxResolution setting in this key-value pair is applicable only for adaptive content playback (for example: OTT HLS, DASH) and is not applicable for non- adaptive content (for example: broadcast ).

Valid values for decoderType are: SD, HD, UHD. Valid values for maxResolution are: 480, 576, 720, 1080, 2160, 4320.

For the decoderType SD the maxResolution should not exceed 576. For the decoderType HD the maxResolution should not exceed 1080.

The application can get a player instance using the example above. The following example shows the playback is requested with UHD decoder and maximum resolution cap of 2160.


var test = new Array; var obj1 = new Object; var sourceUrl = "http://<path>?decoderType=UHD&maxResolution=2160"; obj1.whence = playerInst.SEEK_SET; obj1.type = playerInst.POSITION_TYPE_TIME_BASED; obj1.timePosition = 0; test[0] ={commandType:playerInst.PLAY_CONTROL_CMD_POSITION, positionCommandData: obj1}; var res; res = playerInst.play(sourceUrl,test); if(res.error) alert("Failed to call play() :" + res.error.domain + " " + res.error.name + " "+ res.error.message); else alert("Success calling play()");

Recommendations for Handling Multi-pipe Scenarios

The following guidelines are recommended for an application that initiates concurrent playback on multiple display pipelines. 1. When invoking playback on a full screen display, the type of decoder capability should be specified as UHD. 1. When invoking adaptive playback on a quarter-screen display, the type of decoder capability should be specified as HD and the resolution cap should be specified as 1080. 1. When invoking non-adaptive broadcast playback on a quarter-screen display, the type of decoder capability should be specified as HD and playback should be initiated on non UHD services only. The existing Service Descriptor information should be used to identify whether a service is UHD capable or not.

NOTE: The unequal capability of video decoders available in a STB will potentially create new use cases that will have to be managed accordingly by relevant components. Consider the use case of the UI displaying broadcast content with review buffer functionality in two display pipes (a full-screen Main pipe and a quarter-screen PiP pipe). Assuming that the UI will request for 4K/UHD decoder only for full-screen displays, some of the corner cases it will have to manage are given below. 1. When starting a broadcast service on the PiP pipe, the application should only choose the non-4K/UHD version of the service to avoid resource conflicts. 1. When toggling the display between the Main and PiP pipes, the UI may have to choose a new implementation option. Some possible options are given below.

  • Option 1. UI could retune to the other channel in each pipe (thus losing the review buffer contents in the process) to implement a pipe swap while keeping the video window location and size for each pipe the same. For example if Main pipe is tuned to Channel 1 and the PiP pipe is tuned to Channel 2, doing a pipe swap would be achieved by retuning to Channel 2 in the Main pipe and retuning to Channel 1 on the PiP pipe.
  • Option 2. UI could resize and reposition the video window for each pipe and continue playback without interruption. On the next channel change in new full-screen pipe it would request a 4K/UHD capable decoder, thus creating a resource conflict and stopping playback on the new quarter-screen pipe as the 4K/UHD capable decoder will now be assigned to the new full-screen pipe.

Video Display Tutorial

Video display is the process of presenting video content as part of an application. In OpenTV OS, video display is available to HTML applications.

In order to display video in an application, use the following procedure:

  1. Create a <video> tag element and configure it to use a specific display pipe.
  2. Use the CCOM PlayerManager object to create an instance of the CCOM Player object to be used with this video tag.
  3. Manipulate the video display size and position via standard <video> tag attributes.
  4. Control the video playback via the CCOM Player object.

These steps are described in greater detail in the following sections, as well as use cases.

Step 1: Create a Video tag

The <video> tag is a standard element supported by HTML5. See the W3C site for full description). It is used to display and control video content inside HTML applications.

In OpenTV OS, the function of the <video> tag is slightly different. Similar to a standard implementation, it creates a rectangular hole in the HTML page where the video appears; however, it is not used to control the actual playback itself (the video tag play/stop/pause methods do not function). Instead, a CCOM Player object is used for playback control and notifications (refer to the CCOM Player documentation for full details).

The <video> tag can be created in two ways, 1) statically declared, or 2) dynamically created by the JavaScript code. Consider the following examples:

  • Statically declared in HTML:

    <video id="videoID" width="1280" height="720" otv-video-destination="display://0" 
        style="position: absolute; top: 0; left: 0;">
    
    <source src="src" />
    Your browser does not support the video tag.
    </video>
    

    These attributes mean:

    • id=”videoID”
      The ID of the video tag. It can be used later by JavaScript to get/set attributes of this video tag element.

    • left:0
      The initial x position of the video rectangle within the HTML page.

    • top:50
      The initial y position of the video rectangle within the HTML page.

    • width="1280" The initial width of the video rectangle within the HTML page.

    • height=”720” The initial height of the video rectangle within the HTML page.

    • src=”src”
      In a standard <video> tag implementation, it specifies the URL of the video file.

    • otv-video-destination
      otv-video-destination is a custom attribute that is used to specify a video destination for the <video> tag to be paired with the CCOM player instance.

  • Dynamically created in HTML: The following code can be used with HTML:

    <HTML>
    ...
    <div id="videodiv">
    <script>
    var aParentElement = document.getElementById("parent0");
    var videoElement = document.createElement("video");
    
    videoElement.setAttribute("id", "video0");
    videoElement.setAttribute("x","0")
    videoElement.setAttribute("y","0")
    videoElement.setAttribute("width", "1280");
    videoElement.setAttribute("height","720");
    videoElement.setAttribute("autoplay", ?true?);
    videoElement.setAttribute("otv-video-destination", "display://0");
    videoElement.setAttribute("src", "src");
    
    aParentElement.appendChild(videoElement);
    </script>
    </HTML>
    

    For the details about each attribute, refer to the “Statically declared in HTML” description.

Note: Because there have been changes to how the <video> tag was implemented in OpenTV OS, OpenTV OS 5.1.1, and OpenTV OS 5.1.2, older applications might not work with the most recent version of the system.

What follows is not a recommended usage of the video tag for new applications, but if you need to modify an application so that is works on 5.0, 5.1.1 and 5.1.2, this is how:

Change from the old format:

<video id="video0" x="0" y="0" width="1280" height="720" xlink:href="display://0"/>

To the new format:

<video id="video0" x="0" y="0" width="1280" height="720" xlink:href="display://0">
<param name="otv-video-destination" value="display://0" />
</video>

Step 2: Associating the Video tag element with the Player object

Once the video tag is created, it must be associated with a specific instance of the CCOM Player object. This is achieved by using the CCOM PlayerManager getInstance() method. The getInstance() method takes destUri as an argument that specifies the name of the display pipe for which the Player object is being requested. This argument ties together the Player object and <video> tag element. Using the “Statically declared in HTML” example in Step 1.

Step 3: Manipulating the video rectangle size and position

To modify the location and size of the video rectangle within the application, use the standard <video> tag attributes as below:

<script>
var d = document.getElementById("videoID");
d.setAttribute("x","200")
d.setAttribute("y","10")
d.setAttribute("width", "166");
d.setAttribute("height","136");
</script>

Step 4: Control video playback via the CCOM.Player object

After the instance of the Player is successfully retrieved, it can be used to control video playback (refer to the CCOM Player documentation for details).

Common use cases (single decoder set-top box)

This section is for set-top boxes that support only one video decoder and thus only one display pipeline. For multiple decoders, see Picture In Picture (PIP) use cases (multiple decoders set-top box), below.

  • Single Video Display:
    This is the most common use of the video display—the main HTML application displays live video.

    Both the video tag's param otv-video-destination and the player instance's destUri PlayerManager.getInstance() methods must be set to the same value display://0. See example above.

  • Multiple Video Displays:
    An application may have multiple video tags associated with different player instances that share the same physical AV decoder.

    First, the application declares two video tags with different param otv-video-destination values:

    <video id="videoMain" x="0" y="0" width="1280" height="720" > <param name="otv-video-destination" 
        value="display://0" /> </video>
    
    <video id="videoSub" x="600" y="25" width="480" height="270" > <param name="otv-video-destination" 
        value="display://1" /> </video>
    
    <script><![CDATA[
    var playerInst1;
    var playerInst2
    
    function getInstance()
        {
        res = playerMan.getInstance({destUri:"display://0"});
        if(res.error)
            {
            addText("Failed to getInstance: " + res.error.domain +
                res.error.name + res.error.message);
            }
        else
            {
            playerInst1 = res.instance;
            }
        res = playerMan.getInstance({destUri: "display://1"});
        if(res.error)
            {
            addText("Failed to getInstance: " + res.error.domain +
                res.error.name + res.error.message);
            }
        else
            {
            playerInst2 = res.instance;
            }
        }
    
    ]]></script>
    

Picture In Picture (PIP) use cases (multiple decoders set-top box)

This section is for set-top boxes with two or more video decoders, allowing them to support multiple display pipelines.

When using a multiple decoder set-top box, an application can have multiple video tags with all videos active at the same time. In this case, all tags will have their own unique display pipe, such as “display://0”, “display://1”, etc.

  • The following example shows what this looks like in practice (an application declares two video tags):

    <video id="videoMain" x="0" y="0" width="1280" height="720" link:href="display://0">
    <param name="otv-video-destination" value="display://0" /> </video>
    
    <video id="videoSub" x="600" y="25" width="480" height="270" link:href="display://1">
    <param name="otv-video-destination" value="display://1" />
    </video>
    

    The application creates two different instances of the Player by using different destURI values, for example destURI0=”display://0” and destURI1=”display://1”.

    The following example shows what this looks like in practice (creating two different player instance using different destURI’s):

    <script><![CDATA[
    //var playerInstMain is defined as main full screen player instance;
    //var playerInstSub is defined as the smaller PIP player instance;
    //var playerInst is defined as current active player instance;
    
    var playerInstMain;
    var playerInstSub;
    var playerInst;
    
    function getInstance()
        {
        res = playerMan.getInstance({destUri: "display://0");
        if(res.error)
            {
            addText("Failed to getInstance: " + res.error.domain + res.error.name +
                res.error.message);
            }
        else
            {
            playerInstMain = res.instance;
            }
    
        res = playerMan.getInstance({destUri: "display://1");
        if(res.error)
            {
            addText("Failed to getInstance: " + res.error.domain + res.error.name +
                res.error.message);
            }
        else
            {
            playerInstSub = res.instance;
            }
        playerInst = playerInstMain;
        }
    
    ]]></script>
    
  • The following example shows how to adjust the video window's Z-order.

    <script><![CDATA[
    function switchZOrder()
        {
        var videoLayerProperties = playerInst.videoLayerProperties;
        if (videoLayerProperties.zorder == playerInst.VIDEO_LAYER_ZORDER_BOTTOM)
            {
            addText("Changing zorder of player instance to VIDEO_LAYER_ZORDER_TOP");
            playerInst.videoLayerProperties = {zorder: playerInst.VIDEO_LAYER_ZORDER_TOP};
            }
        else
            {
            addText("Changing zorder of player instance to VIDEO_LAYER_ZORDER_BOTTOM");
            playerInst.videoLayerProperties = {zorder: playerInst.VIDEO_LAYER_ZORDER_BOTTOM};
            }
        }
    
    ]]></script>
    
  • The following example shows how to adjust the video windows's opacity. When the video window's opacity is set to "0.0", no video is displayed in that window.

    <script><![CDATA[
    function switchOpacity()
        {
        var videoLayerProperties = playerInst.videoLayerProperties;
        if (videoLayerProperties.opacity == 0.0)
            {
            addText("Changing opacity of player instance to 1.0");
            playerInst.videoLayerProperties = {opacity: 1.0};
            }
        else
            {
            addText("Changing opacity of player instance to 0.0");
            playerInst.videoLayerProperties = {opacity: 0.0};
            }
        }
    
    ]]></script>
    
  • The following example shows how to turn on and off an instance of a player’s audio output. When one player instance’s audio output is turned on, all other player instance’s audio output will be turned off automatically.

    <script><![CDATA[
    //var audioStatus is defined as current Main full screen player instance audio output status;
    var audioStatus = 0;
    function switchAudio()
        {
        if(audioStatus == 0)
            {
            playerMan.setAudioStatus(playerInstanceHandleSub,playerMan.AUD_OUT_VAL_FALSE);
            playerMan.setAudioStatus(playerInstanceHandleMain,playerMan.AUD_OUT_VAL_TRUE);
            addText("playerInstMain.audioStatus = "+ playerInstMain.audioStatus);
            addText("playerInstSub.audioStatus = "+ playerInstSub.audioStatus);
            audioStatus = 1;
            }
        else
            {
            playerMan.setAudioStatus(playerInstanceHandleMain,playerMan.AUD_OUT_VAL_FALSE);
            playerMan.setAudioStatus(playerInstanceHandleSub,playerMan.AUD_OUT_VAL_TRUE);
            addText("playerInstMain.audioStatus = "+ playerInstMain.audioStatus);
            addText("playerInstSub.audioStatus = "+ playerInstSub.audioStatus);
            audioStatus = 0;
            }
        }
    
    ]]></script>
    
  • The following example shows how to turn on pretune. In pretune mode, when the foreground pipeline is playing video, the background pipeline will be tuned to next channel and is ready to be switched to front by setting the background video rectangle size, z-order, and opacity.

    <script><![CDATA[
    //var pretuneStatus is defined as current pre-tune status;
    var pretuneStatus = 0;
    function PreTuneOnOff()
        {
        var videoTagElemMain;
        var videoTagElemSub;
        videoTagElemMain = document.getElementById('videoMain');
        videoTagElemSub = document.getElementById('videoSub');
    
        if( pretuneStatus == 0 )
            {
            addText("Now turn on pre-tune....");
            //now full screen the main player and hide the sub player.
            videoTagElemMain.setAttribute("x", 0);
            videoTagElemMain.setAttribute("y", 0);
            videoTagElemMain.setAttribute("width", VIDEO_WINDOW_WIDTH_FULL);
            videoTagElemMain.setAttribute("height", VIDEO_WINDOW_HEIGHT_FULL);
    
            videoTagElemSub.setAttribute("x", 0);
            videoTagElemSub.setAttribute("y", 0);
            videoTagElemSub.setAttribute("width", VIDEO_WINDOW_WIDTH_FULL);
            videoTagElemSub.setAttribute("height", VIDEO_WINDOW_HEIGHT_FULL);
    
            playerInstMain.videoLayerProperties = {zorder:
                playerInstMain.VIDEO_LAYER_ZORDER_TOP,opacity: 1.0};
            playerInstSub.videoLayerProperties = {zorder:
                playerInstSub.VIDEO_LAYER_ZORDER_BOTTOM,opacity: 0.0};
    
            //enable the Main player audio output
            playerMan.setAudioStatus(playerInstanceHandleSub,playerMan.AUD_OUT_VAL_FALSE);
            playerMan.setAudioStatus(playerInstanceHandleMain,playerMan.AUD_OUT_VAL_TRUE);
            addText("playerInstMain.audioStatus = "+ playerInstMain.audioStatus);
            addText("playerInstSub.audioStatus = "+ playerInstSub.audioStatus);
    
            //now tune sub player to next channel
            var obj = new Object;
            var command = new Array;
            var res;
            obj.whence = playerInstSub.SEEK_SET;
            obj.type = playerInstSub.POSITION_TYPE_TIME_BASED;
            obj.timePosition = 0;
            command[0] ={commandType:playerInstSub.PLAY_CONTROL_CMD_POSITION,
                positionCommandData: obj};
    
            res = playerInstSub.play(urls[(currentChannel+1)%urlslength],command);
            if(res.error)
                {
                addText("Failed to playerInstSub.play(): "+urls[(currentChannel+1)
                    %urlslength]+ "Error: "+ res.error.domain + res.error.name +
                    res.error.message);
                }
            else
                {
                addText("Success playerInstSub.play() " +
                    urls[(currentChannel+1)%urlslength]);
                }
            pretuneStatus = 1 ;
            }
        else
            {
            addText("Now turn off pre-tune...");
            playerInstMain.videoLayerProperties = {opacity: 1.0};
    
            //enable the sub video window on the screen
            playerInstSub.videoLayerProperties = {opacity: 1.0};
            videoTagElemMain.setAttribute("x", 0);
            videoTagElemMain.setAttribute("y", 0);
            videoTagElemMain.setAttribute("width", VIDEO_WINDOW_WIDTH_FULL);
            videoTagElemMain.setAttribute("height", VIDEO_WINDOW_HEIGHT_FULL);
    
            //scale the sub video window to a smaller size
            videoTagElemSub.setAttribute("x", 600);
            videoTagElemSub.setAttribute("y", 25);
            videoTagElemSub.setAttribute("width", 480);
            videoTagElemSub.setAttribute("height",270);
            pretuneStatus = 0;
            }
        }
    
    ]]></script>
    
  • The following example shows how to switch between the main video and subvideo in pretune mode.

    <script><![CDATA[
    var pretunetag = 0;
    function playVideoPreTune()
        {
        var videoTagElemMain;
        var videoTagElemSub;
        var playerInstTemp;
        var obj = new Object;
        var command = new Array;
        var res;
    
        obj.whence = playerInstSub.SEEK_SET;
        obj.type = playerInstSub.POSITION_TYPE_TIME_BASED;
        obj.timePosition = 0;
    
        if(pretuneStatus == 1)
            {
            if(pretunetag == 1)
                {
                playerInstMain.videoLayerProperties = {zorder:
                    playerInstMain.VIDEO_LAYER_ZORDER_TOP,opacity: 1.0};
                playerInstSub.videoLayerProperties = {opacity: 0.0};
                playerMan.setReviewBufferState(playerInstanceHandleSub,false);
                playerMan.setReviewBufferState(playerInstanceHandleMain,true);
    
                playerMan.setAudioStatus(playerInstanceHandleSub,playerMan.AUD_OUT_VAL_FALSE);
                playerMan.setAudioStatus(playerInstanceHandleMain,playerMan.AUD_OUT_VAL_TRUE);
                addText("playerInstMain.audioStatus = "+ playerInstMain.audioStatus);
                addText("playerInstSub.audioStatus = "+ playerInstSub.audioStatus);
    
                currentChannel = currentChannel+1;
                command[0] = {commandType:playerInstSub.PLAY_CONTROL_CMD_POSITION,
                    positionCommandData: obj};
                res = playerInstSub.play(urls[(currentChannel+1)%urlslength],command);
                if(res.error)
                    {
                    addText("Failed to playerInstSub.play():
                        "+res.error.domain + res.error.name + res.error.message);
                    }
                else
                    {
                    addText("Success playerInstSub.play() " + 
                        urls[(currentChannel+1)%urlslength]);
                    }
                pretunetag = 0;
                }
            else
                {
                playerInstSub.videoLayerProperties = {zorder:
                    playerInstSub.VIDEO_LAYER_ZORDER_TOP,opacity:1.0};
                playerInstMain.videoLayerProperties = {opacity: 0.0};
                playerMan.setReviewBufferState(playerInstanceHandleMain,false);
                playerMan.setReviewBufferState(playerInstanceHandleSub,true);
    
                playerMan.setAudioStatus(playerInstanceHandleMain,playerMan.AUD_OUT_VAL_FALSE);
                playerMan.setAudioStatus(playerInstanceHandleSub,playerMan.AUD_OUT_VAL_TRUE);
                addText("playerInstMain.audioStatus = "+ playerInstMain.audioStatus);
                addText("playerInstSub.audioStatus = "+ playerInstSub.audioStatus);
    
                currentChannel = currentChannel+1;
                command[0] ={commandType:playerInstMain.PLAY_CONTROL_CMD_POSITION,
                    positionCommandData: obj};
                res = playerInstMain.play(urls[(currentChannel+1)%urlslength],command);
                if(res.error)
                    {
                    addText("Failed to playerInstMain.play():
                        "+res.error.domain + res.error.name + res.error.message);
                    }
                else
                    {
                    addText("Success playerInstMain.play() " +
                        urls[(currentChannel+1)%urlslength]);
                    }
    
                pretunetag = 1;
                }
    
            //addText("playerInstMain.audioStatus = " + playerInstMain.audioStatus);
            //addText("playerInstSub.audioStatus = " + playerInstSub.audioStatus);
            }
        }
    
    ]]></script>
    
  • The following example shows how to enable/disable the review buffer for player instance.
    First, we need register the review buffer-related event listener:

    playerInst.addEventListener("onReviewBufferEnabled",onReviewBufferEnabled);
    playerInst.addEventListener("onReviewBufferEnableFailed",onReviewBufferEnableFailed);
    playerInst.addEventListener("onReviewBufferDisabled",onReviewBufferDisabled);
    playerInst.addEventListener("onReviewBufferDisableFailed",onReviewBufferDisableFailed);
    playerInst.addEventListener("onReviewBufferStarted",onReviewBufferStarted);
    playerInst.addEventListener("onReviewBufferStopped",onReviewBufferStopped);
    

    Second, enable/disable the desired player instance review buffer. Note, there is one and only one player instance review buffer that can be enabled.

    <script><![CDATA[
    function enableReviewBuffer()
        {
        if(playerInst == playerInstMain)
            {
            addText("Enable Review Buffer for Main player instance ");
            playerMan.setReviewBufferState(playerInstMain.instanceHandle,true);
            }
        else
            {
            addText("Enable Review Buffer for PIP player instance ");
            playerMan.setReviewBufferState(playerInstSub.instanceHandle,true);
            }
        }
    
    function disableReviewBuffer()
        {
        if(playerInst == playerInstMain)
            {
            addText("Disable Review Buffer for Main player instance ");
            playerMan.setReviewBufferState(playerInstMain.instanceHandle,false);
            }
        else
            {
            addText("Disable Review Buffer for PIP player instance ");
            playerMan.setReviewBufferState(playerInstSub.instanceHandle,false);
            }
        }
    
    ]]></script>
    

Complete Code Sample

Following is the entire XML code sample (written in HTML), parts of which were explained in greater detail in the previous section.

Following the player tutorial java script example:

<script>
    var KEY_ENTER_ST7108 = 61451;// OK
    var KEY_ENTER_EMULATOR=13; // Enter
    var rteWnd;
    var playerMan;
    var playerInst;
    var playerInst2;
    var playerObjectPath;
    var url1 = "tv://test.2.1.8.S.11570000.45000.1.7.1.0"
    var url2 = "tv://test.2.1.5.S.11570000.45000.1.7.1.0"

    var count = 0;
    var sinetwork;
    var scan_handle;
    var subtitleList = new Array;
    var subtitleCount = 0;
    var videTagElm;

function print_error(e, eventName)
    {
    addText("[" + eventName + "] " + e);
    }

onPlayerInstanceCreated = function(e)
    {
    print_error("onPlayerInstanceCreated event received");
    //addText("-------- onPlayerInstanceCreated----------");
    //addText("Connection:" + e.eventSignal.connection);
    addText("ObjectPath:" + e.playerInfo.objectPath);
    //addText("Interface:" + e.eventSignal.interface);
    //addText("destUri:" + e.eventSignal.destUri);
    }

onPlayerInstanceCreateFailure = function(e)
    {
    print_error("onPlayerInstanceCreateFailure event received" + e.destUri);
    }

onPlayerInstanceDestroyed = function(e)
    {
    addText("-------------onPlayerInstanceDestroyed recieved-------------");
    addText("Connection:" + e.playerInfo.connection);
    addText("ObjectPath:" + e.playerInfo.objectPath);
    addText("Interface:" + e.playerInfo.interface);
    addText("destUri:" + e.playerInfo.destUri);
    }

onPlayerInstanceDestroyFailure = function(e)
    {
    addText("-------------onPlayerInstanceDestroyFailure recieved-------------");
    addText("ObjectPath:" + e.objectPath);
    }

releaseInstanceOK = function(e)
    {
    addText("-------------releaseInstanceOK recieved-------------");
    }

releaseInstanceFailed = function(e)
    {
    addText("-------------releaseInstanceFailed recieved-------------");
    }

onPlayStarted = function(e)
    {
    addText("-------------onPlayStarted recieved-------------");
    addText("Started sourceURI: " + e.contentStartedInfo.sourceUri);
    addText("playSessionHandle: " + e.contentStartedInfo.playSessionHandle);
    }

onPlayStopped = function(e)
    {
    addText("-------------onPlayStopped recieved-------------");
    addText("Started sourceURI: " + e.contentStoppedInfo.sourceUri);
    addText("playSessionHandle: " + e.contentStoppedInfo.playSessionHandle);
    }

onPlayError = function(e)
    {
    addText("-------------onPlayError recieved-------------");
    addText("Error sourceURI: " + e.contentErrorInfo.sourceUri);
    addText("Error reason: " + e.contentErrorInfo.reason);
    }

onPlayStartFailed = function(e)
    {
    addText("-------------onPlayStartFailed recieved-------------");
    addText("Error sourceURI: " + e.contentStartFailedInfo.sourceUri);
    addText("Error reason: " + e.contentStartFailedInfo.reason);
    }

onPlayStopFailed = function(e)
    {
    addText("-------------onPlayStopFailed recieved-------------");
    addText("Error sourceURI: " + e.contentStopFailedInfo.sourceUri);
    addText("Error reason: " + e.contentStopFailedInfo.reason);
    addText("playSessionHandle: " + e.contentStopFailedInfo.playSessionHandle);
    }

onStreamStarted = function(e)
    {
    addText("-------------onStreamStarted recieved-------------");
    addText("Started id: " + e.streamStartedInfo.id);
    addText("Started type: " + e.streamStartedInfo.type);
    addText("playSessionHandle: " + e.streamStartedInfo.playSessionHandle);
    }

onStreamStopped = function(e)
    {
    addText("-------------onStreamStopped recieved-------------");
    addText("Stopped type: " + e.streamStoppedInfo.type);
    addText("playSessionHandle: " + e.streamStoppedInfo.playSessionHandle);
    }

onStreamError = function(e)
    {
    addText("-------------onStreamError recieved-------------");
    addText("Started id: " + e.streamErrorInfo.id);
    addText("Error reason: " + e.streamErrorInfo.reason);
    addText("playSessionHandle: " + e.streamErrorInfo.playSessionHandle);
    }

onStreamStartFailed = function(e)
    {
    addText("-------------onStreamStartFailed recieved-------------");
    addText("Started id: " + e.streamStartFailedInfo.id);
    addText("Error reason: " + e.streamStartFailedInfo.reason);
    addText("playSessionHandle: " + e.streamStartFailedInfo.playSessionHandle);
    }

onStreamStopFailed = function(e)
    {
    addText("-------------onStreamStopFailed recieved-------------");
    addText("Stopped stream type: " + e.streamStopFailedInfo.type);
    addText("Error reason: " + e.streamStopFailedInfo.reason);
    addText("playSessionHandle: " + e.streamStopFailedInfo.playSessionHandle);
    }

onPositionChanged = function(e)
    {
    addText("-------------onPositionChanged recieved-------------");
    addText("positionChangedInfo: " + e.positionChangedInfo.newPosition);
    addText("playSessionHandle: " + e.positionChangedInfo.playSessionHandle);
    }

onPositionChangeFailed = function(e)
    {
    addText("-------------onPositionChangeFailed recieved-------------");
    addText("onPositionChangeFailed: " + e.positionChangeFailedInfo.reason);
    addText("onPositionChangeFailed: " + e.positionChangeFailedInfo.requestedPosition.whence);
    addText("onPositionChangeFailed: " + e.positionChangeFailedInfo.requestedPosition.type);
    addText("onPositionChangeFailed: " + e.positionChangeFailedInfo.requestedPosition.timePosition);
    addText("playSessionHandle: " + e.positionChangeFailedInfo.playSessionHandle);
    }

onSpeedChanged = function(e)
    {
    addText("-------------onSpeedChanged recieved-------------");
    addText("speedChangedInfo: " + e.speedChangedInfo.oldSpeed);
    addText("speedChangedInfo: " + e.speedChangedInfo.newSpeed);
    addText("playSessionHandle: " + e.speedChangedInfo.playSessionHandle);
    }

onSpeedChangeFailed = function(e)
    {
    addText("----------onSpeedChangeFailed recieved----------");
    addText("onSpeedChangeFailed: " + e.speedChangeFailedInfo.requestedSpeed);
    addText("onSpeedChangeFailed: " + e.speedChangeFailedInfo.reason);
    addText("playSessionHandle: " + e.speedChangeFailedInfo.playSessionHandle);
    }

onStreamAvailable = function(e)
    {
    addText("----------onStreamAvailable recieved----------");
    addText("playSessionHandle: " + e.streamsAvailableInfo.playSessionHandle);
    }

onVideoBlanked = function(e)
    {
    addText("----------onVideoBlanked recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onVideoUnblanked = function(e)
    {
    addText("----------onVideoUnblanked recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onAudioMuted = function(e)
    {
    addText("----------onAudioMuted recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onAudioUnmuted = function(e)
    {
    addText("----------onAudioUnmuted recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onVideoBlankFailed = function(e)
    {
    addText(----------onVideoBlankFailed recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onVideoUnblankFailed = function(e)
    {
    addText("----------onVideoUnblankFailed recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onAudioMuteFailed = function(e)
    {
    addText("----------onAudioMuteFailed recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onAudioUnmuteFailed = function(e)
    {
    addText("----------onAudioUnmuteFailed recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onBuffering = function(e)
    {
    addText("----------onBuffering recieved----------");
    addText("bufferingInfo: " + e.bufferingInfo.percentBuffered);
    addText("playSessionHandle: " + e.bufferingInfo.playSessionHandle);
    }

onSignalLoss = function(e)
    {
    addText("----------onSignalLoss recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onSignalGain = function(e)
    {
    addText("----------onSignalGain recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onBoc = function(e)
    {
    addText("----------onBoc recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onEoc = function(e)
    {
    addText("----------onEoc recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onCaughtUptoLive = function(e)
    {
    addText("----------onCaughtUptoLive recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onVideoAspectChanged = function(e)
    {
    addText("----------onVideoAspectChanged recieved----------");
    addText("videoAspectChangedInfo: " + e.videoAspectChangedInfo.oldAspectRatio);
    addText("videoAspectChangedInfo: " + e.videoAspectChangedInfo.newAspectRatio);
    addText("playSessionHandle: " + e.videoAspectChangedInfo.playSessionHandle);
    }

onLockerStatusUpdate = function(e)
    {
    addText("----------onLockerStatusUpdate recieved----------");
    addText("playSessionHandle: " + e.lockerStatusInfo.playSessionHandle);

    var i = 0;
    for (i=0; i<e.lockerStatusInfo.lockInfo.length; i++)
        {
        addText("----------Lock NO: "+ i + "----------");
        addText("lockerCode: " + e.lockerStatusInfo.lockInfo[i].lockerCode);
        addText("lockReason: " + e.lockerStatusInfo.lockInfo[i].lockReason);
        addText("---------------------------------------------------");
        }
    }

onLockerUnlock = function(e)
    {
    addText("----------onLockerUnlock recieved----------");
    addText("playSessionHandle: " + e.playSessionHandle);
    }

onEventBoundaryChanged = function(e)
    {
    addText("-----------onEventBoundaryChanged recieved-----------");
    addText("playSessionHandle: " + e.eventBoundaryChangedInfo.playSessionHandle);
    addText("eventId: " + e.eventBoundaryChangedInfo.eventID);
    addText("start pos: " + playerInst.realTimePosition.startPosition);
    addText("curr pos: " + playerInst.realTimePosition.currentPosition);
    addText("end pos: " + playerInst.realTimePosition.endPosition);
    }

function init_buttons()
    {
    var buttons = document.getElementsByTagName("use");
    var numButtons = buttons.length;
    var prev = numButtons - 1;
    var next = 1;
    var i = 0;
    while (i < numButtons)
        {
        var b = buttons[i];
        var prevB = "url(#" + buttons[prev].getAttribute("id") + ")";
        var nextB = "url(#" + buttons[next].getAttribute("id") + ")";
        b.setAttribute("nav-up", prevB);
        b.setAttribute("nav-left", prevB);
        b.setAttribute("nav-down", nextB);
        b.setAttribute("nav-right", nextB);

        prev = (prev + 1) % numButtons;
        next = (next + 1) % numButtons;
        i++;
        }
    }

function init()
    {
    document.documentElement.onkeydown = keydownHandler;
    init_buttons();

    // get a reference to the objects
    playerMan = CCOM.PlayerManager;
    videTagElm = document.getElementById('video');
    playerMan.addEventListener("releaseInstanceOK",releaseInstanceOK);
    playerMan.addEventListener("releaseInstanceFailed",releaseInstanceFailed);
    playerMan.addEventListener("onPlayerInstanceCreated",onPlayerInstanceCreated);
    playerMan.addEventListener("onPlayerInstanceCreateFailure",onPlayerInstanceCreateFailure);
    playerMan.addEventListener("onPlayerInstanceDestroyed",onPlayerInstanceDestroyed);
    playerMan.addEventListener("onPlayerInstanceDestroyFailure",onPlayerInstanceDestroyFailure);

    /*
    var playerList = playerMan.playerList;
    addText("PlayerManager: playerList = " + playerList.length);
    for (var i=0; i<playerList.length; i++)
        {
        addText("PlayerManager: playerList.connection = " + playerList[i].connection);
        addText("PlayerManager: playerList.objectPath = " + playerList[i].objectPath);
        addText("PlayerManager: playerList.interface = " + playerList[i].interface);
        addText("PlayerManager: playerList.destUri = " + playerList[i].destUri);
        }
    */

    print_error("Get the player instance using getInstance before calling other methods.");
    sinetwork = CCOM.SINetwork;
    sinetwork.addEventListener("onScanComplete", onScanComplete);
    sinetwork.addEventListener("onScanError", onScanError);
    sinetwork.addEventListener("onScanProgress", onScanProgress);
    }

function testAllMethods()
    {
    print_error("testAllMethods Called");
    if (playerInst)
        {
        //Method Calls
        var res;
        blankVideo();
        muteAudio();
        unblankVideo();
        unmuteAudio();
        setStreamControl();
        getStreamControl();
        setAudioVolumeMixLevel();
        startStreams();
        stopStreams();
        play();
        stop();
        setSpeed();
        setPosition();

        //Get Property call
        getAvailableStreams();
        getActiveStreams();
        getOtherProperties();

        setPositionErr();
        startStreamsErr();
        stopStreamsErr();
        playErr();
        setStreamControlErr();
        setSpeedErr();
        }

    print_error("testAllMethods back from a Call");
    }

function getInstance()
    {
    var res;
    //res = playerMan.getInstance({destUri: "/tmp/Player0"});
    res = playerMan.getInstance({destUri: "display://0"});
    if(res.error)
        addText("Failed to getInstance: " + res.error.domain + res.error.name + res.error.message);
    else
        {
        playerInst = res.instance;
/*
        print_error("------------------Errors returned by getInstance------------------: " +
            CCOM.PlayerManager.PLAYER_MANAGER_METHOD_ERROR_GENERIC);
        print_error("------------------Errors returned by getInstance------------------: " +
            CCOM.PlayerManager.PLAYER_MANAGER_METHOD_ERROR_BAD_URI);

*/

        print_error("------------------Success Calling getInstance------------------: ");
        playerInst.addEventListener("onPlayStarted",onPlayStarted);
        playerInst.addEventListener("onPlayStopped",onPlayStopped);
        playerInst.addEventListener("onPlayError",onPlayError);
        playerInst.addEventListener("onPlayStartFailed",onPlayStartFailed);
        playerInst.addEventListener("onPlayStopFailed",onPlayStopFailed);

        playerInst.addEventListener("onStreamStarted",onStreamStarted);
        playerInst.addEventListener("onStreamStopped",onStreamStopped);
        playerInst.addEventListener("onStreamError",onStreamError);
        playerInst.addEventListener("onStreamStartFailed",onStreamStartFailed);
        playerInst.addEventListener("onStreamStopFailed",onStreamStopFailed);

        playerInst.addEventListener("onPositionChanged",onPositionChanged);
        playerInst.addEventListener("onPositionChangeFailed",onPositionChangeFailed);
        playerInst.addEventListener("onSpeedChanged",onSpeedChanged);
        playerInst.addEventListener("onSpeedChangeFailed",onSpeedChangeFailed);
        playerInst.addEventListener("onStreamAvailable",onStreamAvailable);
        playerInst.addEventListener("onVideoBlanked",onVideoBlanked);

        playerInst.addEventListener("onVideoUnblanked",onVideoUnblanked);
        playerInst.addEventListener("onAudioMuted",onAudioMuted);
        playerInst.addEventListener("onAudioUnmuted",onAudioUnmuted);
        playerInst.addEventListener("onVideoBlankFailed",onVideoBlankFailed);
        playerInst.addEventListener("onVideoUnblankFailed",onVideoUnblankFailed);

        playerInst.addEventListener("onAudioMuteFailed",onAudioMuteFailed);
        playerInst.addEventListener("onAudioUnmuteFailed",onAudioUnmuteFailed);
        playerInst.addEventListener("onBuffering",onBuffering);
        playerInst.addEventListener("onSignalLoss",onSignalLoss);
        playerInst.addEventListener("onSignalGain",onSignalGain);

        playerInst.addEventListener("onBoc",onBoc);
        playerInst.addEventListener("onEoc",onEoc);
        playerInst.addEventListener("onCaughtUptoLive",onCaughtUptoLive);
        playerInst.addEventListener("onVideoAspectChanged",onVideoAspectChanged);
        playerInst.addEventListener("onLockerStatusUpdate",onLockerStatusUpdate);

        playerInst.addEventListener("onLockerUnlock",onLockerUnlock);
        playerInst.addEventListener("onEventBoundaryChanged",onEventBoundaryChanged);
        }

    /*
    res = playerMan.getInstance({destUri: "/tmp/Player1"});
    if(res.error)
        addText("Failed to getInstance: " + res.error.message);
    else
        {
        playerInst2 = res.instance;
        addText("------------------Got second player--------------");
        playerInst2.addEventListener("onStreamStatusChange",onStreamStatusChange);
        }
    */
    }

function startDVBST()
    {
    getAvailableStreams();
    var test = new Array;
    if (subtitleList.length > 0)
        {
        addText("-----------Playing Subtitle-------------- ID:" + subtitleList[0]);
        var tstObj = new Object;
        tstObj.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
        tstObj.id = subtitleList[0];
        test[0] = tstObj;
        playerInst.startStreams(test);
        subtitleCount = 0;
        }
    else
        addText("------------------Subtitle stream not found--------------");
    }

function startStreams()
    {
    //print_error("startStreams Called");
    // playerInst.addEventListener("startStreamsOK", function(e)
        {addText("-----------startStreamsOK recieved-----------");});

    // playerInst.addEventListener("startStreamsFailed", function(e)
        {addText("~~~~~~~~~~~~ startStreamsFailed recieved ~~~~~~~~~~~~");});
    /*
    playerInst2.addEventListener("startStreamsOK", function(e)
        {addText("-----------2nd startStreamsOK recieved-----------");});
    playerInst2.addEventListener("startStreamsFailed", function(e)
        {addText("~~~~~~~~~~~~2nd startStreamsFailed recieved ~~~~~~~~~~~~");});
    */

    ar test = new Array;
    var tstObj = new Object;
    tstObj.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj.id = 46;
    var tstObj1 = new Object;
    tstObj.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj1.id = 24;
    tstObj1.dualMonoChannel = playerInst. AUDIO_CHANNEL_DUAL_MONO_LEFT;

    test[0] = tstObj;
    test[1] = tstObj1;
    playerInst.startStreams(test);

    /*
    var test2 = new Array;
    var tstObj2 = new Object;
    tstObj2.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj2.id = 55;
    var tstObj21 = new Object;
    tstObj21.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj21.id = 66;
    tstObj21.dualMonoChannel = playerInst. AUDIO_CHANNEL_DUAL_MONO_LEFT;

    test2[0] = tstObj2;
    test2[1] = tstObj21;

    playerInst2.startStreams(test2);
    */

    //print_error("startStreams back from a Call");
    }

function startStreamsErr()
    {
    // playerInst.addEventListener("startStreamsErrOK", function(e)
        {addText("-----------startStreamsErrOK recieved-----------");});
    // playerInst.addEventListener("startStreamsErrFailed", function(e)
        {addText("~~~~~~~~~~~~ startStreamsErrFailed recieved ~~~~~~~~~~~~");});

    /* Invalid Param */
    var test = new Array;
    var tstObj = new Object;
    tstObj.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    //tstObj.id = 46;
    var tstObj1 = new Object;
    tstObj1.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj1.id = 24;
    tstObj1.dualMonoChannel = playerInst. AUDIO_CHANNEL_DUAL_MONO_LEFT;

    test[0] = tstObj;
    test[1] = tstObj1;
    playerInst.startStreams(test);

    /* Same stream type check*/
    var test = new Array;
    var tstObj2 = new Object;
    tstObj2.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj2.id = 2;
    var tstObj3 = new Object;
    tstObj3.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    tstObj3.id = 2;
    test[0] = tstObj2;
    test[1] = tstObj3;

    playerInst.startStreams(test);
    }

function stopStreams()
    {
    //print_error("stopStreams Called");
    // playerInst.addEventListener("stopStreamsOK", function(e){addText
        ("-----------stopStreamsOK recieved-----------");});
    // playerInst.addEventListener("stopStreamsFailed", function(e){addText
        ("~~~~~~~~~~~~ stopStreamsFailed recieved ~~~~~~~~~~~~");});

    /* playerInst2.addEventListener("stopStreamsOK", function(e){addText
        ("-----------2nd stopStreamsOK recieved-----------");});
    playerInst2.addEventListener("stopStreamsFailed", function(e){addText
        ("~~~~~~~~~~~~2nd stopStreamsFailed recieved ~~~~~~~~~~~~");});
    */

    var test = new Array;
    var tstObj = new Object;
    tstObj.stopStreamTypes = playerInst.STREAM_TYPE_VIDEO;
    var tstObj1 = new Object;
    tstObj1.stopStreamTypes = playerInst.STREAM_TYPE_AUDIO;

    test[0] = tstObj;
    test[1] = tstObj1;
    playerInst.stopStreams(test);

    /*
    var test2 = new Array;
    var tstObjp2 = new Object;
    tstObjp2.stopStreamTypes = playerInst.STREAM_TYPE_VIDEO;
    var tstObjp21 = new Object;
    tstObjp21.stopStreamTypes = playerInst.STREAM_TYPE_AUDIO;

    test2[0] = tstObjp2;
    test2[1] = tstObjp21;
    playerInst2.stopStreams(test2);
    */

    //print_error("stopStreams back from a Call");
    }

function stopStreamsErr()
    {
    // playerInst.addEventListener("stopStreamsErrOK", function(e)
        {addText("------------------stopStreamsErrOK recieved------------------");});
    //playerInst.addEventListener("stopStreamsErrFailed", function(e){addText
        ("~~~~~~~~~~~~~~~~~~~ stopStreamsErrFailed recieved ~~~~~~~~~~~~~~~~~~~");});

    var test = new Array;
    var tstObj = new Object;
    var tstObj1 = new Object;

    tstObj1.specType = playerInst. STREAM_SPEC_TYPE_JUST_ID;
    test[0] = tstObj;
    test[1] = tstObj1;
    playerInst.stopStreams(test);
    }

function Live()
    {
    print_error("setPosition Called");
    playerInst.setPosition({whence: playerInst.SEEK_END, type: playerInst.
        POSITION_TYPE_TIME_BASED, timePosition: 0});
    print_error("setPosition back from a Call");
    }

function setPosition()
    {
    //print_error("setPosition Called");
    // playerInst.addEventListener("setPositionOK", function(e)
        {addText("-----------setPositionOK recieved-----------");});
    //playerInst.addEventListener("setPositionFailed", function(e)
        {addText("~~~~~~~~~~~~ setPositionFailed recieved ~~~~~~~~~~~~");});
    playerInst.setPosition({whence: 2, type: 1, timePosition: 15});
    //print_error("setPosition back from a Call");
    }

function setPositionErr()
    {
    //print_error("setPosition Called");
    //playerInst.addEventListener("setPositionErrOK", function(e)
        {addText("-----------setPositionErrOK recieved-----------");});
    //playerInst.addEventListener("setPositionErrFailed", function(e)
        {addText("~~~~~~~~~~~~ setPositionErrFailed recieved ~~~~~~~~~~~~");});
    playerInst.setPosition({type: 1, timePosition: 8});
    //print_error("setPosition back from a Call");
    }

function setSpeed()
    {
    //print_error("setSpeed Called");
    //playerInst.addEventListener("setSpeedOK", function(e)
        {addText("-----------setSpeedOK recieved-----------");});
    //playerInst.addEventListener("setSpeedFailed", function(e)
        {addText("~~~~~~~~~~~~~~ setSpeedFailed recieved ~~~~~~~~~~~~~~");});
    playerInst.setSpeed(4);
    //print_error("setSpeed back from a Call");
    }

function setSpeedErr()
    {
    //print_error("setSpeed Called");
    //playerInst.addEventListener("setSpeedOK", function(e)
        {addText("-----------setSpeedOK recieved-----------");});
    / playerInst.addEventListener("setSpeedFailed", function(e)
        {addText("~~~~~~~~~~~~ setSpeedFailed recieved ~~~~~~~~~~~~");});
    playerInst.setSpeed(0);
    //print_error("setSpeed back from a Call");
    }

function Pause()
    {
    print_error("Pause Called");
    playerInst.setSpeed(0);
    print_error("Pause Done");
    }

function Resume()
    {
    print_error("Resume Called");
    playerInst.setSpeed(100);
    print_error("Resume Done");
    }

function getStreamControl()
    {
    //print_error("getStreamControl Called");
    //playerInst.addEventListener("getStreamControlOK", function(e)
        {addText("getStreamControlOK recieved");});
    var res;
    res = playerInst.getStreamControl();
    if(res.error)
        addText("Failed to getStreamControl: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        {
        addText("-----------Success calling getStreamControl-----------");
        addText("Cmd: " + res.streamCommandControlData.cmd);
        addText("hide: " + res.streamCommandControlData.hide);
        }
    //print_error("getStreamControl back from a Call");
    }

function setStreamControl()
    {
    //print_error("setStreamControl Called");
    playerInst.addEventListener("setStreamControlOK", function(e)
        {addText("setStreamControlOK recieved");});
    res = playerInst.setStreamControl("dvb_st", {hide: true});
    if(res.error)
        addText("Failed to setStreamControl: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling setStreamControl-----------");
    //print_error("setStreamControl back from a Call");
    }

function setStreamControlErr()
    {
    //print_error("setStreamControl Called");
    res = playerInst.setStreamControl("Cmd", {tide: true});
    if(res.error)
        addText("Failed to setStreamControl: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling setStreamControl-----------");
    //print_error("setStreamControl back from a Call");
    }

function setAudioVolumeMixLevel()
    {
    //print_error("setAudioVolumeMixLevel Called");
    //playerInst.addEventListener("setAudioVolumeMixLevelOK", function(e)
        {addText("setAudioVolumeMixLevelOK recieved");});
    res = playerInst.setAudioVolumeMixLevel(56);
    if(res.error)
        addText("Failed to setAudioVolumeMixLevel: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling setAudioVolumeMixLevel-----------");
    //print_error("setAudioVolumeMixLevel back from a Call");
    }

function stop()
    {
    //print_error("stop Called");
    playerInst.addEventListener("stopOK", function(e)
        {addText("-----------stopOK recieved-----------");});
    playerInst.addEventListener("stopFailed", function(e)
        {addText("~~~~~~~~~~~~ stopFailed recieved ~~~~~~~~~~~~");});
    playerInst.stop();
    //print_error("stop back from a Call");
    }

function play()
    {
    //print_error("play Called");
    playerInst.addEventListener("playOK", function(e)
        {addText("-----------playOK recieved-----------");});
    playerInst.addEventListener("playFailed", function(e)
        {addText("~~~~~~~~~~~~ playFailed recieved with err = " + e.error.message);});

    var test2 = new Array;
    var obj1 = new Object;
    obj1.whence = playerInst.SEEK_SET;
    obj1.type = playerInst.POSITION_TYPE_TIME_BASED;
    obj1.timePosition = 0;
    test2[0] ={commandType:playerInst.PLAY_CONTROL_CMD_POSITION, positionCommandData: obj1};
    var res;
    if (count % 2)
        res = playerInst.play(url1,test2);
    else
        res = playerInst.play(url2,test2);

    addText("---------Player Play count----------:" + count);
    count++;
    if (count > 100)
        count = 0;

    //addText("-----------Player Session Handle-----------:" + 
        //res.playSessionInfo.sessionHandle);
    //print_error("play back from a Call");
    }

function playErr()
    {
    //playerInst.addEventListener("playErrOK", function(e)
        //{addText("-----------playErrOK recieved-----------");});
    //playerInst.addEventListener("playErrFailed", function(e)
        //{addText("~~~~~~~~~~~~ playErrFailed recieved ~~~~~~~~~~~~");});
    var test2 = new Array;
    var obj1 = new Object;
    obj1.whence =playerInst.SEEK_SET;
    //obj1.type = playerInst.POSITION_TYPE_TIME_BASED;
    obj1.timePosition = 45;
    test2[0] ={commandType:playerInst.PLAY_CONTROL_CMD_POSITION, positionCommandData: obj1};
    playerInst.play("tv://channel.4.0",test2);
    //print_error("play back from a Call");
    }

function blankVideo()
    {
    //print_error("blankVideo Called");
    //playerInst.addEventListener("blankVideoOK", function(e)
        //{addText("blankVideoOK recieved");});
    res = playerInst.blankVideo();
    if(res.error)
        addText("Failed to blankVideo: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling blankVideo-----------");
    //print_error("blankVideo back from a Call");
    }

function muteAudio()
    {
    //print_error("muteAudio Called");
    //playerInst.addEventListener("muteAudioOK", function(e)
        //{addText("muteAudioOK recieved");});
    res = playerInst.muteAudio();
    if(res.error)
        addText("Failed to muteAudio: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling muteAudio-----------");
    //print_error("muteAudio back from a Call");
    }

function unblankVideo()
    {
    //print_error("unblankVideo Called");
    //playerInst.addEventListener("unblankVideoOK", function(e)
        //{addText("unblankVideoOK recieved");});
    res = playerInst.unblankVideo();
    if(res.error)
        addText("Failed to unblankVideo: " + res.error.domain + "" + 
            res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling unblankVideo-----------");
    //print_error("unblankVideo back from a Call");
    }

function unmuteAudio()
    {
    //print_error("unmuteAudio Called");
    //playerInst.addEventListener("unmuteAudioOK", function(e)
        //{addText("unmuteAudioOK recieved");});
    res = playerInst.unmuteAudio();
    if(res.error)
        addText("Failed to unmuteAudio: " + res.error.domain + "" + 
        //res.error.name + ""+ res.error.message);
    else
        addText("-----------Success calling unmuteAudio-----------");
    //print_error("unmuteAudio back from a Call");
    }

function releaseInstance()
    {
    playerInst = null;
    window.gc();
    //print_error("releaseInstance Called");
    //playerMan.releaseInstance(playerObjectPath);
    //print_error("releaseInstance back from a Call");
    }

function getAvailableStreams()
    {
    addText("----------------availableStreams--------------");
    var availableStreams = playerInst.availableStreams;
    for (var i=0; i<availableStreams.length; i++)
        {
        addText("------------------------------------------");
        addText("Player: availableStreams.id = " + availableStreams[i].id);
        addText("Player: availableStreams.type = " + availableStreams[i].type);
        addText("Player: availableStreams.format = " + availableStreams[i].format);
        addText("Player: availableStreams.isDefault = " + availableStreams[i].isDefault);
        addText("Player: availableStreams.infoAvailable = " + availableStreams[i].infoAvailable);

        //if (availableStreams[i].type == playerInst.STREAM_TYPE_SUBTITLE) 
            //not yet supported in java script
        if (availableStreams[i].type == 2)
            {
            addText("Player: availableStreams.iaudio.dualMono = " + 
                availableStreams[i].iaudio.dualMono);
            addText("Player: availableStreams.iaudio.language = " + 
                availableStreams[i].iaudio.language);
            addText("Player: availableStreams.iaudio.languageRightChannel = " +
                availableStreams[i].iaudio.languageRightChannel);
            addText("Player: availableStreams.iaudio.audioType = " + 
                availableStreams[i].iaudio.audioType);
            addText("Player: availableStreams.iaudio.audioTypeRightChannel = " +
                availableStreams[i].iaudio.audioTypeRightChannel);
            }
/*
        addText("Player: availableStreams.idvbTltxtSubtitle.language = " +
            availableStreams[i].idvbTltxtSubtitle.language);
        addText("Player: availableStreams.idvbTltxtSubtitle.hearingImpaired = " +
            availableStreams[i].idvbTltxtSubtitle.hearingImpaired);
        addText("Player: availableStreams.idvbTltxtSubtitle.magazineNumber = " +
            availableStreams[i].idvbTltxtSubtitle.magazineNumber);
        addText("Player: availableStreams.idvbTltxtSubtitle.pageNumber = " +
            availableStreams[i].idvbTltxtSubtitle.pageNumber);

*/
        if (availableStreams[i].type == 3)
            {
            addText("Player: availableStreams.idvbSubtitle.language = " + 
                availableStreams[i].idvbSubtitle.language);
            addText("Player: availableStreams.idvbSubtitle.hearingImpaired = " +
                availableStreams[i].idvbSubtitle.hearingImpaired);
            addText("Player: availableStreams.idvbSubtitle.aspectRatio = " +
                availableStreams[i].idvbSubtitle.aspectRatio);
            addText("Player: availableStreams.idvbSubtitle.compositionPage = " +
                availableStreams[i].idvbSubtitle.compositionPage);
            addText("Player: availableStreams.idvbSubtitle.ancillaryPage = " +
                availableStreams[i].idvbSubtitle.ancillaryPage);
            }
/*
        addText("Player: availableStreams.iaribCc.regionSpecType = " + 
            availableStreams[i].iaribCc.regionSpecType);
        addText("Player: availableStreams.iaribCc.prefectureSpec = " + 
            availableStreams[i].iaribCc.prefectureSpec);

        addText("Player: availableStreams.idvbTltxtTeletext.language = " +
            availableStreams[i].idvbTltxtTeletext.language);
        addText("Player: availableStreams.idvbTltxtTeletext.teletextType = " +
            availableStreams[i].idvbTltxtTeletext.teletextType);
        addText("Player: availableStreams.idvbTltxtTeletext.magazineNumber = " +
            availableStreams[i].idvbTltxtTeletext.magazineNumber);
        addText("Player: availableStreams.idvbTltxtTeletext.page_number = " +
            availableStreams[i].idvbTltxtTeletext.page_number);

        addText("Player: availableStreams.idsmcc.carouselIdAvailable = " +
            availableStreams[i].idsmcc.carouselIdAvailable);
        addText("Player: availableStreams.idsmcc.carouselId = " + 
            availableStreams[i].idsmcc.carouselId);
        addText("Player: availableStreams.idsmcc.associationTagAvailable = " +
            availableStreams[i].idsmcc.associationTagAvailable);
        addText("Player: availableStreams.idsmcc.associationTag = " + 
            availableStreams[i].idsmcc.associationTag);
        addText("Player: availableStreams.iait.applicationType = " + 
            availableStreams[i].iait.applicationType);
        addText("Player: availableStreams.iait.AITVersionNumber = " + 
            availableStreams[i].iait.AITVersionNumber);
        addText("Player: availableStreams.iotvModule.tableId = " + 
            availableStreams[i].iotvModule.tableId);

*/
        addText("Player: availableStreams.customInfoType = " + 
            availableStreams[i].customInfoType);
        if (availableStreams[i].customInfoType == 1)
            {
            if (availableStreams[i].type == 3)
                {
                subtitleList[subtitleCount] = availableStreams[i].id;
                subtitleCount = subtitleCount + 1;
                }

            addText("Player: availableStreams.dvb.pid = " + 
                availableStreams[i].dvb.pid);
            addText("Player: availableStreams.dvb.componentTag = " + 
                availableStreams[i].dvb.componentTag);
            addText("Player: availableStreams.dvb.orderInPmt = " + 
                availableStreams[i].dvb.orderInPmt);
            }

        if (availableStreams[i].customInfoType == 2)
            {
            addText("Player: availableStreams.arib.pid = " + 
                availableStreams[i].arib.pid);
            addText("Player: availableStreams.arib.componentTag = " + 
                availableStreams[i].arib.componentTag);
            addText("Player: availableStreams.arib.orderInPmt = " + 
                availableStreams[i].arib.orderInPmt);
            addText("Player: availableStreams.arib.qualityLevel = " + 
                availableStreams[i].arib.qualityLevel);
            addText("Player: availableStreams.arib.referencePid = " + 
                availableStreams[i].arib.referencePid);
            addText("Player: availableStreams.arib.dataComponentId = " + 
                availableStreams[i].arib.dataComponentId);
            addText("Player: availableStreams.arib.displayMode = " + 
                availableStreams[i].arib.displayMode);
            addText("Player: availableStreams.arib.displayTiming = " + 
                availableStreams[i].arib.displayTiming);
            }

        addText("Player: availableStreams.otvTag = " + availableStreams[i].otvTag);
        addText("Player: availableStreams.otvDefault = " + availableStreams[i].otvDefault);
        addText("--------------------------------------------------------");
        }
    }

function getActiveStreams()
    {
    addText("------------activeStreams---------------");
    var activeStreams = playerInst.activeStreams;
    for (var i=0; i<activeStreams.length; i++)
        {
        addText("-----------------------------------------------");
        addText("Player: activeStreams.id = " + activeStreams[i].id);
        addText("Player: activeStreams.type = " + activeStreams[i].type);
        addText("Player: activeStreams.format = " + activeStreams[i].format);
        addText("Player: activeStreams.isDefault = " + activeStreams[i].isDefault);
        addText("Player: activeStreams.infoAvailable = " + activeStreams[i].infoAvailable);

        if (activeStreams[i].type == 2)
            {
            addText("Player: activeStreams.iaudio.dualMono = " + 
                activeStreams[i].iaudio.dualMono);
            addText("Player: activeStreams.iaudio.language = " + 
                activeStreams[i].iaudio.language);
            addText("Player: activeStreams.iaudio.languageRightChannel = " +
                activeStreams[i].iaudio.languageRightChannel);
            addText("Player: activeStreams.iaudio.audioType = " + 
                activeStreams[i].iaudio.audioType);
            addText("Player: activeStreams.iaudio.audioTypeRightChannel = " +
                activeStreams[i].iaudio.audioTypeRightChannel);
            }
/*
        addText("Player: activeStreams.idvbTltxtSubtitle.language = " + 
            activeStreams[i].idvbTltxtSubtitle.language);
        addText("Player: activeStreams.idvbTltxtSubtitle.hearingImpaired = " +
            activeStreams[i].idvbTltxtSubtitle.hearingImpaired);
        addText("Player: activeStreams.idvbTltxtSubtitle.magazineNumber = " +
            activeStreams[i].idvbTltxtSubtitle.magazineNumber);
        addText("Player: activeStreams.idvbTltxtSubtitle.pageNumber = " +
            activeStreams[i].idvbTltxtSubtitle.pageNumber);

*/
        if (activeStreams[i].type == 3)
            {
            addText("Player: activeStreams.idvbSubtitle.language = " + 
                activeStreams[i].idvbSubtitle.language);
            addText("Player: activeStreams.idvbSubtitle.hearingImpaired = " +
                activeStreams[i].idvbSubtitle.hearingImpaired);
            addText("Player: activeStreams.idvbSubtitle.aspectRatio = " + 
                activeStreams[i].idvbSubtitle.aspectRatio);
            addText("Player: activeStreams.idvbSubtitle.compositionPage = " +
                activeStreams[i].idvbSubtitle.compositionPage);
            addText("Player: activeStreams.idvbSubtitle.ancillaryPage = " + 
                activeStreams[i].idvbSubtitle.ancillaryPage);
            }
/*
        addText("Player: activeStreams.iaribCc.regionSpecType = " + 
            activeStreams[i].iaribCc.regionSpecType);
        addText("Player: activeStreams.iaribCc.prefectureSpec = " + 
            activeStreams[i].iaribCc.prefectureSpec);
        addText("Player: activeStreams.idvbTltxtTeletext.language = " + 
            activeStreams[i].idvbTltxtTeletext.language);
        addText("Player: activeStreams.idvbTltxtTeletext.teletextType = " +
            activeStreams[i].idvbTltxtTeletext.teletextType);
        addText("Player: activeStreams.idvbTltxtTeletext.magazineNumber = " +
            activeStreams[i].idvbTltxtTeletext.magazineNumber);
        addText("Player: activeStreams.idvbTltxtTeletext.page_number = " +
            activeStreams[i].idvbTltxtTeletext.page_number);

        addText("Player: activeStreams.idsmcc.carouselIdAvailable = " +
            activeStreams[i].idsmcc.carouselIdAvailable);
        addText("Player: activeStreams.idsmcc.carouselId = " + 
            activeStreams[i].idsmcc.carouselId);
        addText("Player: activeStreams.idsmcc.associationTagAvailable = " +
            activeStreams[i].idsmcc.associationTagAvailable);
        addText("Player: activeStreams.idsmcc.associationTag = " + 
            activeStreams[i].idsmcc.associationTag);

        addText("Player: activeStreams.iait.applicationType = " + 
            activeStreams[i].iait.applicationType);
        addText("Player: activeStreams.iait.AITVersionNumber = " + 
            activeStreams[i].iait.AITVersionNumber);
        addText("Player: activeStreams.iotvModule.tableId = " + 
            activeStreams[i].iotvModule.tableId);

*/
        addText("Player: activeStreams.customInfoType = " + 
            activeStreams[i].customInfoType);
        if (activeStreams[i].customInfoType == 1)
            {
            addText("Player: activeStreams.dvb.pid = " + activeStreams[i].dvb.pid);
            addText("Player: activeStreams.dvb.componentTag = " + 
                activeStreams[i].dvb.componentTag);
            addText("Player: activeStreams.dvb.orderInPmt = " + 
                activeStreams[i].dvb.orderInPmt);
            }

        if (activeStreams[i].customInfoType == 2)
            {
            addText("Player: activeStreams.arib.pid = " + activeStreams[i].arib.pid);
            addText("Player: activeStreams.arib.componentTag = " + 
                activeStreams[i].arib.componentTag);
            addText("Player: activeStreams.arib.orderInPmt = " + 
                activeStreams[i].arib.orderInPmt);
            addText("Player: activeStreams.arib.qualityLevel = " + 
                activeStreams[i].arib.qualityLevel);
            addText("Player: activeStreams.arib.referencePid = " + 
                activeStreams[i].arib.referencePid);
            addText("Player: activeStreams.arib.dataComponentId = " + 
                activeStreams[i].arib.dataComponentId);
            addText("Player: activeStreams.arib.displayMode = " + 
                activeStreams[i].arib.displayMode);
            addText("Player: activeStreams.arib.displayTiming = " + 
                activeStreams[i].arib.displayTiming);
            }

        addText("Player: activeStreams.otvTag = " + activeStreams[i].otvTag);
        addText("Player: activeStreams.otvDefault = " + activeStreams[i].otvDefault);
        addText("--------------------------------------------------------");
        }
    }

function getOtherProperties()
    {
    document.getElementById("result").value="";
    print_error("getOtherProperties Called");
    var playerList = playerMan.playerList;
    addText("PlayerManager: playerList = " + playerList.length);

    for (var i=0; i< playerList.length; i++)
        {
        addText("PlayerManager: playerList.connection = " + playerList[i].connection);
        addText("PlayerManager: playerList.objectPath = " + playerList[i].objectPath);
        addText("PlayerManager: playerList.interface = " + playerList[i].interface);
        addText("PlayerManager: playerList.destUri = " + playerList[i].destUri);
        }

    addText("Player: destUri = " + playerInst.destUri);
    addText("Player: sourceUri = " + playerInst.sourceUri);
    addText("Player: speed = " + playerInst.speed);
    addText("Player: buffer Level = " + playerInst.bufferingLevel);
    addText("Player: position = " + playerInst.position);
    addText("Player: duration = " + playerInst.duration);
    addText("Player: videoBlankStatus = " + playerInst.videoBlankStatus);
    addText("Player: audioMuteStatus = " + playerInst.audioMuteStatus);
    addText("Player: audioMixLevel = " + playerInst.audioMixLevel);

    addText("-----------------------VideoDetails-------------------------------------");
    var videoDetails = playerInst.videoDetails;
    addText("Player: videoDetails.format = " + videoDetails.format);
    addText("Player: videoDetails.framerate = " + videoDetails.framerate);
    addText("Player: videoDetails.bitrate = " + videoDetails.bitrate);
    addText("Player: videoDetails.scantype = " + videoDetails.scantype);
    addText("Player: videoDetails.aspect = " + videoDetails.aspect);
    addText("Player: videoDetails.height = " + videoDetails.height);
    addText("Player: videoDetails.width = " + videoDetails.width);

    addText("-----------------------AudioDetails-------------------------------------");
    var audioDetails = playerInst.audioDetails;
    addText("Player: audioDetails.format = " + audioDetails.format);
    addText("Player: audioDetails.bitrate = " + audioDetails.bitrate);
    nt = text;
    r.appendChild(ts);
    r.appendChild(document.createElement("tbreak"));
    }

function bar(arg)
    {
    addText("function bar(" + arg + ") called!");
    return 4;
    }

function test()
    {
    addText("testing addEventListner worked!!!!!!!!!!!!");
    }

function testnewevent()
    {
    addText("testing addEventListner with Eds method!!!!!!!!!!!!");
    }

function scan()
    {
    o = sinetwork.scan("TestScan");
    if (o.error)
        {
        addText ("sinetwork.scan() returned an error!");
        }
    else
        {
        addText ("sinetwork.scan() returned an scanHandle=" + o.scanHandle);
        scan_handle = o.scanHandle;
        }
    }

function scaleVideo()
    {
    var curW = new Number;
    curW = parseInt(videTagElm.getAttribute("width"));
    if( curW == 1280)
        {
        videTagElm.setAttribute("y", 200);
        videTagElm.setAttribute("x", 850);
        videTagElm.setAttribute("width", 166);
        videTagElm.setAttribute("height", 136);
        }
    else
        {
        videTagElm.setAttribute("y", 0);
        videTagElm.setAttribute("x", 0);
        videTagElm.setAttribute("width", 1280);
        videTagElm.setAttribute("height", 720);
        }
    }

onScanComplete = function (e)
    {
    addText ("sinetwork.onScanComplete received: scanHandle=" + e.scanHandle);
    }

onScanError = function (e)
    {
    addText ("sinetwork.onScanError received: scanHandle=" + e.scanHandle + 
        " condition=" + e.condition);
    }

onScanProgress = function (e)
    {
    addText ("onScanProgress received:");
    addText (" progressInfo.scanHandle=" + e.progressInfo.scanHandle);
    addText (" progressInfo.scannedPercent=" + e.progressInfo.scannedPercent);
    addText (" progressInfo.scannedTSCount=" + e.progressInfo.scannedTSCount);
    addText (" progressInfo.totalServicesFoundCount=" + e.progressInfo.totalServicesFoundCount);
    addText (" progressInfo.tvServicesFoundCount=" + e.progressInfo.tvServicesFoundCount);
    addText (" progressInfo.radioServicesFoundCount=" + e.progressInfo.radioServicesFoundCount);
    addText (" progressInfo.onid=" + e.progressInfo.onid);
    addText (" progressInfo.tsid=" + e.progressInfo.tsid);
    addText (" progressInfo.signalStrength=" + e.progressInfo.signalStrength);
    addText (" progressInfo.SNR=" + e.progressInfo.SNR);
    addText (" progressInfo.BER=" + e.progressInfo.BER);
    }

function keydownHandler(e)
    {
    alert("keydown: " + e.keyCode);
    switch(e.keyCode)
        {
        case KEY_ENTER_ST7108:
        case KEY_ENTER_EMULATOR:
            alert("e.target.id: " + e.target.id);
            eval(e.target.id+"()");
            break;
        default:
            break;
        }
    }
//]]>

</script>