Mountain View
Jabber SDK API Documentation

Tutorial: Retrieving And Using Media Device Lists

Retrieving And Using Media Device Lists

Title Media Device list reflects list of media devices that are currently connected to local machine. There are four types of Media Devices that can be accessed and used: In the snippet below, it is shown how to access Camera, Microphone, Speaker and Ringer from their respective lists:

        // In this example it is assumed that index used is within a bounds of the list.
        var camera     = cwic.MultimediaController.cameraList[0];
        var microphone = cwic.MultimediaController.microphoneList[0];
        var speaker    = cwic.MultimediaController.speakerList[0];
        var ringer     = cwic.MultimediaController.ringerList[0];
    
During the lifetime of user's signed in state, media devices can be added or removed. In order to be notified about such changes, eventHandler for "onMediaDeviceListChanged" event must be set. Event is fired in these occasions:
  • Media device has been added or removed from specific list.
  • Media device has been selected as an active device (For example new speaker has been selected to be an active one).
  • All media device lists has been refreshed through MultimediaController.refreshMediaDeviceList
In the snippet below, it is shown how to setup this event handler:

        function onMultimediaDeviceListChanged()
        {
            // ...
            // Speaker, Ringer, Camera and Microphone list have been refreshed.
            // Handle event...
            // ...
        }

        cwic.MultimediaController.addEventHandler("onMultimediaDeviceListChanged", onMultimediaDeviceListChanged);
    
To refresh media device list, call MultimediaController.refreshMediaDeviceList method as it is shown in the snippet below:

        cwic.MultimediaController.refreshMediaDeviceList();
    

Next

Previous