CallExtensionScope


@ExperimentalAppActions
public interface CallExtensionScope


Provides a scope where extensions can be first initialized and next managed for a Call once onConnected is called.

The following extension is supported on a call:

class InCallServiceImpl : InCallServiceCompat() {
...
override fun onCallAdded(call: Call) {
lifecycleScope.launch {
connectExtensions(context, call) {
// Initialize extensions
onConnected { call ->
// change call states & listen for extension updates/send extension actions
}
}
// Once the call is destroyed, control flow will resume again
}
}
...
}

Summary

Public methods

abstract @NonNull LocalCallSilenceExtensionRemote
addLocalCallSilenceExtension(
    @NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated
)

Add support for this remote surface to display information related to the local call silence state for this call.

abstract @NonNull ParticipantExtensionRemote
addParticipantExtension(
    @NonNull SuspendFunction1<ParticipantUnit> onActiveParticipantChanged,
    @NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated
)

Add support for this remote surface to display information related to the Participants in this call.

abstract void
onConnected(@NonNull SuspendFunction1<@NonNull CallUnit> block)

Called when the Call extensions have been successfully set up and are ready to be used.

Public methods

addLocalCallSilenceExtension

Added in 1.0.0-beta01
abstract @NonNull LocalCallSilenceExtensionRemote addLocalCallSilenceExtension(
    @NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated
)

Add support for this remote surface to display information related to the local call silence state for this call.

connectExtensions(call) {
val localCallSilenceExtension = addLocalCallSilenceExtension(
// consume local call silence state changes
)
onConnected {
// At this point, support for the local call silence extension will be known
}
}
Parameters
@NonNull SuspendFunction1<@NonNull BooleanUnit> onIsLocallySilencedUpdated

Called when the local call silence state has changed and the UI should be updated.

Returns
@NonNull LocalCallSilenceExtensionRemote

The interface that is used to interact with the local call silence extension methods.

addParticipantExtension

abstract @NonNull ParticipantExtensionRemote addParticipantExtension(
    @NonNull SuspendFunction1<ParticipantUnit> onActiveParticipantChanged,
    @NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated
)

Add support for this remote surface to display information related to the Participants in this call.

connectExtensions(call) {
val participantExtension = addParticipantExtension(
// consume participant changed events
)
onConnected {
// extensions have been negotiated and actions are ready to be used
}
}
Parameters
@NonNull SuspendFunction1<ParticipantUnit> onActiveParticipantChanged

Called with the active Participant in the call has changed. If this method is called with a null Participant, there is no active Participant. The active Participant in the call is the Participant that should take focus and be either more prominent on the screen or otherwise featured as active in UI. For example, this could be the Participant that is actively talking or presenting.

@NonNull SuspendFunction1<@NonNull Set<@NonNull Participant>, Unit> onParticipantsUpdated

Called when the Participants in the Call have changed and the UI should be updated.

Returns
@NonNull ParticipantExtensionRemote

The interface that is used to set up additional actions for this extension.

onConnected

Added in 1.0.0-beta01
abstract void onConnected(@NonNull SuspendFunction1<@NonNull CallUnit> block)

Called when the Call extensions have been successfully set up and are ready to be used.

Parameters
@NonNull SuspendFunction1<@NonNull CallUnit> block

Called when the Call and initialized extensions are ready to be used.