@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
174 lines • 12.1 kB
TypeScript
import { CommunicationIdentifierKind } from '@azure/communication-common';
import { AudioDeviceInfo, DeviceAccess, DominantSpeakersInfo, ParticipantRole, ScalingMode, VideoDeviceInfo } from '@azure/communication-calling';
import { RealTimeTextInfo as AcsRealTimeTextInfo } from '@azure/communication-calling';
import { BreakoutRoom, BreakoutRoomsSettings, MediaAccess, MeetingMediaAccess, RaisedHand } from '@azure/communication-calling';
import { TeamsMeetingAudioConferencingDetails } from '@azure/communication-calling';
import { CapabilitiesChangeInfo, ParticipantCapabilities } from '@azure/communication-calling';
import { TeamsCaptionsInfo } from '@azure/communication-calling';
import { CaptionsKind, CaptionsInfo as AcsCaptionsInfo } from '@azure/communication-calling';
import { EnvironmentInfo } from '@azure/communication-calling';
import { TogetherModeVideoStream, TogetherModeSeatingMap } from '@azure/communication-calling';
import { CallEndReason, CallState as CallStatus, RemoteParticipantState as RemoteParticipantStatus } from '@azure/communication-calling';
import { CallState, CallClientState, LocalVideoStreamState, RemoteParticipantState, RemoteVideoStreamState, IncomingCallState, VideoStreamRendererViewState, CallAgentState, CallErrorTarget } from './CallClientState';
import { NotificationTarget, CallNotification } from './CallClientState';
import { TeamsIncomingCallState } from './CallClientState';
import { AcceptedTransfer } from './CallClientState';
import { LocalVideoStreamVideoEffectsState } from './CallClientState';
import { ReactionMessage } from '@azure/communication-calling';
import { SpotlightedParticipant } from '@azure/communication-calling';
import { CallFeatureStreamState } from './CallClientState';
/**
* @private
*/
export declare const MAX_CALL_HISTORY_LENGTH = 10;
/**
* @private
*/
export declare const REACTION_ANIMATION_TIME_MS = 4133;
/**
* @private
*/
export declare class CallContext {
private _logger;
private _state;
private _emitter;
private _atomicId;
private _callIdHistory;
private _timeOutId;
private _latestCallIdOfNotification;
private _openBreakoutRoom;
constructor(userId: CommunicationIdentifierKind, maxListeners?: number);
getState(): CallClientState;
modifyState(modifier: (draft: CallClientState) => void): void;
onStateChange(handler: (state: CallClientState) => void): void;
offStateChange(handler: (state: CallClientState) => void): void;
clearCallRelatedState(): void;
setCallAgent(callAgent: CallAgentState): void;
setCall(call: CallState): void;
removeCall(callId: string): void;
setCallEnded(callId: string, callEndReason: CallEndReason | undefined): void;
setCallState(callId: string, state: CallStatus): void;
setCallId(newCallId: string, oldCallId: string): void;
setEnvironmentInfo(envInfo: EnvironmentInfo): void;
setCallIsScreenSharingOn(callId: string, isScreenSharingOn: boolean): void;
setCallRemoteParticipants(callId: string, addRemoteParticipant: RemoteParticipantState[], removeRemoteParticipant: string[]): void;
setCallRemoteParticipantsEnded(callId: string, addRemoteParticipant: RemoteParticipantState[], removeRemoteParticipant: string[]): void;
setCallLocalVideoStream(callId: string, streamsAdded: LocalVideoStreamState[], streamsRemoved: LocalVideoStreamState[]): void;
setCallLocalVideoStreamVideoEffects(callId: string, videoEffects: LocalVideoStreamVideoEffectsState): void;
setCallIsMicrophoneMuted(callId: string, isMicrophoneMuted: boolean): void;
setRole(callId: string, role: ParticipantRole): void;
setCallDominantSpeakers(callId: string, dominantSpeakers: DominantSpeakersInfo): void;
setCallRecordingActive(callId: string, isRecordingActive: boolean): void;
setCallPPTLiveActive(callId: string, isActive: boolean): void;
setCallParticipantPPTLive(callId: string, participantKey: string, target: HTMLElement | undefined): void;
setTogetherModeVideoStreams(callId: string, addedStreams: CallFeatureStreamState[], removedStreams: CallFeatureStreamState[]): void;
setTogetherModeVideoStreamIsAvailable(callId: string, streamId: number, isAvailable: boolean): void;
setTogetherModeVideoStreamIsReceiving(callId: string, streamId: number, isReceiving: boolean): void;
setTogetherModeVideoStreamSize(callId: string, streamId: number, size: {
width: number;
height: number;
}): void;
removeTogetherModeVideoStream(callId: string, removedStream: TogetherModeVideoStream[]): void;
setTogetherModeSeatingCoordinates(callId: string, seatingMap: TogetherModeSeatingMap): void;
setCallRaisedHands(callId: string, raisedHands: RaisedHand[]): void;
setParticipantIsRaisedHand(callId: string, participantKey: string, raisedHand: RaisedHand | undefined): void;
setReceivedReactionFromParticipant(callId: string, participantKey: string, reactionMessage: ReactionMessage | null): void;
setCallTranscriptionActive(callId: string, isTranscriptionActive: boolean): void;
setCapabilities(callId: string, capabilities: ParticipantCapabilities, capabilitiesChangeInfo: CapabilitiesChangeInfo): void;
setHideAttendeeNames(callId: string, capabilitiesChangeInfo: CapabilitiesChangeInfo): void;
setSpotlight(callId: string, spotlightedParticipants: SpotlightedParticipant[], maxParticipantsToSpotlight: number): void;
setTeamsMeetingConference(callId: string, teamsMeetingConferenceDetails: TeamsMeetingAudioConferencingDetails): void;
setParticipantSpotlighted(callId: string, spotlightedParticipant: SpotlightedParticipant): void;
setParticipantNotSpotlighted(callId: string, spotlightedParticipant: SpotlightedParticipant): void;
setAssignedBreakoutRoom(callId: string, breakoutRoom?: BreakoutRoom): void;
setBreakoutRoomSettings(callId: string, breakoutRoomSettings: BreakoutRoomsSettings): void;
setBreakoutRoomDisplayName(callId: string, breakoutRoomDisplayName: string): void;
setOpenBreakoutRoom(callId: string): void;
deleteOpenBreakoutRoom(): void;
getOpenBreakoutRoom(): string | undefined;
setCallScreenShareParticipant(callId: string, participantKey: string | undefined): void;
setLocalVideoStreamRendererView(callId: string, localVideoMediaStreamType: string, view: VideoStreamRendererViewState | undefined): void;
setTogetherModeVideoStreamRendererView(callId: string, togetherModeStreamType: string, view: VideoStreamRendererViewState | undefined): void;
setParticipantState(callId: string, participantKey: string, state: RemoteParticipantStatus): void;
setParticipantIsMuted(callId: string, participantKey: string, muted: boolean): void;
setOptimalVideoCount(callId: string, optimalVideoCount: number): void;
setParticipantRole(callId: string, participantKey: string, role: ParticipantRole): void;
setParticipantDisplayName(callId: string, participantKey: string, displayName: string): void;
setParticipantIsSpeaking(callId: string, participantKey: string, isSpeaking: boolean): void;
setParticipantVideoStream(callId: string, participantKey: string, stream: RemoteVideoStreamState): void;
setRemoteVideoStreamIsAvailable(callId: string, participantKey: string, streamId: number, isAvailable: boolean): void;
setRemoteVideoStreamIsReceiving(callId: string, participantKey: string, streamId: number, isReceiving: boolean): void;
setRemoteVideoStreamSize(callId: string, participantKey: string, streamId: number, size: {
width: number;
height: number;
}): void;
setRemoteVideoStreams(callId: string, participantKey: string, addRemoteVideoStream: RemoteVideoStreamState[], removeRemoteVideoStream: number[]): void;
setRemoteVideoStreamRendererView(callId: string, participantKey: string, streamId: number, view: VideoStreamRendererViewState | undefined): void;
setRemoteVideoStreamViewScalingMode(callId: string, participantKey: string, streamId: number, scalingMode: ScalingMode): void;
setIncomingCall(call: IncomingCallState | TeamsIncomingCallState): void;
removeIncomingCall(callId: string): void;
setIncomingCallEnded(callId: string, callEndReason: CallEndReason | undefined): void;
setDeviceManagerIsSpeakerSelectionAvailable(isSpeakerSelectionAvailable: boolean): void;
setDeviceManagerSelectedMicrophone(selectedMicrophone?: AudioDeviceInfo): void;
setDeviceManagerSelectedSpeaker(selectedSpeaker?: AudioDeviceInfo): void;
setDeviceManagerSelectedCamera(selectedCamera?: VideoDeviceInfo): void;
setDeviceManagerCameras(cameras: VideoDeviceInfo[]): void;
setDeviceManagerMicrophones(microphones: AudioDeviceInfo[]): void;
setDeviceManagerSpeakers(speakers: AudioDeviceInfo[]): void;
setDeviceManagerDeviceAccess(deviceAccess: DeviceAccess): void;
setDeviceManagerUnparentedView(localVideoStream: LocalVideoStreamState, view: VideoStreamRendererViewState | undefined): void;
deleteDeviceManagerUnparentedView(localVideoStream: LocalVideoStreamState): void;
setDeviceManagerUnparentedViewVideoEffects(localVideoStream: LocalVideoStreamState, videoEffects: LocalVideoStreamVideoEffectsState): void;
getAndIncrementAtomicId(): number;
private processNewRealTimeText;
private findTimeoutRealTimeText;
private processNewCaption;
addTeamsCaption(callId: string, caption: TeamsCaptionsInfo): void;
addCaption(callId: string, caption: AcsCaptionsInfo): void;
addRealTimeText(callId: string, realTimeText: AcsRealTimeTextInfo): void;
setCaptionsKind(callId: string, kind: CaptionsKind): void;
clearCaptions(callId: string): void;
setIsCaptionActive(callId: string, isCaptionsActive: boolean): void;
setIsRealTimeTextActive(callId: string, isRealTimeTextActive: boolean): void;
setStartCaptionsInProgress(callId: string, startCaptionsInProgress: boolean): void;
setSelectedSpokenLanguage(callId: string, spokenLanguage: string): void;
setSelectedCaptionLanguage(callId: string, captionLanguage: string): void;
setAvailableCaptionLanguages(callId: string, captionLanguages: string[]): void;
setAvailableSpokenLanguages(callId: string, spokenLanguages: string[]): void;
setAcceptedTransfer(callId: string, acceptedTransfer: AcceptedTransfer): void;
/**
* Tees any errors encountered in an async function to the state.
*
* @param action Async function to execute.
* @param target The error target to tee error to.
* @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.
* @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.
*/
withAsyncErrorTeedToState<Args extends unknown[], R>(action: (...args: Args) => Promise<R>, target: CallErrorTarget): (...args: Args) => Promise<R>;
/**
* Tees any errors encountered in an function to the state.
*
* @param action Function to execute.
* @param target The error target to tee error to.
* @returns Result of calling `f`. Also re-raises any exceptions thrown from `f`.
* @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.
*/
withErrorTeedToState<Args extends unknown[], R>(action: (...args: Args) => R, target: CallErrorTarget): (...args: Args) => R;
/**
* Tees direct errors to state.
* @remarks
* This is typically used for errors that are caught and intended to be shown to the user.
*
* @param error The raw error to report.
* @param target The error target to tee error to.
*
* @private
*/
teeErrorToState: (error: Error, target: CallErrorTarget) => void;
private setLatestError;
setLatestNotification(callId: string, notification: CallNotification): void;
deleteLatestNotification(notificationTarget: NotificationTarget, callId?: string): void;
setMediaAccesses(callId: string, mediaAccesses: MediaAccess[]): void;
setMeetingMediaAccess(callId: string, meetingMediaAccess: MeetingMediaAccess): void;
}
//# sourceMappingURL=CallContext.d.ts.map