Ringtone is an avaliable audio files that will be played when there is an incoming TelephonyConversation. In this tutorial it will be covered how to retrieve ringtone list and how to set an active Ringtone. Ringtone list can be retrieved through MultimediaController.ringtoneList property as it is shown in the snippet below:
// In this example it is assumed that index used is within a bounds of the list.
var ringtoneList = cwic.MultimediaController.ringtoneList;
Event handler must be set for "onRingtoneListChanged"
event in order to track changes with ringtone list. Event is fired in following occasions:
- Ringtone has been added or removed to the list (during sign in/sign out).
- Ringtone list has been refreshed through MultimediaController.refreshRingtoneList
function onRingtoneListChanged()
{
// Handle Event.
}
cwic.MultimediaController.addEventHandler("onRingtoneListChanged",onRingtoneListChanged);
To refresh ringtone list, call MultimediaController.refreshRingtoneList method as it is shown in the snippet below:
cwic.MultimediaController.refreshRingtoneList();
Once Ringtone list has been retrieved, a specific ringtone can be chosen from the list and set as an active.
Active ringtone is ringtone that will be played when there is an incoming telephony conversation. In the snippet below
it is shown how to choose ringtone from ringtone list and set it as an active throuhg MultimediaController.selectRingtone:
// For the sake of this example, index used to access ringtone from ringtone list is valid.
var ringtone = cwic.MultimediaController.ringtoneList[0]
cwic.MultimediaController.setRingtone(ringtone);