CallClient

class CallClient(appContext: Context, lifecycle: Lifecycle?, handler: Handler?)

The main entry point for using daily-android, CallClient is used to join a Daily room with configurable media inputs, as well as quality and bandwidth settings when publishing tracks.

A CallClient instance is pre-configured with reasonable defaults for a high-quality video calling experience, and can be further customized to fit different use cases.

The Lifecycle parameter is optional. If this is provided, the CallClient will automatically be cleaned up when the associated Activity (or other LifecycleOwner) is destroyed.

Note: The CallClient is designed to be used from a single thread.

Return

The newly constructed client.

Parameters

appContext

The application context

lifecycle

Optional: if provided, the CallClient will automatically be cleaned up when the owner of the Lifecycle is destroyed.

handler

Optional: the handler for the thread on which you wish to interact with the CallClient. Callbacks will be given on this thread, and CallClient APIs should also be invoked from this thread. If this is omitted, then the main application thread will be used.

Constructors

Link copied to clipboard
fun CallClient(appContext: Context, lifecycle: Lifecycle? = null, handler: Handler? = null)

Constructs a new instance of a CallClient. This call does not join a room, rather a join must be done explicitly via CallClient.join.

Types

Link copied to clipboard
inner class Beta
Link copied to clipboard
class DailyEncoderFactory : DefaultVideoEncoderFactory
Link copied to clipboard
object GlobalConfig

APIs which affect all CallClient instances

Functions

Link copied to clipboard
fun activeSpeaker(): Participant?

Get the current active speaker.

Link copied to clipboard
fun addCustomAudioTrack(name: CustomTrackName, source: CustomAudioSource, listener: RequestListener)

Adds a new custom audio track, with the specified name and source.

Link copied to clipboard
fun addCustomVideoTrack(name: CustomTrackName, source: CustomVideoSource, listener: RequestListener)

Adds a new custom video track, with the specified name and source.

Link copied to clipboard
fun addListener(callClientListener: CallClientListener)

Adds an event listener to trigger on a specific Daily event.

Link copied to clipboard
fun addLiveStreamingEndpoints(endpoints: LiveStreamEndpoints.Preconfigured, streamId: StreamId? = null, listener: RequestListener? = null)

Adds additional endpoints to an existing live stream.

Link copied to clipboard
@RequiresApi(value = 23)
fun audioDevice(): String?

Get the current audio route which is in use. The deviceId will match the one of the deviceIds returned by availableDevices().

Link copied to clipboard
fun availableDevices(): AvailableDevices

Get the available media devices. (e.g. cameras, microphones, ...)

Link copied to clipboard
fun callConfigFor(url: String, token: MeetingToken? = null, listener: RequestListenerWithData<CallConfiguration>)

Request the Call Configuration for a given Daily room URL.

Link copied to clipboard
fun callState(): CallState

Get the current call state.

Link copied to clipboard
fun ejectRemoteParticipants(ids: List<ParticipantId>, listener: RequestListener? = null)

Eject remote participants.

Link copied to clipboard
fun getNetworkStats(): NetworkStats?
Link copied to clipboard
fun inputs(): InputSettings

Get the current input settings.

Link copied to clipboard
fun join(url: String, meetingToken: MeetingToken? = null, clientSettings: ClientSettingsUpdate? = null, listener: RequestListenerWithData<CallJoinData>)

Joins a room with the specified URL. Optionally, a meeting token and client settings update may also be specified.

Link copied to clipboard
fun leave(listener: RequestListener? = null)

Leaves the current call. If there is no ongoing call, this method does nothing.

Link copied to clipboard
fun localAudioLevel(): Float

Gets the current local audio level.

Link copied to clipboard
fun participantCounts(): ParticipantCounts
Link copied to clipboard
fun participants(): Participants

Get all the participants currently in the call, including the local participant.

Link copied to clipboard
fun publishing(): PublishingSettings

Get the current publishing settings.

Link copied to clipboard
fun release()

Releases the resources owned by this object. If the CallClient was created without providing a Lifecycle, it is mandatory to call this method to avoid memory leaks.

Link copied to clipboard
fun remoteParticipantsAudioLevel(): Map<ParticipantId, Float>

Gets the current audio level of all remote participants.

Link copied to clipboard
fun removeCustomAudioTrack(name: CustomTrackName, listener: RequestListener? = null)

Remove an existing custom audio track with the specified name.

Link copied to clipboard
fun removeCustomVideoTrack(name: CustomTrackName, listener: RequestListener? = null)

