createSession

suspend fun createSession(catalog: Catalog): ShazamKitResult<ShazamKitException, Session>

Creates a Session that can be used to match Signatures. If the source of audio is in realtime (eg. a microphone) see createStreamingSession.

Example usage:

    viewModelScope.launch {
when (val result = ShazamKit.createSession(catalog)) {
is Success -> {
val session = result.data
session.match(signature)
}
is Failure -> error("Error: ${result.reason}")
}

This is safe to call on Main dispatcher.

Return

An ShazamKitResult object containing either the SignatureGenerator or an ShazamKitException if an error occurred.

Parameters

catalog

The store of signatures to match against. See createShazamCatalog to obtain a catalog that matches the provided signature with the Shazam Service.