val participant = call.state.participants.value[0]
val participantVideoTrack = participant.videoTrack.value
if (participantVideoTrack != null) {
val bitmap = call.takeScreenshot(participantVideoTrack)
// display, save or share the bitmap
}
Screenshots
You can take a picture of a VideoTrack
at highest possible resolution by using Call.takeScreenshot(videoTrack): Bitmap
. This can be useful for example if you want to take a screenshot of a screenshare at full resolution.
You need to get the right VideoTrack
to take the screenshot first - the selection depends on your use case. Let’s for example take the first participant in the list of participants in a Call:
A VideoTrack
can be null when the current participant video is not visible on the screen. Video is only streamed from participants that are currently visible.
Or for example if you specifically want to take a screenshot of a screenshare session:
val screenshareSession = call.state.screenSharingSession.value
val screenShareTrack = screenshareSession?.participant?.screenSharingTrack?.value
if (screenShareTrack != null) {
val bitmap = call.takeScreenshot(screenShareTrack)
// display, save or share the bitmap
}