Remove an existing custom video track with the specified name.

Link copied to clipboard
fun removeListener(callClientListener: CallClientListener)

Removes an event listener so it no longer triggers on a specific Daily event.

Link copied to clipboard
fun removeLiveStreamingEndpoints(endpoints: LiveStreamEndpoints.Preconfigured, streamId: StreamId? = null, listener: RequestListener? = null)

Removes endpoints from an existing live stream.

Link copied to clipboard
fun sendAppMessage(message: String, recipient: Recipient, listener: RequestListener? = null)

Sends a custom JSON message to the specified recipient(s).

Link copied to clipboard
@RequiresApi(value = 23)
fun setAudioDevice(deviceId: String, listener: RequestListener? = null)

Updates the mobile audio route with the audio device identified by the deviceId argument. The deviceId argument should match the deviceId value returned by availableDevices().

Link copied to clipboard
fun setCameraTorch(enabled: Boolean, listener: RequestListener? = null)

Enable or disable the camera flashlight. The default value is false.

Link copied to clipboard
fun setCameraZoom(ratio: Double, listener: RequestListener? = null)

Sets the camera zoom ratio. The default value is 1.0.

Link copied to clipboard
fun setIceConfig(iceConfig: IceConfig?, listener: RequestListener? = null)

Allows for specifying custom TURN servers rather than only using Daily's default TURN servers.

Link copied to clipboard
fun setInputsEnabled(camera: Boolean? = null, microphone: Boolean? = null, listener: RequestListener? = null)

Enable or disable the camera and/or microphone.

Link copied to clipboard
fun setIsPublishing(camera: Boolean? = null, microphone: Boolean? = null, listener: RequestListener? = null)

Publish or unpublish a camera and/or microphone track.

Link copied to clipboard
fun setProxyUrl(proxyUrl: String?, listener: RequestListener? = null)

For users whose firewall policies prevent them from directly accessing Daily’s domains.

Link copied to clipboard
fun setScreenShareProjectionIntent(mediaProjectionPermissionResultData: Intent)

Intent with the permission for screen sharing.

Link copied to clipboard
fun setSubscriptionProfile(participantIdToProfile: Map<ParticipantId, SubscriptionProfile>, listener: RequestListener? = null)

Assign remote participants to subscription profiles.

fun setSubscriptionProfile(participantId: ParticipantId, profile: SubscriptionProfile, listener: RequestListener? = null)

Assign a remote participant to a subscription profile.

Link copied to clipboard
fun setSubscriptionState(participantIdToState: Map<ParticipantId, SubscriptionState>, listener: RequestListener? = null)

Start or stop subscribing to all tracks from specific remote participants.

fun setSubscriptionState(participantId: ParticipantId, state: SubscriptionState, listener: RequestListener? = null)

Start or stop subscribing to all of a remote participant's tracks.

fun setSubscriptionState(participantId: ParticipantId, camera: SubscriptionState? = null, microphone: SubscriptionState? = null, screenVideo: SubscriptionState? = null, screenAudio: SubscriptionState? = null, listener: RequestListener? = null)

Start or stop subscribing to specific tracks from a remote participant.

Link copied to clipboard
fun setSubscriptionStateForParticipantMedia(participantIdToTracks: Map<ParticipantId, TrackSubscriptionStateUpdate>, listener: RequestListener? = null)

Start or stop subscribing to specific tracks from specific remote participants.

Link copied to clipboard
fun setUserName(userName: String, listener: RequestListener? = null)

Update the participant username.

Link copied to clipboard
fun startLiveStream(endpoints: LiveStreamEndpoints, streamingSettings: StreamingSettings? = null, streamId: StreamId? = null, forceNew: StreamingStartMode = StreamingStartMode.onlyIfNotAlreadyStreaming, listener: RequestListenerWithData<StreamId>? = null)

Starts a live stream.

Link copied to clipboard
fun startLocalAudioLevelObserver(intervalMs: Long? = null, listener: RequestListener? = null)

Starts monitoring the local audio level.

Link copied to clipboard
fun startRecording(streamingSettings: StreamingSettings? = null, streamId: StreamId? = null, forceNew: StreamingStartMode = StreamingStartMode.onlyIfNotAlreadyStreaming, listener: RequestListenerWithData<StreamId>? = null)

Starts a recording, if recording is enabled for the current room.

fun startRemoteParticipantsAudioLevelObserver(intervalMs: Long? = null, listener: RequestListener? = null)

