Version: Smart Feature Phone 3.0

AudioChannelClient

Description#

TBD


Interfaces#

interface AudioChannelClient : EventTarget {
[Throws]
constructor(AudioChannel aChannel);
// Called when APP wants to occupy the audio channel which is specified in the
// constructor. After calling this function, it doesn't mean that this channel
// is immediately unmuted. APP may want to hook onstatechange handler in order
// to be notified when muted state changes.
// This function is useful for APP which wants background music/FM to be
// muted.
[Throws]
void requestChannel();
// Called when APP no longer wants to occupy the audio channel. APP must call
// this function if it has called requestChannel().
[Throws]
void abandonChannel();
// This event is dispatched when muted state changes. APP should check
// channelMuted attribute to know current muted state.
attribute EventHandler onstatechange;
// When channelMuted is false, it means APP is allowed to play content through
// this channel. It also means the competing channel may be muted, or its
// volume may be reduced.
// If the channel owned by us is suspended (muted), or APP did not request
// channel, or APP has abandoned the channel, channelMuted is set to true.
readonly attribute boolean channelMuted;
};

Examples#

navigator.b2g.AudioChannelManager.volumeControlChannel = 'normal'
AudioChannelClient('normal')
HTMLMediaElement.mozAudioChannelType = 'normal'
AudioContext.mozAudioChannelType = 'normal'
navigator.b2g.AudioChannelManager.volumeControlChannel = 'content'
AudioChannelClient('content')
HTMLMediaElement.mozAudioChannelType = 'content'
AudioContext.mozAudioChannelType = 'content'
navigator.b2g.AudioChannelManager.volumeControlChannel = 'notification'
AudioChannelClient('notification')
HTMLMediaElement.mozAudioChannelType = 'notification'
AudioContext.mozAudioChannelType = 'notification'
navigator.b2g.AudioChannelManager.volumeControlChannel = 'alarm'
AudioChannelClient('alarm')
HTMLMediaElement.mozAudioChannelType = 'alarm'
AudioContext.mozAudioChannelType = 'alarm'
navigator.b2g.AudioChannelManager.volumeControlChannel = 'system'
AudioChannelClient('system')
HTMLMediaElement.mozAudioChannelType = 'system'
AudioContext.mozAudioChannelType = 'system'