top

AUDIO

This class manipulates volume with deviceapis.audiocontrol object and defines functions for volume control.

Add the following line for Audio class into a html file your own :

  object id="plugin" classid="clsid:SAMSUNG-INFOLINK-SEF" style="width:0px; height:0px;">/object>

You can declare Audio class like this :

  ex) plugin = document.getElementById("plugin");

        plugin.Open('Audio', '1.000', 'Audio');

        plugin.Execute('method', 'parm1', 'parm2');


Constants

NameValueDescription
PL_AUDIO_AUDIO_OUT_MODE_PCM 0The PCM mode
PL_AUDIO_AUDIO_OUT_MODE_DOLBY1The Dolby mode
PL_AUDIO_AUDIO_OUT_MODE_DTS 2The DTS mode
PL_AUDIO_OUTPUT_DEVICE_MAIN_SPEAKER 0The main speaker
PL_AUDIO_OUTPUT_DEVICE_EARPHONE 1The earphone
PL_AUDIO_OUTPUT_DEVICE_SUBWOOFER 2The subwoofer
PL_AUDIO_OUTPUT_DEVICE_EXTERNAL 3The external speaker such as component audio, composite audio and so on
PL_AUDIO_OUTPUT_DEVICE_RECEIVER 4The receiver such as HDMI, SPDIF and so on

Methods

CheckExternalOutMode

Description
The CheckExternalOutMode function checks whether external out mode can be changed to input value.
Parameters
■audioOutMode
  - PL_AUDIO_AUDIO_OUT_MODE
  - PCM, DOLBY, DTS, and so on
Return■Success
  - 1 : the mode can be changed,

■Fail
  - negative number : the mode cannot be changed.
Emulator SupportY
SDK ConstraintNone
Example
var audioOutMode = SefPlugin.Execute("GetExternalOutMode");
alert("AudioPlugin.GetExternalOutMode() = " + audioOutMode);

if ( audioOutMode == PL_AUDIO_AUDIO_OUT_MODE_PCM ) {

    var checkAudioOutMode = SefPlugin.Execute ("CheckExternalOutMode", PL_AUDIO_AUDIO_OUT_MODE_DOLBY);
    if ( 0 == checkAudioOutMode ) {

        var result = SefPlugin.Execute ("SetExternalOutMode", PL_AUDIO_AUDIO_OUT_MODE_DOLBY);
    }
}

alert("SefPlugin.Execute GetOutputDevice() = " + SefPlugin.Execute("GetOutputDevice"));

GetExternalOutMode

Description
The GetExternalOutMode function returns external out mode (PCM, DOLBY, DTS, and so on).
Parameters
none
Return■Success
  - PL_AUDIO_AUDIO_OUT_MODE

■Fail
  - negative number
Emulator SupportY
SDK ConstraintNone
Example
var audioOutMode = SefPlugin.Execute("GetExternalOutMode");

if ( audioOutMode == PL_AUDIO_AUDIO_OUT_MODE_PCM ) {

    var checkAudioOutMode = SefPlugin.Execute("CheckExternalOutMode", PL_AUDIO_AUDIO_OUT_MODE_DOLBY);

    if ( 0 == checkAudioOutMode ) {

        var result = SefPlugin.Execute("SetExternalOutMode", PL_AUDIO_AUDIO_OUT_MODE_DOLBY);
    }
}

alert("SefPlugin.GetOutputDevice = " + SefPlugin.Execute("GetOutputDevice"));

GetMute

Description
This API is used to returns the muting state of device
Parameters
none
Return■Number
  - success : returns 1
  - fail : returns negative number
Emulator SupportYes
SDK ConstraintNone
Example
var ret = SefPlugin.Execute("GetMute");                                                                                                                                                                                            console.log("Result = " + ret);

GetOutputDevice

Description
The GetOutputDevice function gets the audio device information used for audio output.
Parameters
none
Return■Success
  - PL_AUDIO_OUTPUT_DEVICE

■Fail
  - error code
Emulator SupportY
SDK ConstraintNone
Example
var outputDevice;
outputDevice = SefPlugin.Execute("GetOutputDevice");

if( outputDevice == PL_AUDIO_OUTPUT_DEVICE_MAIN_SPEAKER )
{
    ...
}
else if( outputDevice == PL_AUDIO_OUTPUT_DEVICE_EARPHONE )
{
    ...
}
else if( outputDevice == PL_AUDIO_OUTPUT_DEVICE_SUBWOOFER )
{
    ...
}
else if( outputDevice == PL_AUDIO_OUTPUT_DEVICE_EXTERNAL )
{
    ...
}
else if( outputDevice == PL_AUDIO_OUTPUT_DEVICE_RECEIVER )
{
    ...
}
else
{
    ...
}

GetUserMute

Description
The GetUserMute function gets information about the DTV platform’s UserMute state.
Parameters
none
Return■Success
  - PLR_TRUE : UserMute is on,
  - PLR_FALSE : UserMute is off

■Fail
  - negative number
Emulator SupportY
SDK ConstraintNone
Example
var userMute = SefPlugin.Execute("GetUserMute");
if( PLR_TRUE == userMute ) {

    ... UserMute On ...
}
else if( PLR_FALSE == userMute ) {

    ... UserMute Off ...
}
else {

    ... Error ...
}

GetVolume

Description
The GetVolume function gets the volume level of the DTV platform. The range of volume is 0 ~ 100.
Parameters
none
Return■Success
  - value between 0 and 100

■Fail
  - negative number
Emulator SupportY
SDK ConstraintNone
Example
var volume;

volume = SefPlugin.Execute("GetVolume");
alert(volume);

SetRelativeVolume

Description
This API is used to sets the volume with given level based on the current level
Parameters
■level_of_vol
  - Number
  - the level of volume
Return■Number
  - success : returns 1
  - fail : returns negative number
Emulator SupportYes
SDK ConstraintNone
Example
var ret = SefPlugin.Execute("SetRelativeVolume","10");                     
If(ret != true)                                                                                                                                          {  console.log("Failed! Result = " + ret); }

SetUserMute

Description
The SetUserMute plugin function sets the state of UserMute in DTV platform.
Parameters
■userMute
  - int
  - 1 : UserMute state
     0 : Non-UserMute state
Return■Success
  - PLR_TRUE

■Fail
  - negative number
Emulator SupportY
SDK ConstraintNone
Example
SefPlugin.Execute("SetUserMute", 1);

SetVolume

Description
Set Volume level (0~100)
Parameters
■volume level
  - Number
  - 0 ~ 100
Return■Void
Emulator SupportY
SDK ConstraintNone
Example
.