Methods
0.5.1#
General#
Initialize#
Initializes the SDK SyncStage object.
init(
applicationSecretId: String? = nil,
applicationSecretKey: String? = nil,
completion: @escaping (_ error: SyncStageError?) -> Void
)
Constructor parameters:
-
applicationSecretId
- if set to nil, SDK will look for applicationSecretId in the SyncStageSecret.plist file -
applicationSecretKey
- if set to nil, SDK will look for applicationSecretKey in the SyncStageSecret.plist file -
completion
- closure informs if setup error occurs
Get SDK version#
Returns SDK version.
Get best available server#
Get best available server, where a session can be created
func getBestAvailableServer(completion: @escaping (Swift.Result<SyncStageSDK.ServerInstance, SyncStageSDK.SyncStageError>) -> Swift.Void)
Parameters:
completion
- returns a server instance.
Get server instances#
Get server instances so you can select the server that is suitable for your session.
func getServerInstances(completion: @escaping (Swift.Result<[SyncStageSDK.ServerInstance], SyncStageSDK.SyncStageError>) -> Swift.Void)
Parameters:
completion
- returns a list of servers.
Session#
Create a session#
Creates a session in a given zone by a given user from your user pool.
func createSession(
zoneId: String,
userId: String,
studioServerId: String,
completion: @escaping (Result<SessionIdentifier, SyncStageError>) -> Void
)
Parameters:
zoneId
- zone in which we want to host our sessionuserId
- id of your app user to match the data between SyncStage and your backendstudioServerId
- id of the selected studio serverpreferFastRouting
- prefer fast routing allows better network performancecompletion
- if succeeded returns a SessionIdentifier (session Id and session code)
Join the session#
Joins a particular session identified by sessionCode
.
func join(
sessionCode: String,
userId: String,
displayName: String? = nil,
zoneId: String,
studioServerId: String,
preferFastRouting: Swift.Bool = false,
completion: @escaping (Result<Session, SyncStageError>) -> Void
)
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 -
completion
- if succeeded returns a Session object
Get session state#
Gets state of currently joined session.
Parameters:
completion
- returns session state
Leave the session#
Leaves currently joined session.
Parameters:
completion
- closure informs if leave session error occurs
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.
Change receiver volume#
Return error code if error occured
Parameters:
identifier
- Session receiver identifier.volume
- volume float value between 0 and 100.
Get receiver volume#
Returns receiver volume float value.
Parameters:
identifier
- Session receiver identifier.
Turn on / of direct monitor#
Turns on / of direct monitor.
Parameters:enable
-true
for turning on direct monitor
Get direct monitor volume value#
Returns direct monitor volume float value.
Change direct monitor volume value#
Parameters:
volume
- volume float value between 1 and 100.
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
Network measurements#
Get receiver measurements#
Returns session receiver measurements structure.
Parameters:
identifier
- session receiver identifier
Get transmitter measurements#
Returns session transmitter measurements structure.
Parameters:
identifier
- session transmitter identifier.
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.
Session recording#
Start recording#
Parameters:
completion
- closure informs if start session recording error occurs
Stop recording#
Parameters:
completion
- closure informs if stop session recording error occurs