You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mozBrowser.allowedAudioChannels: List of audio channels allowed to play. Implement this like DOMTokenList { 0: "class1", 1: "class2", 2: "class3", length: 3, add: function, remove: function, toggle: function, contains: function }2.
mozBrowser.audioChannels['channelName'].volume: 0 to 1, set/get volumes of all allowed audio channels.
mozBrowser.audioChannels['channelName'].paused: boolean, true means pause the playing, false means allow the playing.
mozBrowser.activeAudioChannels: List of active audio channels.
Events
mozaudiochannelchange: Sent when audio channel changes.
mozaudiochannelchange
Properties
Detail
channel: A new audio channel app would like to play.
state: States of the audio channel: start, pause and end.
varaudioChannelManager=newAudioChannelManager();// When a new app is opened, add it into AudioChannelManager.audioChannelManager.register(newApp);
functionAudioChannelManager(){this._playingApps=[];}AudioChannelManager.prototype={// A list of mozBrowser elements._playingApps: null,register: function(appElement){appElement.addEventListener('mozaudiochannelchange',function(evt){varchannel=evt.detail.channel;if(this.isAllowed(channel)){varplayingApps=this._playingApps;playingApps.forEach(function(ele){// Deny all channels.varallowedAudioChannels=ele.allowedAudioChannels;Array.prototype.forEach.call(allowedAudioChannels,function(channel){allowedAudioChannels.remove(channel);});});playingApps=[];appElement.allowedAudioChannels.add(channel);playingApps.push(appElement);}});},isAllowed: function(audioChannel){// Compete with `_playingApps`.}};