Methods
0.5.2#
General#
Constructor#
SyncStage(
private val ctx: Context,
var userDelegate: SyncStageUserDelegate? = null,
var connectivityDelegate: SyncStageConnectivityDelegate? = null
)
Constructor parameters:
-
ctx
- Android application context -
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
Initialize#
Initializes the SDK SyncStage object.
fun init(
applicationSecretKey: String? = null,
onCompleted: (errorCode: SyncStageSDKErrorCode) -> Unit = {},
)
Parameters:
-
applicationSecretKey
- if set to null, SDK will look for applicationSecretKey in the SyncStageSecret.json file -
onCompleted
- callback informing about the result of initialization withSyncStageSDKErrorCode
Stop and dispose#
This method stops and cleans up all background tasks SDK performs.
Note
It is crucial to call it onDestroy of the Activity where SyncStage has been initialized in.
Get SyncStage SDK version#
Gets SyncStage SDK version
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.
Session#
Create a session#
Creates a session in a given zone by a given user from your user pool.
suspend fun createSession(
zoneId: String,
studioServerId: String,
userId: String
): Pair<SessionIdentifier?, SyncStageSDKErrorCode>
Parameters:
zoneId
- zone in which we want to host our sessionstudioServerId
- id of the selected studio serveruserId
- id of your app user to match the data between SyncStage and your backend
Join the session#
Joins a particular session identified by sessionCode
.
suspend fun join(
sessionCode: String,
userId: String,
displayName: String? = null,
zoneId: String,
studioServerId: String,
): Pair<Session?, SyncStageSDKErrorCode>
Parameters:
-
sessionCode
- the session code -
userId
- id of your app user to match de data between SyncStage and your backend -
displayName
- your app user display name -
zoneId
- zone in which your session is hosted -
studioServerId
- studio server where you are running your session
Get session state#
Gets state of currently joined session.
Parameters:
completion
- returns session state
Leave the session#
Leaves currently joined session.
Audio setup#
Mute / unmute microphone#
Enables or disables microphone stream.
Parameters:
mute
- desired state of the mute option
Is muted#
Returns state of microphone stream.
Turn on / of direct monitor#
Turns on / of direct monitor.
Parameters:
enable
-true
for turning on direct monitor
Get direct monitor volume#
Returns current direct monitor volume.
Change direct monitor volume#
Changes volume of the direct monitor.
Parameters:
volume
- value from range [0;100]
Get direct monitor state#
Gets direct monitor enabled state
Turn on / of internal microphone#
Turns on / of internal microphone to be used instead of default audio input i.e. headphones mic.
Parameters:
enable
-true
for turning on internal microphone
Get internal microphone state#
Gets internal microphone enabled state
Network measurements#
Get receiver network measurements#
Returns Mesurements object with network delay, jitter, and calculated network quality indicators.
Parameters:
identifier
- receiver's identifier
Get transmitter network measurements#
Returns Mesurements object with network delay, jitter, and calculated network quality indicators.
Latency Optimization Level#
Click here to learn more about the Latency Optimization Level.
Change latency Optimization Level#
Change the latency optimization level using of the following options:
- highQuality
- optimized
- bestPerformance
- ultraFast
value
- latency optimization level value.
Get Latency Optimization Level#
Returns latency optimization level.