Starts monitoring the audio level from the remote participants.

Link copied to clipboard
fun startScreenShare(mediaProjectionPermissionResultData: Intent, listener: RequestListener? = null)

Starts a screen share from the local participant.

Link copied to clipboard
fun startTranscription(properties: StartTranscriptionProperties, listener: RequestListener? = null)

Starts transcription with the specified properties.

Link copied to clipboard
fun stopLiveStream(streamId: StreamId? = null, listener: RequestListener? = null)

Stops a live stream.

Link copied to clipboard
fun stopLocalAudioLevelObserver(listener: RequestListener? = null)

Stops monitoring the local audio level.

Link copied to clipboard
fun stopRecording(streamId: StreamId? = null, listener: RequestListener? = null)

Stops the specified recording.

Link copied to clipboard
fun stopRemoteParticipantsAudioLevelObserver(listener: RequestListener? = null)

Stops monitoring the audio level from the remote participants.

Link copied to clipboard
fun stopScreenShare(listener: RequestListener? = null)

Stops a current screen share, if there is one.

Link copied to clipboard
fun stopTranscription(listener: RequestListener? = null)

Stops transcription.

Link copied to clipboard

Get the current subscription profiles. This contains the profiles that are currently configured in this call. The 'base' profile is always configured.

Link copied to clipboard
fun subscriptions(): Map<ParticipantId, SubscriptionSettings>

Get the current subscription settings. This contains subscription settings for participants which are already in the call as well as future participants which have been pre-configured.

Link copied to clipboard
fun updateCustomAudioTrack(name: CustomTrackName, source: CustomAudioSource, listener: RequestListener)

Updates an existing custom audio track, with the specified name, to use the specified source.

Link copied to clipboard
fun updateCustomVideoTrack(name: CustomTrackName, source: CustomVideoSource, listener: RequestListener)

Updates an existing custom video track with the specified name, to use the specified source.

Link copied to clipboard
fun updateInputs(inputSettings: Update<InputSettingsUpdate>, listener: RequestListener? = null)

Enable and/or configure media devices for the call, like a camera and microphone. Settings which are not specified in the provided InputSettingsUpdate parameter retain their current values.

Link copied to clipboard
fun updateLiveStream(streamingSettings: StreamingUpdateSettings, streamId: StreamId? = null, listener: RequestListener? = null)

Updates an existing livestream.

Link copied to clipboard
fun updatePermissions(update: ParticipantPermissionsUpdate, listener: RequestListener? = null)

Modify your own permissions.

Link copied to clipboard
fun updatePublishing(publishSettings: Update<PublishingSettingsUpdate>, listener: RequestListener? = null)

Publish and/or change publishing settings (e.g. quality) for different media tracks, like the camera and microphone tracks.

Link copied to clipboard
fun updateRecording(streamingSettings: StreamingUpdateSettings, streamId: StreamId? = null, listener: RequestListener? = null)

Updates the recording options for an existing recording.

Link copied to clipboard
fun updateRemoteParticipants(updatesById: Map<ParticipantId, RemoteParticipantUpdate>, listener: RequestListener? = null)

Modify things about remote participants that you can control as a participant admin or meeting owner.

Link copied to clipboard
fun updateSubscriptionProfiles(subscriptionProfiles: Map<SubscriptionProfile, Update<SubscriptionProfileSettingsUpdate>>, listener: RequestListener? = null)

Insert or modify subscription media settings which apply to an entire profile.

Link copied to clipboard
fun updateSubscriptions(forParticipants: Map<ParticipantId, Update<SubscriptionSettingsUpdate>>, forParticipantsWithProfiles: Map<SubscriptionProfile, Update<SubscriptionSettingsUpdate>>, listener: RequestListener? = null)

Configure how (or if) to subscribe to remote media tracks. Settings can be specified per-participant (either an existing or future participant), or on a per-participant-profile basis. One built-in profile is provided (base), and you may create your own profiles using updateSubscriptionProfiles.

Link copied to clipboard
fun updateSubscriptionsForParticipants(forParticipants: Map<ParticipantId, Update<SubscriptionSettingsUpdate>>, listener: RequestListener? = null)
fun updateSubscriptionsForParticipantsWithProfiles(forParticipantsWithProfiles: Map<SubscriptionProfile, Update<SubscriptionSettingsUpdate>>, listener: RequestListener? = null)

Properties

Link copied to clipboard
val beta: CallClient.Beta

APIs which are currently in beta. These may change at any time.