AVMaster

AVMaster

The master Audio/Video controller instance. This is available as the singleton game.webrtc

Constructor

new AVMaster(settings)

Source:
Parameters:
Name Type Description
settings AVSettings

The Audio/Video settings to use

Members

_connected :boolean

Source:

Flag to determine if we are connected to the signalling server or not. This is required for synchronization between connection and reconnection attempts.

Type:
  • boolean

broadcasting :boolean

Source:

A flag to track whether the current user is actively broadcasting their microphone.

Type:
  • boolean

client :AVClient

Source:

The Audio/Video client class

Type:

Methods

_onPTTEnd(event)

Source:

Handle deactivation of a push-to-talk key or button.

Parameters:
Name Type Description
event KeyboardEvent | MouseEvent

The original keyup event

_onPTTStart(event)

Source:

Handle activation of a push-to-talk key or button.

Parameters:
Name Type Description
event KeyboardEvent | MouseEvent

The original keydown event

_resetSpeakingHistory(userId)

Source:

Resets the speaking history of a user If the user was considered speaking, then mark them as not speaking

Parameters:
Name Type Description
userId string

The ID of the user

activateVoiceDetection(userId, stream, msopt)

Source:

Activate voice detection tracking for a userId on a provided MediaStream. Currently only a MediaStream is supported because MediaStreamTrack processing is not yet supported cross-browser.

Parameters:
Name Type Attributes Description
userId string

The Foundry User ID whose voice is being processed

stream MediaStream

The MediaStream which corresponds to that User

ms number <optional>

A number of milliseconds which represents the voice activation volume interval

broadcast(intent)

Source:

Trigger a change in the audio broadcasting state when using a push-to-talk workflow.

Parameters:
Name Type Description
intent boolean

The user's intent to broadcast. Whether an actual broadcast occurs will depend on whether or not the user has muted their audio feed.

canUserBroadcastAudio(userId) → {boolean}

Source:

A user can broadcast audio if the AV mode is compatible and if they are allowed to broadcast.

Parameters:
Name Type Description
userId string
Returns:
Type
boolean

canUserBroadcastVideo(userId) → {boolean}

Source:

A user can broadcast video if the AV mode is compatible and if they are allowed to broadcast.

Parameters:
Name Type Description
userId string
Returns:
Type
boolean

canUserShareAudio(userId) → {boolean}

Source:

A user can share audio if they are allowed to broadcast and if they have not muted themselves or been blocked.

Parameters:
Name Type Description
userId string
Returns:
Type
boolean

canUserShareVideo(userId) → {boolean}

Source:

A user can share video if they are allowed to broadcast and if they have not hidden themselves or been blocked.

Parameters:
Name Type Description
userId string
Returns:
Type
boolean

(async) connect() → {Promise.<boolean>}

Source:

Connect to the Audio/Video client.

Returns:

Was the connection attempt successful?

Type
Promise.<boolean>

deactivateVoiceDetection(userId)

Source:

Actions which the orchestration layer should take when a peer user disconnects from the audio/video service.

Parameters:
Name Type Description
userId string

The id of the disconnecting User

(async) disconnect() → {Promise.<boolean>}

Source:

Disconnect from the Audio/Video client.

Returns:

Whether an existing connection was terminated?

Type
Promise.<boolean>

onRender()

Source:

Render the audio/video streams to the CameraViews UI. Assign each connected user to the correct video frame element.

onSettingsChanged(changed)

Source:

Respond to changes which occur to AV Settings. Changes are handled in descending order of impact.

Parameters:
Name Type Description
changed Object

The object of changed AV settings

(async) reestablish() → {Promise.<void>}

Source:

Callback actions to take when the user becomes disconnected from the server.

Returns:
Type
Promise.<void>