Methods
Constructor#
class SyncStage implements ISyncStage{
constructor(
userDelegate: ISyncStageUserDelegate | null,
connectivityDelegate: ISyncStageConnectivityDelegate | null,
desktopAgentDelegate: ISyncStageDesktopAgentDelegate | null,
desktopAgentPort: number = 18080,
);
}
Constructor parameters:
-
userDelegate
- delegate object to receive events about users in session state -
connectivityDelegate
- delegate object to receive events with information about stream connection to Studio Server state -
desktopAgentDelegate
- delegate object to receive events with information of desktop agent acquisition and release to prevent users from using SyncStage in multiple browser tabs at once -
desktopAgentPort
- port for communication with local desktop agent, 18080 by default
Initialize#
Initializes the SDK SyncStage object.
async init(
applicationSecretId: string,
applicationSecretKey: string
): Promise<SyncStageSDKErrorCode>
Parameters:
-
applicationSecretKey
- secret for SDK provisioning -
applicationSecretId
- id of secret for SDK provisioning
Get is desktop agent connected#
Checks if desktop agent is running and available on the localhost.
Get SDK version#
Gets SDK version.
Update Desktop Agent reconnected callback#
Parameters:
onDesktopAgentReconnected
- method to be called when the Desktop Agent reconnect to the browser SDK. In this metod session state should be refetched and synchronized on the UI.
Get best available server#
Get best available server, where a session can be created
Get server instances#
Get server instances so you can select the server that is suitable for your session.
Create a session#
Creates a session in a given zone by a given user from your user pool.
async createSession(
zoneId: string,
studioServerId: string,
userId: string
): Promise<[ISessionIdentifier | null, SyncStageSDKErrorCode]>
Parameters:
zoneId
- zone in which your session is hostedstudioServerId
- studio server where you are running your sessionuserId
- id of your app user to match the data between SyncStage and your backend
Join the session#
Joins a particular session identified by sessionCode
.
async join(
sessionCode: string,
userId: string,
zoneId: string,
studioServerId: string,
displayName?: string | null,
): Promise<[ISession | null, SyncStageSDKErrorCode]>
Parameters:
-
sessionCode
- the session code -
userId
- id of your app user to match de data between SyncStage and your backend -
zoneId
- zone in which your session is hosted -
studioServerId
- studio server where you are running your session -
displayName
- your app user display name
Get session state#
Gets state of currently joined session.
Leave the session#
Leaves currently joined session.
Mute / unmute microphone#
Enables or disables microphone stream.
Parameters:
mute
- desired state of the mute option
Is muted#
Returns state of microphone stream.
Get receiver network measurements#
Returns Measurements object with network delay, jitter, and calculated network quality indicators.
async getReceiverMeasurements(identifier: string): Promise<[IMeasurements | null, SyncStageSDKErrorCode]>
Parameters:
identifier
- receiver's identifier
Get transmitter network measurements#
Returns Measurements object with network delay, jitter, and calculated network quality indicators.
Start recording#
Stop recording#
Register Desktop Agent Reconnected Callback#
In case of reconnection UI application should be aware of this fact, to refetch the session state to keep it synchronized.
Parameters:
onWebsocketReconnected
- callback
Unregister Desktop Agent Reconnected Callback#
Remove the callback in the SyncStage.