Preview

Preview screen is a frequently used UX element which allows users to check if their input devices are working properly and set the initial state (mute/unmute) of their audio and video tracks before joining. 100ms SDKs provide an easy-to-use API to back this feature. Additionally, the SDK will try to establish a connection to 100ms server to verify there are no network issues and that the auth credentials are valid so that if everything is in order the subsequent room join is instant.

To invoke this API call

hmsSDK.preview(config: config, delegate: previewDelegate)

You would need the same config object that you would pass to join API. The previewDelegate is an object conforming to HMSPreviewListener protocol that has two callbacks:

func onPreview(room: HMSRoom, localTracks: [HMSTrack])

Which is called when SDK has passed all its preflight checks and established the connection to 100ms server. This will pass an array of local tracks that you can display to the user (see Render Video and Mute sections for more details).

If however there was some error related to getting the input sources or some preflight check has failed

func on(error: HMSError)

delegate callback will be fired with the HMSError instance you can use to find what went wrong (see Error Handling).