LogoLogo
ALO.ai
Developer Documentation
Developer Documentation
  • Developer Documentation
  • Developer Account
    • API Key
  • SDKs
    • Authentication
    • Chat
      • Configuration
      • Send Messages
        • Upload Files
      • Message History
      • Message Actions
      • Message Counts
      • Translation
      • Typing Indicators
      • API Reference
        • Event
        • Message
    • Presence
      • Configuration
      • Basic Usage
      • Methods
    • Audio
      • Prerequisites
      • Instantiating Audio Service
      • Connect to a Channel
      • Disconnecting Audio Service
      • Push To Talk (PTT)
      • Full Duplex
      • Mute and Unmute Audio
      • Input/Output Device Selection
        • Microphone Selection
        • Speaker Selection
      • Channel Participants
      • Text To Speech Audio (TTS)
      • Automatic Reconnects
      • Handling Events
      • Classes
        • AloAudio
        • AudioUser
        • AudioChannel
        • Participant
    • Video
      • Prerequisites
      • Instantiating Video Service
      • Connect to a Channel
      • Disconnecting Video Service
      • Input Device Selection
        • Microphone Selection
        • Camera Selection
      • Publishing Streams
      • Modifying Published Streams
      • Channel Participants
      • Rendering Streams
        • Local Stream
        • Remote Streams
      • Muting/Unmuting Remote Streams
      • Recording Video (coming soon)
      • Automatic Reconnects
      • Handling Events
      • Classes
        • AloVideo
        • Participant
        • VideoChannel
        • VideoUser
  • ALO APPS
    • Overview
    • Creating Apps
    • Webhooks
      • Verifying Requests from ALO
    • Custom Action Forms
    • Using the ALO Platform API
  • ALO Platform API
    • Overview
    • Authentication
    • API
      • Actions and Periods
      • Channels
      • Channel Messages
      • Channel Users
      • Direct Message Channels
      • Direct Message Channel Chat Messages
      • Direct Message Channel Users
      • Groups
      • Periods
      • Types
      • Users
      • Video Management System
  • Misc
    • Supported Language Codes
Powered by GitBook
LogoLogo

ALO.ai

  • ALO.ai

© Copyright 2025 ALO.ai, Inc. • All Rights Reserved

On this page
  • Constructor
  • Class Instantiation Properties
  • Methods
  • connect(channel)
  • changeAudioInput(deviceId)
  • changeAudioOutput(deviceId)
  • disconnect()
  • forceReconnectWhenPending()
  • fullDuplexMute()
  • fullDuplexToggleMute()
  • fullDuplexUnmute()
  • getMediaList()
  • pttEnd()
  • pttStart()
  • setUserAuthToken(token)
  1. SDKs
  2. Audio
  3. Classes

AloAudio

Constructor

There are a number of properties available when instantiating the AloAudio class:

Class Instantiation Properties

In order to instantiate the AloAudio object you are required to provide a number of properties. Below are the properties that are available:

Property

Required

Default

Description

user

Yes

userAuthToken

Yes

ttsEnabled

No

false

Set this to true if you want users in the channel to hear TTS audio.

audioInputDeviceId

No

audioOutputDeviceId

No

Example Properties:

let audioProps = {
    user: user,
    aloConnections: aloConnections,
    ttsEnabled: true
};

Instantiating AloAudio

Once you have defined the properties you instantiate as shown:

const aloAudio = new AloAudio(props);

Methods

connect(channel)

Parameter

Type

Description

channel

Defines the channel to connect to in the Audio Service

Example:

aloAudio.connect(audioChannel);

changeAudioInput(deviceId)

Parameter

Type

Description

deviceId

String

changeAudioOutput(deviceId)

Parameter

Type

Description

deviceId

String

disconnect()

Disconnect Related Events

Event

Description

onDisconnect

Once disconnected, either intentionally or due to an error, the onDisconnect event will be dispatched.

forceReconnectWhenPending()

If the connection to the service has been lost and you do not want to wait for the service to automatically try reconnecting you can call this method and an attempt will be made to reconnect immediately.

fullDuplexMute()

fullDuplexToggleMute()

fullDuplexUnmute()

getMediaList()

pttEnd()

pttStart()

setUserAuthToken(token)

Parameter

Type

Description

token

String

PreviousClassesNextAudioUser

Last updated 3 years ago

The that defines the user that is participating in AloAudio.

See for information on acquiring this token.

This is the id of an audio input device (microphone). When specified, this is the device that will be used for audio input. If no device is specified the operating system's default audio input device will be used. For more information see .

This is the id of an audio output device (speakers, headset, etc). When specified, this is the device that will be used for audio output. If no device is specified the operating system's default audio output device will be used. NOTE: This feature is currently only supported within Chrome browsers. For more information see .

Connects the user to a channel in the Audio Service. See .

You can use this method to change the active microphone after connecting to a channel. See .

This is the id of the microphone to be used. See .

You can use this method to change the active speaker after connecting to a channel. See .

This is the id of the speaker to be used. See .

Use this method to disconnect from the Audio Service. See .

Call this method to mute the microphone when you are in a channel.

Call this method to toggle the microphone on/off when you are in a channel.

Call this method to unmute the microphone when you are in a channel.

This method will return the list of available audio input and output devices. See .

This method will release the PTT lock for the given channel (if the current user is currently the owner of the lock). Then the microphone will be disabled. See for more information.

This method will try to acquire the PTT lock for the currently connected channel. If the lock is acquired the user's microphone will be enabled. See for more information.

If the user's authentication token expires you will receive a onInvalidAuthenticationToken event. When you receive the event you must generate a new token and call setUserAuthToken with the new token. Then you must call the method to reconnect.

This is the authentication token needed to access audio rooms. See: for information about obtaining the token.

Connect to a Channel
Microphone Selection
Speaker Selection
Disconnecting Audio Service
Full Duplex
Full Duplex
Full Duplex
Input/Output Device Selection
Push To Talk (PTT)
Push To Talk (PTT)
connect()
AudioUser
Generating User Authentication Tokens
Microphone Selection
Speaker Selection
AudioChannel
Microphone Selection
Speaker Selection
Authentication