• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. B2G OS APIs
  5. AudioChannelManager
  6. AudioChannelManager.volumeControlChannel

AudioChannelManager.volumeControlChannel

In This Article
  1. Syntax
    1. Value
  2. Example
  3. Specifications
  4. Browser compatibility
  5. See also

The volumeControlChannel property of the AudioChannelManager interface returns a DOMString that allows you to set which audio channel should have its volume changed when you press the device's hardware volume controls.

Syntax

var myVolumeControlChannelValue = navigator.mozAudioChannelManager.volumeControlChannel;
navigator.mozAudioChannelManager.volumeControlChannel = 'content';

Value

A Boolean value

Example

In the following simple example, we use the navigator.mozAudioChannelManager property to access the app's AudioChannelManager object, first to do some rudimentary feature detection, and then to set value of the AudioChannelManager.volumeControlChannel property, based on a received variable.

var channelValue = 'content';
if (navigator.mozAudioChannelManager) {
  if(channelValue == 'normal') {
    navigator.mozAudioChannelManager.volumeControlChannel = 'normal';
  } else if(channelValue == 'content') {
    navigator.mozAudioChannelManager.volumeControlChannel = 'content';
  }
  console.log(navigator.mozAudioChannelManager.volumeControlChannel);
}

Note: For a complete working example, see our audio-channels-demo. Try running this on your Firefox OS device as an installed app (install it using App Manager/WebIDE) and then see what happens when you play the music and then put the app in the background, with the channel set to normal, then content.

Specifications

The AudioChannels API has no official spec at the moment; see https://wiki.mozilla.org/WebAPI/AudioChannels for implementation details, WebIDL, etc.

Browser compatibility

  • Desktop
  • Mobile
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
General support No support No support No support No support No support
Feature Android Chrome Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
General support No support No support No support 1.0.1 No support No support No support

See also

  • App permissions for Firefox OS
  • Using the AudioChannels API
  • navigator.mozAudioChannelManager
  • HTMLMediaElement

Document Tags and Contributors

Tags: 
  • API
  • Audio
  • AudioChannelManager
  • AudioChannels
  • Firefox OS
  • Non-standard
  • Property
  • Reference
  • volumeControlChannel
 Contributors to this page: chrisdavidmills, fscholz
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:09:15 AM
See also
  1. Audio Channels API
  2. Archive
  3. Events
    1. headphoneschange
    2. mozinterruptbegin
    3. mozinterruptend
  4. Related pages for Audio Channels API
    1. BrowserElementAudioChannel
    2. HTMLMediaElement.mozAudioChannelType
    3. HTMLMediaElement.mozchannelpaused
    4. HTMLMediaElement.onmozinterrupbegin
    5. MozAudioChannelManager
    6. Navigator.mozAudioChannelManager