-
Notifications
You must be signed in to change notification settings - Fork 60
Legacy API: AudioControl
Hyojin Kim edited this page Mar 21, 2017
·
2 revisions
For converting TVAudioControl API of Legacy to TOAST API, please refer to the followings.
If you want more information, please refer to toast.tvaudiocontrol
-
Before
/* plugin */ var PLR_TRUE = 1; var PLR_FALSE = 0; var audioPlugin = document.getElementById('audioPlugin'); audioPlugin.SetMute(PLR_TRUE);
/* SEF */ var PLR_TRUE = 1; var PLR_FALSE = 0; var sef = document.getElementById('sef'); sef.Open('Audio', '1.0', 'Audio'); sef.Execute('SetUserMute', PLR_TRUE);
/* webapis */ var userMute = true; webapis.audiocontrol.setMute(userMute);
-
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); });
-
Before
/* plugin */ audioPlugin.GetMute();
/* SEF */ sef.Execute('GetUserMute');
/* webapis */ webapis.audiocontrol.getMute();
-
After
toast.tvaudiocontrol.isMute(function(value) { // value : state of mute console.log('Success: ' + value); }, function(err) { console.log('Error: ' + err.message); });
-
Before
/* plugin */ var volume = 5; audioPlugin.SetVolume(volume);
/* SEF */ var volume = 5; sef.Execute('SetVolume', volume);
/* webapis */ var volume = 5; webapis.audiocontrol.setVolume(volume);
-
After
var volume = 5; toast.tvaudiocontrol.setVolume(volume, function() { console.log('Success'); }, function(err) { console.log('Error: ' + err.message); });
-
Before
var PL_AUDIO_VOLUME_KEY_UP = 0; var PL_AUDIO_VOLUME_KEY_DOWN = 1;
/* plugin */ audioPlugin.SetVolumeWithKey(PL_AUDIO_VOLUME_KEY_UP); // PL_AUDIO_VOLUME_KEY_UP : increment volume level
/* SEF */ sef.Execute('SetVolumeWithKey', PL_AUDIO_VOLUME_KEY_UP); // PL_AUDIO_VOLUME_KEY_UP : increment volume level
/* webapis */ webapis.audiocontrol.setVolumeUp();
-
After
toast.tvaudiocontrol.setVolumeUp(function() { console.log('Success'); }, function(err) { console.log('Error: ' + err.message); });
-
Before
var PL_AUDIO_VOLUME_KEY_UP = 0; var PL_AUDIO_VOLUME_KEY_DOWN = 1;
/* plugin */ audioPlugin.SetVolumeWithKey(PL_AUDIO_VOLUME_KEY_DOWN); // PL_AUDIO_VOLUME_KEY_DOWN : decrement volume level
/* SEF */ sef.Execute('SetVolumeWithKey', PL_AUDIO_VOLUME_KEY_DOWN); // PL_AUDIO_VOLUME_KEY_DOWN : decrement volume level
/* webapis */ webapis.audiocontrol.setVolumeDown();
-
After
toast.tvaudiocontrol.setVolumeDown(function() { console.log('Success'); }, function(err) { console.log('Error: ' + err.message); });
-
Before
/* plugin */ audioPlugin.GetVolume();
/* SEF */ sef.Execute('GetVolume');
/* webapis */ webapis.audiocontorl.getVolume();
-
After
toast.tvaudiocontrol.getVolume(function(value) { // value : current volume console.log('Success: ' + value); }, function(err) { console.log('Error: ' + err.message); });
-
Before
/* Not supported */
-
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); });
-
Before
/* Not supported */
-
After
toast.tvaudiocontrol.unsetVolumeChangeListener(function() { console.log('Success'); }, function(err) { console.log('Error: ' + err.message); });
uuuu
Getting Started
Converting Tizen to Toast
- Prepare to convert
- Tizen API: AVPlay
- Tizen API: DrmInfo(Deprecated)
- Tizen API: Application
- Tizen API: TVInputDevice
- Tizen API: TVAudioControl
- Tizen API: TVWindow
- Tizen API: TVChannel
- Tizen API: IME
- Tizen API: ProductInfo
- Tizen API: Network
- How to detect platform
Converting Legacy to Toast
- Prepare to convert
- Legacy API: AVPlay
- Legacy API: TVInfo
- Legacy API: Common
- Legacy API: InputDevice
- Legacy API: AudioControl
- Legacy API: TVWindow
- Legacy API: TVChannel
- Legacy API: IME
- How to detect platform
API Reference
- supported cordova plugin
- toast.Media
- toast.MediaPlugin
- toast.drminfo(Deprecated)
- toast.application
- toast.inputdevice
- toast.tvaudiocontrol
- toast.tvwindow
- toast.tvchannel
- toast.billing
Supported platforms
Sample App
Contribution
Frequently Asked Questions