Skip to content

Tizen API: TVAudioControl

Hyojin Kim edited this page Jan 7, 2016 · 6 revisions

For converting TVAudioControl API of tizen to TOAST API, please refer to the followings.

If you want more information, please refer to toast.tvaudiocontrol

####privilege <tizen:privilege name="http://tizen.org/privilege/tv.audio"/>

####setMute

  • Before

    // true : turn on the silent mode
    // false : trun off the silent mode
    var mute = true;
    tizen.tvaudiocontrol.setMute(mute); 
  • After

    // true : turn on the silent mode
    // false : trun off the silent mode
    var mute = true;
    toast.tvaudiocontrol.setMute(mute, function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####isMute

  • Before

    tizen.tvaudiocontrol.isMute();
  • After

    toast.tvaudiocontrol.isMute(function(value) {
        // value : state of mute
        console.log('Success: ' + value);
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####setVolume

  • Before

    var volume = 5;
    tizen.tvaudiocontrol.setVolume(volume);
  • After

    var volume = 5;
    toast.tvaudiocontrol.setVolume(volume, function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####setVolumeUp

  • Before

    tizen.tvaudiocontrol.setVolumeUp();
  • After

    toast.tvaudiocontrol.setVolumeUp(function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####setVolumeDown

  • Before

    tizen.tvaudiocontrol.setVolumeDown();
  • After

    toast.tvaudiocontrol.setVolumeDown(function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####getVolume

  • Before

    tizen.tvaudiocontrol.getVolume();
  • After

    toast.tvaudiocontrol.getVolume(function(value) {
        // value : current volume
        console.log('Success: ' + value);
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####setVolumeChangeListener

  • Before

    function onVolumeChanged(volume) {
        console.log('volume changes to ' + value);
    }
    tizen.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged);
  • After

    function onVolumeChanged(volume){
        console.log('volume changes to ' + value);
    }
    toast.tvaudiocontrol.setVolumeChangeListener(onVolumeChanged, function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });

####unsetVolumeChangeListener

  • Before

    tizen.tvaudiocontrol.unsetVolumeChangeListener();
  • After

    toast.tvaudiocontrol.unsetVolumeChangeListener(function() {
        console.log('Success');
    }, function(err) {
        console.log('Error: ' + err.message);
    });
Clone this wiki locally