Samsung Electronics logo

Display Control

Table of Contents


The Display Control API provides a way to control the display feature on the TV-associated device. The Display Control module handles the TV Display function. Using it allows you to check and use various display features supported by DTV. For example, it can check whether your device supports 3D or provide a way to get the current 3DEffectMode of the DTV. Using Display Control API capabilities, your application can:

Prerequisites

The ImageView API lets you play the image media content on a TV. When the application is launched, an ImageView object is automatically instantiated in the webapis object. The webapis.imageview object is an instance of the ImageViewManager interface, which gives the method to handle image content play on the TV. The following figure shows how the API objects are structured inside the application window. Adding the JavaScript file to your application is required. This is the script to add to the webapis file:

 
<html><head>
<!-- including the JavaScript file which supports Samsung Web API -->
<script type="text/javascript" language="javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script>
</head></html>

Get the Current 3D Effect Mode

The DisplayControl API provides methods that allow you to request getting the current 3DEffectMode of the DTV. To discover the DTV 3D effect mode, an application can use the DisplayControlManager instance by invoking get3DModeSupportList (). It checks the 3D mode support for the DTV and, on success, calls Mode3DEffectListSupportCallback and, on failure, calls errorCallback. Once the list of available support is found, an application can invoke set3DEffectMode() with parameters received through Mode3DEffectListSupportCallback to set the DTV 3D mode. If an application must find the current 3Deffect mode, it can use get3DEffectMode(); this returns the current 3D effect mode of the DTV. To request getting the current 3DEffectMode of the DTV, call the get3DEffectMode() method. On successful execution, the return value is any one of the following:

Available Values for 3D Effect Description
MODE_3D_EFFECT_OFF = 0 Original 2D mode
MODE_3D_EFFECT_TOP_BOTTOM = 1 Top and bottom frame compatible
MODE_3D_EFFECT_SIDE_BY_SIDE = 2 Side by side frame compatible
MODE_3D_EFFECT_LINE_BY_LINE = 3 Line by line frame compatible.
MODE_3D_EFFECT_VERTICAL_STRIPE = 4 Vertical stripe frame compatible.
MODE_3D_EFFECT_FRAME_SEQUENCE = 5 Frame sequence frame compatible
MODE_3D_EFFECT_CHECKER_BD = 6 Checker board frame compatible
MODE_3D_EFFECT_FROM_2D_TO_3D = 7 2D to 3D conversion
MODE_3D_EFFECT_FROM_3D_TO_2D = 8 3D to 2D conversion
 
var displayControlObject= webapis.displaycontrol;  
alert('the 3d effect mode of DTV is '+ displaycontrolObject.get3DEffectMode());

Get the List of Supported 3D Modes

The DisplayControl API provides methods that allow you to request checking whether the current DTV supports 3DMode. To request getting the 3DModeSupportList of the DTV, call the get3DModeSupportList () method. You have to pass two callbacks: SuccessCallback (called when the 3D mode support list is returned successfully) and ErrorCallback (called when the 3D mode support list is not returned due to error). Error Callback is nullable but not optional. SuccessCallback is not optional and cannot be null.

 
var displayControlObject = webapis.displaycontrol;  
function onSuccess(mode3DEffectArray)
{  
      var i;
      for (i=0; i < mode3DEffectArray.length; i++){
             alert("3DModeList : "+ mode3DEffectArray[i]);
               }  
          }
          
function onError(err)
{
      alert("Error :" + err.message);
} 

displayControlObject.get3DModeSupportList(onSuccess, onError);

Check Whether 3D Mode Is Supported

The Display Control API provides methods that allow you to request checking whether the current DTV supports 3DMode. To request getting the current 3DEffectMode of the DTV, call the get3DEffectMode () method. You have to pass two callbacks: Success Callback (called when the device is able to support 3D mode) and Error Callback (called if the operation failed due to error). Error Callback can be set to null but is not optional. SuccessCallback is not optional and cannot be null.

 
 try {
     var mode = webapis.displaycontrol.check3DModeEnable(); 
     switch (mode) { 
         case webapis.displaycontrol.MODE_3D_DEVICE_NOT_CONNECTED : 
             console.log("3D display is not connected");
            break;
         case webapis.displaycontrol.MODE_3D_NOT_SUPPORTED : 
            console.log("3D display is not supported");
            break; 
         case webapis.displaycontrol.MODE_3D_ENABLE_OK : 
            console.log("3D display is enabled");
           break;
 } catch (error) { 
     console.log(error.name);
 }