Controlling audio output

To play back audio, a mobile device needs to be connected to an audio output device. This can be either an integrated earpiece or loudspeaker or an audio peripheral, such as a headset or speakers. Audio output devices are grouped into private and public outputs:

  • Private audio output is intended only for the device user. Audio output devices that fall into this group include, for example, the device earpiece and wireless headsets.

  • Public audio output can be heard by other people than just the device user. Audio output devices that fall into this group include, for example, the device loudspeaker and wireless speakers.

By default, the mobile device routes audio playback to a public audio output when a headset is not connected to the device, and to a private audio output when a headset is connected. The default audio routing automatically switches between public and private outputs when audio peripherals are connected to and disconnected from the device.

To allow MIDlets to control where audio playback is routed, Nokia devices support the AudioOutputControl interface for the Mobile Media API (MMAPI). The interface is supported from Java Runtime 2.1 for Symbian and Series 40 6th Edition, Feature Pack 1 onwards. The interface is packaged as part of the Nokia UI API.

Note: On Series 40 devices, AudioOutputControl is only available to MIDlets that run in the manufacturer or operator domain.

On Symbian devices, MIDlets can additionally monitor for changes in the audio routing. Series 40 devices do not support this feature.

You can use AudioOutputControl together with other Java APIs to create MIDlets for a variety of purposes:

  • A music player can change the audio routing automatically based on the user's location. Audio can be routed to the device loudspeaker when the user is at home and to a headset when the user is at work.

  • A voice mail application allows the user to choose whether to listen to voice mails over the device earpiece or a headset (when in a public place) or from the device loudspeaker (when in private or with friends).

For more information about controlling audio output in your MIDlet, see:

These instructions focus solely on using AudioOutputControl. For detailed instructions on how to create a media player MIDlet, see sections Creating multimedia applications and Using advanced multimedia features.