# Class: AudioOutputInterface

## Constructor

#### new AudioOutputInterface(audioOutputInterfaceService)

  AudioOutputInterface class provides functionality for managing the audio output device that is used by the user (headphones).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `audioOutputInterfaceService` | AvayaClientServices.Base.AudioOutputInterfaceService |

## Methods

#### getAvailableDevices() → {Array.<AvayaClientServices.Base.VideoDevice>|Array.<AvayaClientServices.Base.AudioDevice>}

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#getAvailableDevices

  ##### Returns:

  { Array.<AvayaClientServices.Base.VideoDevice> | Array.<AvayaClientServices.Base.AudioDevice> }

#### getMediaAccessCapability() → {AvayaClientServices.Base.Capability}

  The function returns capability to perform media access.

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#getMediaAccessCapability

  ##### Returns:

  { AvayaClientServices.Base.Capability }

#### getSelectDeviceCapability() → {AvayaClientServices.Base.Capability}

  The function returns capability to select device.

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#getSelectDeviceCapability

  ##### Returns:

  { AvayaClientServices.Base.Capability }

#### getSelectedDevice() → {AvayaClientServices.Base.VideoDevice}

  The function gets the selected capture device for video.

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#getSelectedDevice

  ##### Returns:

  { AvayaClientServices.Base.VideoDevice }

#### getVolume() → {number}

  Returns the current volume of the audio output for the
  SDK. This is not a reflection of the browser or OS level volume.

  ##### Returns:

  { number }

  Volume level, value between 0 and 1.

#### hasAvailableDevices() → {boolean}

  Returns a boolean indicating if devices of this type exists. This method
  will work prior to the user granting access to the mic/camera media stream.

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#hasAvailableDevices

  ##### Returns:

  { boolean }

#### isMuted() → {boolean}

  Determines whether the audio output is currently muted.

  ##### Returns:

  { boolean }

  Returns true if the audio output is muted and false otherwise.

#### mute() → {void}

  Mutes audio output from the SDK.

  ##### Returns:

  { void }

#### setSelectedDevice(device)

  The function sets the capture device for video. This will not affect any active video sessions.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `device` | AvayaClientServices.Base.VideoDevice | AvayaClientServices.Base.AudioDevice |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#setSelectedDevice

#### setVolume(volumeLevel) → {void}

  Allows the audio output of the SDK to be attenuated.
  This function does not control the browser or OS level volume.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `volumeLevel` | number | value between 0.0 and 1.0

  ##### Throws:

  RangeError

  ##### Returns:

  { void }

#### start() → {AvayaClientServices.Base.Promise}

  Starts media interface

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#start

  ##### Returns:

  { AvayaClientServices.Base.Promise }

#### stop() → {AvayaClientServices.Base.Promise}

  Stop media interface

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#stop

  ##### Returns:

  { AvayaClientServices.Base.Promise }

#### unmute() → {void}

  Unmutes audio output from the SDK.

  ##### Returns:

  { void }

### Managing callbacks

#### addOnDevicesAddedCallback(callback) → {void}

  Add callback on specific event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesAddedCallback | Function to be called

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnDevicesAddedCallback

  ##### Returns:

  { void }

#### addOnDevicesRemovedCallback(callback) → {void}

  Add callback on specific event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesRemovedCallback | Function to be called

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnDevicesRemovedCallback

  ##### Returns:

  { void }

#### addOnDevicesUnavailableCallback(callback) → {void}

  Add callback on specific event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesUnavailableCallback | Function to be called

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnDevicesUnavailableCallback

  ##### Returns:

  { void }

#### addOnSelectedDeviceChangedCallback(callback) → {void}

  Add callback on specific event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onSelectedDeviceChanged | Function to be called

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnSelectedDeviceChangedCallback

  ##### Returns:

  { void }

#### addOnSelectedDeviceRemovedCallback(callback) → {void}

  Add callback on specific event

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onSelectedDeviceRemovedCallback | Function to be called

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnSelectedDeviceRemovedCallback

  ##### Returns:

  { void }

#### cleanUpOnDevicesAddedCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnDevicesAddedCallbacks

  ##### Returns:

  { void }

#### cleanUpOnDevicesRemovedCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnDevicesRemovedCallbacks

  ##### Returns:

  { void }

#### cleanUpOnDevicesUnavailableCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnDevicesUnavailableCallbacks

  ##### Returns:

  { void }

#### cleanUpOnDevicesUpdatedCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnDevicesUpdatedCallbacks

  ##### Returns:

  { void }

#### cleanUpOnSelectedDeviceChangedCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnSelectedDeviceChangedCallbacks

  ##### Returns:

  { void }

#### cleanUpOnSelectedDeviceRemovedCallbacks() → {void}

  Removes all previously added callbacks

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#cleanUpOnSelectedDeviceRemovedCallbacks

  ##### Returns:

  { void }

#### removeOnDevicesAddedCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesAddedCallback | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnDevicesAddedCallback

  ##### Returns:

  { void }

#### removeOnDevicesRemovedCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesRemovedCallback | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnDevicesRemovedCallback

  ##### Returns:

  { void }

#### removeOnDevicesUnavailableCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onDevicesUnavailableCallback | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnDevicesUnavailableCallback

  ##### Returns:

  { void }

#### removeOnDevicesUpdatedCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#addOnDevicesUpdatedCallback | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnDevicesUpdatedCallback

  ##### Returns:

  { void }

#### removeOnSelectedDeviceChangedCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onSelectedDeviceChanged | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnSelectedDeviceChangedCallback

  ##### Returns:

  { void }

#### removeOnSelectedDeviceRemovedCallback(callback) → {void}

  Remove previously added callback

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.MediaInterface#onSelectedDeviceRemovedCallback | Function to be removed

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#removeOnSelectedDeviceRemovedCallback

  ##### Returns:

  { void }

### Callbacks

#### addOnnGestureRequiredCallback(callback)

  Adds new onnGestureRequiredCallbackk.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.AudioOutputInterface#onnGestureRequiredCallback |

  ##### Throws:

  Error

#### removeOnGestureRequiredCallback(callback)

  Removes existing onnGestureRequiredCallbackk.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | AvayaClientServices.Base.AudioOutputInterface#onnGestureRequiredCallback |

  ##### Throws:

  Error

## Type Definitions

#### addOnDevicesUpdatedCallback(mediaInterface, devices) → {void}

  Called to report that audio or video devices label were updated

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |
  `devices` | Array.<AvayaClientServices.Base.VideoDevice> | Array.<AvayaClientServices.Base.AudioDevice> |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#addOnDevicesUpdatedCallback

  ##### Returns:

  { void }

#### onDevicesAddedCallback(mediaInterface, devices) → {void}

  Called to report that audio or video devices were added

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |
  `devices` | Array.<AvayaClientServices.Base.VideoDevice> | Array.<AvayaClientServices.Base.AudioDevice> |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#onDevicesAddedCallback

  ##### Returns:

  { void }

#### onDevicesRemovedCallback(mediaInterface, devices) → {void}

  Called to report that audio or video devices were removed

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |
  `devices` | Array.<AvayaClientServices.Base.VideoDevice> | Array.<AvayaClientServices.Base.AudioDevice> |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#onDevicesRemovedCallback

  ##### Returns:

  { void }

#### onDevicesUnavailableCallback(mediaInterface) → {void}

  Called to report that no device is available

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#onDevicesUnavailableCallback

  ##### Returns:

  { void }

#### onnGestureRequiredCallback(playAudio)

  Interface for the callback function to be invoked when gesture is required to continue playing audio track.
  At this time this is only needed with Edge Chromium when autoplay is fully blocked by the browser settings.
  Data only conference should NOT register for this callback.

  ##### Example

      mediaEngine.getAudioInterface().getOutputInterface().addOnGestureRequiredCallback(function(playAudio) {
                var gestureButton = $("#GestureButton");
                gestureButton.attr('style', 'visibility: visible; display: block'); // Show the gesture button

                gestureButton.on('click', function(evt) {
                   playAudio(evt);
                   gestureButton.attr('style', 'visibility: hidden; display: none'); // Hide the gesture button
                });
                // Optional
                window.alert("To unmute remote audio: right click on remote video, enable control, and click on the muted icon");
            });

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `playAudio` | function | Audio playback function that should be called inside client application gesture Button.onClick()

#### onSelectedDeviceChanged(mediaInterface, device) → {void}

  Called to report that device was changed

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |
  `device` | AvayaClientServices.Base.AudioDevice | AvayaClientServices.Base.VideoDevice |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#onSelectedDeviceChanged

  ##### Returns:

  { void }

#### onSelectedDeviceRemovedCallback(mediaInterface, device) → {void}

  Called to report that selected device was removed

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mediaInterface` | AvayaClientServices.Base.MediaInterface |
  `device` | AvayaClientServices.Base.VideoDevice | AvayaClientServices.Base.AudioDevice |

  Inherited From:
    - AvayaClientServices.Base.MediaInterface#onSelectedDeviceRemovedCallback

  ##### Returns:

  { void }