AloVideo

Constructor

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

Class Instantiation Properties

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

Property

Required

Description

user

Yes

The VideoUser that defines the user that is participating in AloVideo.

userAuthToken

Yes

See Authentication Token for information on acquiring this token.

languageCode

en-US

BCP 47 language code that denotes the language that user speaks. This is helps the Video Service transcribe the user's audio. See: Supported Language Codes.

audioInputDeviceId

No

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.

videoInputDeviceId

No

This is to be the id of a video input device (i.e. webcam). When specified, this is the device that will be used for video input. If no device is specified the operating system's default video input device will be used.

Example Properties

  const user = new VideoUser(
    "12345",
    {      
      name: "James Jones",
      deviceId: "abcd-efsg-wqer-qewe"
    }
  );
  
  const props = {
    user: user,
    aloConnections: aloConnections
  };

Instantiating AloVideo

const aloVideo = new AloVideo(props);

Methods

connect(channel)

Connects the user to a channel in the Video Service. See Connect to a Channel.

Parameter

Type

Description

channel

Defines the channel to connect to in the Video Service

Example:

aloAudio.connect(audioChannel);

changeAudioInput(deviceId)

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

Parameter

Type

Description

deviceId

String

This is the id of the microphone to be used. See Input Device Selection.

changeVideoInput(deviceId)

You can use this method to change the active camera after connecting to a channel. See Input Device Selection.

Parameter

Type

Description

deviceId

String

This is the id of the camera to be used. See Input Device Selection.

disconnect()

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

Event

Description

onDisconnect

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

enableAudio(enable)

While publishing a stream you can change whether or not the stream should include audio.

Parameter

Type

Description

enable

Boolean

When you pass the value of false the audio track in your published stream will be disabled.

enableVideo(enable)

While publishing a stream you can change whether or not the stream should include video.

Parameter

Type

Description

enable

Boolean

When you pass the value of false the video track in your published stream will be disabled.

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.

getMediaList()

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

muteParticipant(participantId, muted)

This method it used to mute the audio track of a participant's stream. See Muting/Unmuting Remote Streams.

Parameter

Type

Description

participantId

String

The id pf the participant to mute/unmute

mute

Boolean

When true the participant's audio will be muted.

publishStream([options])

This method will publish a stream to the channel the user is currently connected to. See Publishing Streams.

Option

Default

Description

sendAudio

true

Include audio with the published stream.

sendVideo

true

Include video with the published stream.

setUserAuthToken(token)

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 connect()method to reconnect.

Parameter

Type

Description

token

String

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

unpublishStream()

If you are currently publishing a stream, this method will end the stream publication.

Last updated

Logo

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