• Skip to main content
  • Select language
  • Skip to search
mozilla
Mozilla Developer Network
  • Sign in
    • Persona
    • GitHub
  • Web Platform
    Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • APIs / DOM
    • Apps
    • MathML
    References & Guides
    • Learn the Web
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • ...more docs
  • Mozilla Docs
    • Add-ons
    • Firefox
    • Firefox Marketplace
    • Firefox OS
    • Persona
  • Developer Tools
  • Feedback
    • Get Firefox help
    • Get web development help
    • Join the MDN community
    • Report a content problem
    • Report a bug
  •  
B2G OS
    • 한국어
    • Add a translation
  • Edit
  • Advanced
    • History
    • Print this article
  1. MDN
  2. Mozilla
  3. B2G OS
  4. Firefox OS APIs
  5. AudioChannelManager
Your Search Results

    AudioChannelManager

    In This Article
    1. Methods
    2. Properties
      1. Event handlers
    3. Example
    4. Specifications
    5. Browser compatibility
    6. See also

    The AudioChannelManager interface of the AudioChannels API includes features for managing your device's audio channels, including setting what channel's volume to affect when the volume buttons are pressed inside a particular app.

    MethodsEdit

    Note: Inherits methods from its parent, EventTarget

    PropertiesEdit

    Note: Inherits properties from its parent, EventTarget

    AudioChannelManager.headphones Read only
    A boolean that indicates whether headphones are plugged into the device.
    AudioChannelManager.telephonySpeaker
    A boolean that allows you to set whether the "telephony" audio channel should be played out of the device's speakers.
    AudioChannelManager.volumeControlChannel
    A DOMString that allows you to set which audio channel should have its volume changed when you press the device's hardware volume controls.

    Event handlers

    AudioChannelManager.onheadphoneschange
    Fired when the device's headphones are plugged in or unplugged.

    ExampleEdit

    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.

    SpecificationsEdit

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

    Browser compatibilityEdit

    • 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 alsoEdit

    • App permissions for Firefox OS
    • Using the AudioChannels API
    • navigator.mozAudioChannelManager
    • HTMLMediaElement
    Share:
    • Twitter
    • Facebook
    • Google+

    Document Tags and Contributors

    Tags: 
    • API
    • Audio
    • audio
    • AudioChannelManager
    • AudioChannels
    • Firefox OS
    • Interface
    • Non-standard
    • Reference
     Contributors to this page: chrisdavidmills, fscholz
     Last updated by: chrisdavidmills, Feb 11, 2016, 1:48:18 AM
    See also
    1. Audio Channels API
    2. AudioChannelManager
    3. Properties
      1. headphones
      2. onheadphoneschange
      3. telephonySpeaker
      4. volumeControlChannel
    4. Inheritance:
      1. EventTarget
    5. Events
      1. headphoneschange
      2. mozinterruptbegin
      3. mozinterruptend
    6. Related pages for Audio Channels API
      1. BrowserElementAudioChannel
      2. HTMLMediaElement.mozAudioChannelType
      3. HTMLMediaElement.mozchannelpaused
      4. HTMLMediaElement.onmozinterrupbegin
      5. MozAudioChannelManager
      6. Navigator.mozAudioChannelManager

    © 2005-2016 Mozilla Developer Network and individual contributors.

    Content is available under these licenses.

    • About MDN
    • Terms
    • Privacy
    • Cookies
    • Contribute to the code

    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy