Skip to main content
Skip table of contents

RapportSession

Nested Classes

WaitForSessionReady

CustomYieldInstruction that waits for the session to be started, connected to the rapport web services, and ready to receive animation and audio data.

WaitForSessionStopped

CustomYieldInstruction that waits for a session to be properly stopped.

Fields

Name

Type

Description

RotationOffset

Vector3

The rotation offset between the web version of the character and how its represented in unity.

ScaleOffset

Vector3

The scale offset between the web version of the character and how its represented in unity

Properties

Name

Type

Description

Events

RapportEvents

A powerful event system that allows your scripts to subscribe and react to various occurrences during a session's lifecycle. These events are essential for building a responsive user interface and handling real-time changes in the session's status.

See RapportEvents

Modules

RapportModules

The RapportModules API is a centralized toolset for integrating core functionalities like facial animation, text-to-speech, speech recognition, and AI interaction.

See RapportModules

SessionDiagnostics

RapportSessionDiagnostics

This class is a diagnostic tool designed to help you monitor the performance of your Rapport session. It provides real-time data on key metrics, such as system time and animation latency. See RapportSessionDiagnostics

IsReady

bool

Returns true when the session is ready to animate and output audio data.

Methods

Name

Return Type

Description

WaitUntilReady()

WaitForSessionReady

This custom yield instruction is used to pause a coroutine until the associated RapportSession is in a fully ready state. It will keep waiting until both Session.sessionStarted and Session.headerReceived are true.

WaitUntilStopped()

WaitForSessionStopped

This custom yield instruction is used to pause a coroutine until the associated RapportSession has completely stopped. It will continue waiting as long as either Session.sessionStarted or Session.headerReceived is true.

BindPlayer(AudioSource outputAudioSource, Animator animator, Vector3? RotationOffset, Vector3? ScaleOffset)

bool

The BindPlayer method initializes a RapportPlayer instance and connects it to the appropriate components for audio and animation. This method should be called only after the session has been successfully started and is ready.

BindPlayer(int id, AudioSource outputAudioSource, Animator animator, Vector3? RotationOffset, Vector3? ScaleOffset)

bool

This is the primary implementation of BindPlayer. It creates and initializes a RapportPlayer for a specific client ID, setting up its audio and animation.

StartSession(IRapportAudioInput audioInput)

void

Starts a Rapport session by setting up the audio input and establishing a connection with the service. This method internally calls the asynchronous StartSessionAsync() method.

StartSessionAsync()

async Task

This method initiates a new session, which is necessary for real-time communication. It sets up the peer connection and prepares the system to handle audio and data.

Note: This method will NOT work without a valid audio input.

StopSession()

void

This method serves as a public entry point to stop the session. It calls the asynchronous StopSessionAsync() method without waiting for its completion, effectively initiating the session termination as a "fire and forget" operation.

StopSessionAsync

async Task

This method safely stops the session. It handles the disconnection, cleans up resources, and resets the session's status to ensure everything is properly shut down.

RestartSession(bool rebindPlayers)

void

This method immediately initiates the process of restarting the session without waiting for it to complete. if rebindPlayers parameter is true, it will also handle the re-connection of existing players to the new session.

RestartSessionAsync(bool rebindPlayers)

async Task

This method gracefully stops the current session and then starts a brand new one. It also handles the re-connection of existing players to the new session.

SetPlayerAnimationBlend(int id, float blendAmount)

void

This method controls how much a player's animation is influenced by the Rapport system. You can blend between the player's standard animator and the real-time Rapport animation.

SetPlayerAnimationBlend(float blendAmount)

void

This is a simplified version of the method above that sets the animation blend for the main player (ID 0).

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.