Package 

Class PreconnectAudioBufferKt

    • Method Summary

      Modifier and Type Method Description
      final static <T extends Any> <ERROR CLASS> withPreconnectAudio(Room $self, Duration timeout, String topic, Function1<Exception, Unit> onError, SuspendFunction0<T> operation) Starts a pre-connect audio recording that will be sent to any agents that connect within the timeout.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • withPreconnectAudio

        @Deprecated(message = Set AudioTrackPublishDefaults.preconnect = true on the RoomOptions instead.) final static <T extends Any> <ERROR CLASS> withPreconnectAudio(Room $self, Duration timeout, String topic, Function1<Exception, Unit> onError, SuspendFunction0<T> operation)

        Starts a pre-connect audio recording that will be sent to any agents that connect within the timeout. This speeds up preceived connection times, as the user can start speaking prior to actual connection with the agent.

        This will automatically be cleaned up when the room disconnects or the operation fails.

        Example:

        try {
            room.withPreconnectAudio {
                // Audio is being captured automatically
                // Perform any other (async) setup here
                val (url, token) = tokenService.fetchConnectionDetails()
                room.connect(
                    url = url,
                    token = token,
                )
                room.localParticipant.setMicrophoneEnabled(true)
            }
        } catch (e: Throwable) {
            Log.e(TAG, "Error!")
        }
        Parameters:
        timeout - the timeout for the remote participant to subscribe to the audio track.
        topic - the topic to send the preconnect audio buffer to.
        onError - The error handler to call when an error occurs while sending the audio buffer.
        operation - The connection lambda to call with the pre-connect audio.