-
@Stable() public final class CallThe call class gives you access to all call level API calls
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCall.Debugpublic classCall.Companion
-
Field Summary
Fields Modifier and Type Field Description private StringsessionIdprivate final MutableSharedFlow<VideoEvent>eventsprivate final CallStatestateprivate final <ERROR CLASS>cameraprivate final <ERROR CLASS>microphoneprivate final <ERROR CLASS>speakerprivate final <ERROR CLASS>screenShareprivate final Stringcidprivate VideoFiltervideoFilterprivate InputAudioFilteraudioFilterprivate final StateFlow<Float>localMicrophoneAudioLevelprivate final MutableStateFlow<CallStatsReport>statsReportprivate final MutableStateFlow<List<Integer>>statLatencyHistoryprivate final Call.Debugdebugprivate final Stringtypeprivate final Stringidprivate final Useruser
-
Constructor Summary
Constructors Constructor Description Call(StreamVideo client, String type, String id, User user)
-
Method Summary
Modifier and Type Method Description final StringgetSessionId()final UnitsetSessionId(String sessionId)final MutableSharedFlow<VideoEvent>getEvents()final CallStategetState()The call state contains all state such as the participant list, reactions etc final <ERROR CLASS>getCamera()final <ERROR CLASS>getMicrophone()final <ERROR CLASS>getSpeaker()final <ERROR CLASS>getScreenShare()final StringgetCid()The cid is type:id final VideoFiltergetVideoFilter()Set a custom VideoFilter that will be applied to the video stream coming from your device. final UnitsetVideoFilter(VideoFilter videoFilter)Set a custom VideoFilter that will be applied to the video stream coming from your device. final InputAudioFiltergetAudioFilter()Set a custom InputAudioFilter that will be applied to the audio stream recorded on your device. final UnitsetAudioFilter(InputAudioFilter audioFilter)Set a custom InputAudioFilter that will be applied to the audio stream recorded on your device. final StateFlow<Float>getLocalMicrophoneAudioLevel()final MutableStateFlow<CallStatsReport>getStatsReport()final MutableStateFlow<List<Integer>>getStatLatencyHistory()final Call.DebuggetDebug()final StringgetType()final StringgetId()final UsergetUser()final Result<GetCallResponse>get()Basic crud operations final Result<GetOrCreateCallResponse>create(List<String> memberIds, List<MemberRequest> members, Map<String, Object> custom, CallSettingsRequest settings, OffsetDateTime startsAt, String team, Boolean ring, Boolean notify, Boolean video)Create a call. final Result<UpdateCallResponse>update(Map<String, Object> custom, CallSettingsRequest settingsOverride, OffsetDateTime startsAt)Update a call final Result<RtcSession>join(Boolean create, CreateCallOptions createOptions, Boolean ring, Boolean notify, Boolean hintHighScaleLivestreamPublisher, CallJoinInterceptor callJoinInterceptor)Joins the call. final Result<RtcSession>joinAndRing(List<String> members, CreateCallOptions createOptions, Boolean video, CallJoinInterceptor callJoinInterceptor)final Result<Unit>setE2EEManager(E2EEManager manager)Attaches an end-to-end encryption manager, so that media published from and received by this call is encrypted before it reaches Stream's infrastructure. final UnitfastReconnect(String reason)final Unitrejoin(String reason)final Unitmigrate()final Unitleave(CallLeaveReason reason)final Unitleave(String reason)final Result<Unit>end()ends the call for yourself as well as other users final Result<PinResponse>pinForEveryone(String sessionId, String userId)final Result<UnpinResponse>unpinForEveryone(String sessionId, String userId)final Result<SendReactionResponse>sendReaction(String type, String emoji, Map<String, Object> custom)final Result<QueriedMembers>queryMembers(Map<String, Object> filter, List<SortField> sort, Integer limit, String prev, String next)final Result<MuteUsersResponse>muteAllUsers(Boolean audio, Boolean video, Boolean screenShare)final UnitsetVisibility(String sessionId, TrackType trackType, Boolean visible, String viewportId)final UnitsetVisibility(String sessionId, TrackType trackType, Boolean visible, String viewportId, Integer width, Integer height)final UnithandleEvent(VideoEvent event)final UnitinitRenderer(VideoTextureViewRenderer videoRenderer, String sessionId, TrackType trackType, Function1<VideoTextureViewRenderer, Unit> onRendered, String viewportId)Perhaps it would be nicer to have an interface. final UnitenableClientCapabilities(List<ClientCapability> capabilities)Enables the provided client capabilities. final UnitdisableClientCapabilities(List<ClientCapability> capabilities)Disables the provided client capabilities. final Result<GoLiveResponse>goLive(Boolean startHls, Boolean startRecording, Boolean startTranscription)final Result<StopLiveResponse>stopLive()final Result<SendCallEventResponse>sendCustomEvent(Map<String, Object> data)final Result<Unit>requestPermissions(String permission)Permissions final Result<Object>startRecording()final Result<Object>startRecording(RecordingType recordingType)final Result<Object>stopRecording()final Result<Object>stopRecording(RecordingType recordingType)final UnitstartScreenSharing(Intent mediaProjectionPermissionResultData, Boolean includeAudio)User needs to have OwnCapability.Screenshare capability in order to start screen sharing. final UnitstopScreenSharing()final Result<Object>startHLS()final Result<Object>stopHLS()final EventSubscriptionsubscribeFor(Class<out VideoEvent> eventTypes, VideoEventListener<VideoEvent> listener)final EventSubscriptionsubscribe(VideoEventListener<VideoEvent> listener)final <ERROR CLASS>unsubscribe(EventSubscription eventSubscription)final Result<BlockUserResponse>blockUser(String userId)final Result<UpdateCallMembersResponse>removeMembers(List<String> userIds)final Result<UpdateUserPermissionsResponse>grantPermissions(String userId, List<String> permissions)final Result<UpdateUserPermissionsResponse>revokePermissions(String userId, List<String> permissions)final Result<UpdateCallMembersResponse>updateMembers(List<MemberRequest> memberRequests)final <ERROR CLASS>fireEvent(VideoEvent event)final Result<ListRecordingsResponse>listRecordings(String sessionId)List the recordings for this call. final Result<KickUserResponse>kickUser(String userId, Boolean block)Kick a user from the call. final Result<MuteUsersResponse>muteUser(String userId, Boolean audio, Boolean video, Boolean screenShare)final Result<MuteUsersResponse>muteUsers(List<String> userIds, Boolean audio, Boolean video, Boolean screenShare)final Unitcleanup()final Result<GetCallResponse>ring()final Result<RingCallResponse>ring(RingCallRequest ringCallRequest)final Result<GetCallResponse>notify()final Result<AcceptCallResponse>accept()final Result<RejectCallResponse>reject(RejectReason reason)Should outlive both the call scope and the service scope and needs to be executed in the client-level scope. final UnitprocessAudioSample(JavaAudioDeviceModule.AudioSamples audioSample)final UnitcollectUserFeedback(Integer rating, String reason, Map<String, Object> custom)final BitmaptakeScreenshot(VideoTrack track)final BooleanisPinnedParticipant(String sessionId)final BooleanisServerPin(String sessionId)final BooleanisLocalPin(String sessionId)final BooleanhasCapability(OwnCapability capability)final BooleanisVideoEnabled()final BooleanisAudioProcessingEnabled()Whether noise cancellation is running for this call. final UnitsetAudioProcessingEnabled(Boolean enabled)Turns noise cancellation on or off for this call, and tells the SFU about it. final BooleantoggleAudioProcessing()final Result<StartTranscriptionResponse>startTranscription()final Result<StopTranscriptionResponse>stopTranscription()final Result<ListTranscriptionsResponse>listTranscription()final Result<StartClosedCaptionsResponse>startClosedCaptions()final Result<StopClosedCaptionsResponse>stopClosedCaptions()final UnitupdateClosedCaptionsSettings(ClosedCaptionsSettings closedCaptionsSettings)final UnitsetPreferredIncomingVideoResolution(PreferredVideoResolution resolution, List<String> sessionIds)Sets the preferred incoming video resolution. final UnitsetIncomingVideoEnabled(Boolean enabled, List<String> sessionIds)Enables/disables incoming video feed. final UnitsetIncomingAudioEnabled(Boolean enabled, List<String> sessionIds)Enables or disables the reception of incoming audio tracks for all or specified participants. -
-
Constructor Detail
-
Call
Call(StreamVideo client, String type, String id, User user)
-
-
Method Detail
-
getSessionId
final String getSessionId()
-
setSessionId
final Unit setSessionId(String sessionId)
-
getEvents
final MutableSharedFlow<VideoEvent> getEvents()
-
getState
final CallState getState()
The call state contains all state such as the participant list, reactions etc
-
getCamera
final <ERROR CLASS> getCamera()
-
getMicrophone
final <ERROR CLASS> getMicrophone()
-
getSpeaker
final <ERROR CLASS> getSpeaker()
-
getScreenShare
final <ERROR CLASS> getScreenShare()
-
getVideoFilter
final VideoFilter getVideoFilter()
Set a custom VideoFilter that will be applied to the video stream coming from your device.
-
setVideoFilter
final Unit setVideoFilter(VideoFilter videoFilter)
Set a custom VideoFilter that will be applied to the video stream coming from your device.
-
getAudioFilter
final InputAudioFilter getAudioFilter()
Set a custom InputAudioFilter that will be applied to the audio stream recorded on your device.
-
setAudioFilter
final Unit setAudioFilter(InputAudioFilter audioFilter)
Set a custom InputAudioFilter that will be applied to the audio stream recorded on your device.
-
getLocalMicrophoneAudioLevel
final StateFlow<Float> getLocalMicrophoneAudioLevel()
-
getStatsReport
final MutableStateFlow<CallStatsReport> getStatsReport()
-
getStatLatencyHistory
final MutableStateFlow<List<Integer>> getStatLatencyHistory()
-
getDebug
final Call.Debug getDebug()
-
get
final Result<GetCallResponse> get()
Basic crud operations
-
create
final Result<GetOrCreateCallResponse> create(List<String> memberIds, List<MemberRequest> members, Map<String, Object> custom, CallSettingsRequest settings, OffsetDateTime startsAt, String team, Boolean ring, Boolean notify, Boolean video)
Create a call. You can create a call client side, many apps prefer to do this server side though
-
update
final Result<UpdateCallResponse> update(Map<String, Object> custom, CallSettingsRequest settingsOverride, OffsetDateTime startsAt)
Update a call
-
join
final Result<RtcSession> join(Boolean create, CreateCallOptions createOptions, Boolean ring, Boolean notify, Boolean hintHighScaleLivestreamPublisher, CallJoinInterceptor callJoinInterceptor)
Joins the call. Concurrent callers share one in-flight attempt.
Cancelling this coroutine does not abort that attempt — only leave does.
Join flags (
create,ring, and the rest) come from the caller that created the in-flight attempt. CallJoinInterceptor is first-non-cancelled-wins: the first waiter whose coroutine is not cancelled supplies it. A laterjoin(interceptor)is used only if every earlier waiter has been cancelled.join(null)does not erase an earlier interceptor.
-
joinAndRing
final Result<RtcSession> joinAndRing(List<String> members, CreateCallOptions createOptions, Boolean video, CallJoinInterceptor callJoinInterceptor)
-
setE2EEManager
final Result<Unit> setE2EEManager(E2EEManager manager)
Attaches an end-to-end encryption manager, so that media published from and received by this call is encrypted before it reaches Stream's infrastructure.
Must be called before join. The publisher and subscriber capture the manager when they are built, and the join request tells the coordinator whether this call is encrypted — a mismatch there is rejected server side. The manager survives rejoins and migrations, so it only needs to be set once.
Pass StreamEncryptionManager for Stream's default AES-GCM implementation, or your own E2EEManager to keep the SDK out of your encryption entirely:
StreamEncryptionManager.create(myUserId).onSuccess { e2ee -> e2ee.setSharedKey(keyIndex = 0, key = myKeyBytes) call.setE2EEManager(e2ee) call.join() }Keys stay on the manager, deliberately: keep your reference to it to add, remove and rotate keys, during the call as well as before it. Generating and distributing key material has to stay outside Stream's infrastructure, so the SDK never holds or transports it.
You own the manager's lifecycle too — the SDK does not dispose it, since the same instance is normally reused across rejoins and often across calls.
Note that an encrypted call cannot be recorded, transcribed, closed-captioned, thumbnailed or broadcast over HLS: none of that content is readable by Stream, so the coordinator rejects those requests.
- Parameters:
manager- The manager to use, ornullto join unencrypted.
-
fastReconnect
final Unit fastReconnect(String reason)
-
leave
final Unit leave(CallLeaveReason reason)
-
pinForEveryone
final Result<PinResponse> pinForEveryone(String sessionId, String userId)
-
unpinForEveryone
final Result<UnpinResponse> unpinForEveryone(String sessionId, String userId)
-
sendReaction
final Result<SendReactionResponse> sendReaction(String type, String emoji, Map<String, Object> custom)
-
queryMembers
final Result<QueriedMembers> queryMembers(Map<String, Object> filter, List<SortField> sort, Integer limit, String prev, String next)
-
muteAllUsers
final Result<MuteUsersResponse> muteAllUsers(Boolean audio, Boolean video, Boolean screenShare)
-
setVisibility
final Unit setVisibility(String sessionId, TrackType trackType, Boolean visible, String viewportId)
-
setVisibility
final Unit setVisibility(String sessionId, TrackType trackType, Boolean visible, String viewportId, Integer width, Integer height)
-
handleEvent
final Unit handleEvent(VideoEvent event)
-
initRenderer
final Unit initRenderer(VideoTextureViewRenderer videoRenderer, String sessionId, TrackType trackType, Function1<VideoTextureViewRenderer, Unit> onRendered, String viewportId)
Perhaps it would be nicer to have an interface. Any UI elements that renders video should implement it
And call a callback for
visible/hidden
resolution changes
-
enableClientCapabilities
final Unit enableClientCapabilities(List<ClientCapability> capabilities)
Enables the provided client capabilities.
-
disableClientCapabilities
final Unit disableClientCapabilities(List<ClientCapability> capabilities)
Disables the provided client capabilities.
-
goLive
final Result<GoLiveResponse> goLive(Boolean startHls, Boolean startRecording, Boolean startTranscription)
-
stopLive
final Result<StopLiveResponse> stopLive()
-
sendCustomEvent
final Result<SendCallEventResponse> sendCustomEvent(Map<String, Object> data)
-
requestPermissions
final Result<Unit> requestPermissions(String permission)
Permissions
-
startRecording
final Result<Object> startRecording()
-
startRecording
final Result<Object> startRecording(RecordingType recordingType)
-
stopRecording
final Result<Object> stopRecording()
-
stopRecording
final Result<Object> stopRecording(RecordingType recordingType)
-
startScreenSharing
final Unit startScreenSharing(Intent mediaProjectionPermissionResultData, Boolean includeAudio)
User needs to have OwnCapability.Screenshare capability in order to start screen sharing.
- Parameters:
mediaProjectionPermissionResultData-intent data returned from the activity result after asking for screen sharing permission by launching MediaProjectionManager.createScreenCaptureIntent(). See https://developer.android.com/guide/topics/large-screens/media-projection#recommended_approach
-
stopScreenSharing
final Unit stopScreenSharing()
-
subscribeFor
final EventSubscription subscribeFor(Class<out VideoEvent> eventTypes, VideoEventListener<VideoEvent> listener)
-
subscribe
@Deprecated(level = DeprecationLevel.WARNING, message = Deprecated in favor of the `events` flow., replaceWith = @ReplaceWith(imports = {}, expression = events.collect { })) final EventSubscription subscribe(VideoEventListener<VideoEvent> listener)
-
unsubscribe
@Deprecated(level = DeprecationLevel.WARNING, message = Deprecated in favor of the `events` flow., replaceWith = @ReplaceWith(imports = {}, expression = events.collect { })) final <ERROR CLASS> unsubscribe(EventSubscription eventSubscription)
-
blockUser
final Result<BlockUserResponse> blockUser(String userId)
-
removeMembers
final Result<UpdateCallMembersResponse> removeMembers(List<String> userIds)
-
grantPermissions
final Result<UpdateUserPermissionsResponse> grantPermissions(String userId, List<String> permissions)
-
revokePermissions
final Result<UpdateUserPermissionsResponse> revokePermissions(String userId, List<String> permissions)
-
updateMembers
final Result<UpdateCallMembersResponse> updateMembers(List<MemberRequest> memberRequests)
-
fireEvent
final <ERROR CLASS> fireEvent(VideoEvent event)
-
listRecordings
final Result<ListRecordingsResponse> listRecordings(String sessionId)
List the recordings for this call.
- Parameters:
sessionId-if session ID is supplied, only recordings for that session will be loaded.
-
kickUser
final Result<KickUserResponse> kickUser(String userId, Boolean block)
Kick a user from the call.
- Parameters:
userId-the user to kick
block-if true, the user will be blocked from rejoining the call
-
muteUser
final Result<MuteUsersResponse> muteUser(String userId, Boolean audio, Boolean video, Boolean screenShare)
-
muteUsers
final Result<MuteUsersResponse> muteUsers(List<String> userIds, Boolean audio, Boolean video, Boolean screenShare)
-
ring
final Result<GetCallResponse> ring()
-
ring
final Result<RingCallResponse> ring(RingCallRequest ringCallRequest)
-
notify
final Result<GetCallResponse> notify()
-
accept
final Result<AcceptCallResponse> accept()
-
reject
final Result<RejectCallResponse> reject(RejectReason reason)
Should outlive both the call scope and the service scope and needs to be executed in the client-level scope. Because the call scope or service scope may be cancelled or finished while the network request is still in flight TODO: Run this in clientImpl.scope internally
-
processAudioSample
final Unit processAudioSample(JavaAudioDeviceModule.AudioSamples audioSample)
-
collectUserFeedback
final Unit collectUserFeedback(Integer rating, String reason, Map<String, Object> custom)
-
takeScreenshot
final Bitmap takeScreenshot(VideoTrack track)
-
isPinnedParticipant
final Boolean isPinnedParticipant(String sessionId)
-
isServerPin
final Boolean isServerPin(String sessionId)
-
isLocalPin
final Boolean isLocalPin(String sessionId)
-
hasCapability
final Boolean hasCapability(OwnCapability capability)
-
isVideoEnabled
final Boolean isVideoEnabled()
-
isAudioProcessingEnabled
final Boolean isAudioProcessingEnabled()
Whether noise cancellation is running for this call.
The audio processor supplied to StreamVideoBuilder is a single instance shared by every call, so this state is only meaningful for the call currently in progress. Two calls in progress at once cannot have different noise-cancellation states.
-
setAudioProcessingEnabled
final Unit setAudioProcessingEnabled(Boolean enabled)
Turns noise cancellation on or off for this call, and tells the SFU about it.
Takes effect for the call in progress; see isAudioProcessingEnabled for why the state cannot differ between two calls running at the same time.
-
toggleAudioProcessing
final Boolean toggleAudioProcessing()
-
startTranscription
final Result<StartTranscriptionResponse> startTranscription()
-
stopTranscription
final Result<StopTranscriptionResponse> stopTranscription()
-
listTranscription
final Result<ListTranscriptionsResponse> listTranscription()
-
startClosedCaptions
final Result<StartClosedCaptionsResponse> startClosedCaptions()
-
stopClosedCaptions
final Result<StopClosedCaptionsResponse> stopClosedCaptions()
-
updateClosedCaptionsSettings
final Unit updateClosedCaptionsSettings(ClosedCaptionsSettings closedCaptionsSettings)
-
setPreferredIncomingVideoResolution
final Unit setPreferredIncomingVideoResolution(PreferredVideoResolution resolution, List<String> sessionIds)
Sets the preferred incoming video resolution.
- Parameters:
resolution- The preferred resolution.sessionIds- The participant session IDs to apply the resolution to.
-
setIncomingVideoEnabled
final Unit setIncomingVideoEnabled(Boolean enabled, List<String> sessionIds)
Enables/disables incoming video feed.
- Parameters:
enabled- Whether the video feed should be enabled or disabled.sessionIds- The participant session IDs to enable/disable the video feed for.
-
setIncomingAudioEnabled
final Unit setIncomingAudioEnabled(Boolean enabled, List<String> sessionIds)
Enables or disables the reception of incoming audio tracks for all or specified participants.
This method allows selective control over whether the local client receives audio from remote participants. It's particularly useful in scenarios such as livestreams or group calls where the user may want to mute specific participants' audio without affecting the overall session.
- Parameters:
enabled-trueto enable (subscribe to) incoming audio,falseto disable (unsubscribe from) it.sessionIds- Optional list of participant session IDs for which to toggle incoming audio.
-
-
-
-