Skip to content

Methods

0.6.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.

func getSDKVersion() -> String

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 session
  • userId - id of your app user to match the data between SyncStage and your backend
  • studioServerId - id of the selected studio server
  • preferFastRouting - prefer fast routing allows better network performance
  • completion - 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.

func session(completion: @escaping (Result<Session, SyncStageError>)

Parameters:

  • completion - returns session state

Leave the session#

Leaves currently joined session.

func leave(completion: @escaping (_ error: SyncStageError?) -> Void)

Parameters:

  • completion - closure informs if leave session error occurs

Audio setup#

Mute / unmute microphone#

Enables or disables microphone stream.

func toggleMicrophone(mute: Bool)

Parameters:

  • mute- desired state of the mute option

Is muted#

Returns state of microphone stream.

func isMicrophoneMuted() -> Bool

Change receiver volume#

Return error code if error occured

func changeReceiverVolume(identifier: String, volume: Float) -> SyncStageSDK.SyncStageErrorCode

Parameters:

  • identifier- Session receiver identifier.
  • volume- volume float value between 0 and 100.

Get receiver volume#

Returns receiver volume float value.

func getReceiverVolume(identifier: String) -> Float

Parameters:

  • identifier- Session receiver identifier.

Turn on / off direct monitor#

Turns on / off direct monitor.

func toggleDirectMonitor(enable: Bool)
Parameters:
  • enable- true for turning on direct monitor

Get direct monitor volume value#

Returns direct monitor volume float value.

func getDirectMonitorVolume() -> Float

Change direct monitor volume value#

func changeDirectMonitorVolume(volume: Float)

Parameters:

  • volume- volume float value between 1 and 100.

Is direct monitor enabled#

Returns a Bool indicating if the direct monitor is enabled

func isDirectMonitorEnabled() -> Bool

Turn on / off internal microphone#

Turns on / off internal microphone to be used instead of default audio input i.e. headphones mic.

func toggleInternalMic(enable: Bool)

Parameters:

  • enable- true for turning on internal microphone

Network measurements#

Get receiver measurements#

Returns session receiver measurements structure.

func getReceiverMeasurements(identifier: String) -> SyncStageSDK.Measurements

Parameters:

  • identifier- session receiver identifier

Get transmitter measurements#

Returns session transmitter measurements structure.

func getTransmitterMeasurements() -> SyncStageSDK.Measurements

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

func changeLatencyOptimizationLevel(value: SyncStageSDK.LatencyOptimizationLevel)
Parameters:
  • value- latency optimization level value.

Get Latency Optimization Level#

Returns latency optimization level.

func getLatencyOptimizationLevel() -> SyncStageSDK.LatencyOptimizationLevel

Turn on / off noise cancellation#

Turns on / off noise cancellation. This filter is applied on the transmitter (e.g. microphone).

func toggleNoiseCancellation(enabled: Bool)

Session recording#

Start recording#

func startRecording(completion: @escaping (SyncStageError?) -> Void)

Parameters:

  • completion - closure informs if start session recording error occurs

Stop recording#

func stopRecording(completion: @escaping (SyncStageError?) -> Void)

Parameters:

  • completion - closure informs if stop session recording error occurs