Observe call events - KaleyraVideo/VideoAndroidSDK GitHub Wiki
Current call
The current ongoing call can be intercepted by adding the following code:
KaleyraVideo.conference.call.onEach { call ->
}.launchIn(MainScope())
Observe call events
To observe the call state it is necessary to observe the state flow exposed.
call.state.onEach { callState ->
Log.d("CALL STATE", "$callState")
}.launchIn(MainScope())
Observe call recording
Whenever a call is recorded, the call recording type can be either manual (recording is started by admin callee) or automatic (recording starts when the call is connected).
Call.Recording.Type can be retrieved from call info as show below.
call.recording.onEach { callRecordingType ->
Log.d("CALL RECORDING TYPE", "$callRecordingType")
}.launchIn(MainScope())
Call recording state can be observed as shown below:
call.recording.flatMapLatest { it.state }.onEach { callRecordingState ->
Log.d("CALL RECORDING STATE", "$callRecordingState")
}.launchIn(MainScope())