你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
CallWithChatAdapter interface
CallWithChatComposite 适配器接口。
- Extends
继承的方法
继承的方法详细信息
askDevicePermission(PermissionConstraints)
请求设备的权限。
function askDevicePermission(constrain: PermissionConstraints): Promise<void>
参数
- constrain
- PermissionConstraints
定义访问本地设备的约束 <xref:%40azure%2Fcommunication-calling%23PermissionConstraints>
返回
Promise<void>
注解
如果尚未授予权限,将弹出浏览器权限窗口。
createStreamView(string, VideoStreamOptions)
为流创建 html 视图。
function createStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void | CreateVideoStreamViewResult>
参数
- remoteUserId
-
string
要呈现的参与者的 ID,将其保留为未定义以创建本地相机视图
- options
- VideoStreamOptions
用于控制视频流的呈现方式的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>
返回
Promise<void | CreateVideoStreamViewResult>
注解
此方法是针对复合实现的。
deleteMessage(string)
删除线程中的消息。
function deleteMessage(messageId: string): Promise<void>
参数
- messageId
-
string
返回
Promise<void>
dispose()
disposeStreamView(string, VideoStreamOptions)
释放流的 html 视图。
function disposeStreamView(remoteUserId?: string, options?: VideoStreamOptions): Promise<void>
参数
- remoteUserId
-
string
要呈现的参与者的 ID,将其保留为未定义以释放本地相机视图
- options
- VideoStreamOptions
用于控制视频流的呈现方式的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>
返回
Promise<void>
注解
此方法是针对复合实现的。
fetchInitialData()
获取聊天适配器的初始状态。
执行 ChatComposite 和 API 方法所需的最小提取。
function fetchInitialData(): Promise<void>
返回
Promise<void>
getState()
获取当前状态
function getState(): CallWithChatAdapterState
返回
joinCall(boolean)
最初打开/关闭麦克风加入呼叫。
function joinCall(microphoneOn?: boolean): undefined | Call
参数
- microphoneOn
-
boolean
最初是否启用麦克风
返回
undefined | Call
leaveCall(boolean)
离开呼叫。
function leaveCall(forEveryone?: boolean): Promise<void>
参数
- forEveryone
-
boolean
离开时是否删除所有参与者
返回
Promise<void>
loadPreviousChatMessages(number)
在聊天线程历史记录中加载更多以前的消息。
function loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>
参数
- messagesToLoad
-
number
返回
Promise<boolean>
注解
此方法通常用于控制增量提取/无限滚动。
mute()
呼叫期间将当前用户静音或在本地禁用麦克风。
function mute(): Promise<void>
返回
Promise<void>
off("callEnded", CallEndedListener)
function off(event: "callEnded", listener: CallEndedListener)
参数
- event
-
"callEnded"
- listener
- CallEndedListener
off("callError", (e: AdapterError) => void)
function off(event: "callError", listener: (e: AdapterError) => void)
参数
- event
-
"callError"
- listener
-
(e: AdapterError) => void
off("callIdChanged", CallIdChangedListener)
function off(event: "callIdChanged", listener: CallIdChangedListener)
参数
- event
-
"callIdChanged"
- listener
- CallIdChangedListener
off("callParticipantsJoined", ParticipantsJoinedListener)
function off(event: "callParticipantsJoined", listener: ParticipantsJoinedListener)
参数
- event
-
"callParticipantsJoined"
- listener
- ParticipantsJoinedListener
off("callParticipantsLeft", ParticipantsLeftListener)
function off(event: "callParticipantsLeft", listener: ParticipantsLeftListener)
参数
- event
-
"callParticipantsLeft"
- listener
- ParticipantsLeftListener
off("chatError", (e: AdapterError) => void)
function off(event: "chatError", listener: (e: AdapterError) => void)
参数
- event
-
"chatError"
- listener
-
(e: AdapterError) => void
off("chatParticipantsAdded", ParticipantsAddedListener)
function off(event: "chatParticipantsAdded", listener: ParticipantsAddedListener)
参数
- event
-
"chatParticipantsAdded"
- listener
- ParticipantsAddedListener
off("chatParticipantsRemoved", ParticipantsRemovedListener)
function off(event: "chatParticipantsRemoved", listener: ParticipantsRemovedListener)
参数
- event
-
"chatParticipantsRemoved"
- listener
- ParticipantsRemovedListener
off("displayNameChanged", DisplayNameChangedListener)
function off(event: "displayNameChanged", listener: DisplayNameChangedListener)
参数
- event
-
"displayNameChanged"
- listener
- DisplayNameChangedListener
off("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)
function off(event: "isLocalScreenSharingActiveChanged", listener: IsLocalScreenSharingActiveChangedListener)
参数
- event
-
"isLocalScreenSharingActiveChanged"
off("isMutedChanged", IsMutedChangedListener)
function off(event: "isMutedChanged", listener: IsMutedChangedListener)
参数
- event
-
"isMutedChanged"
- listener
- IsMutedChangedListener
off("isSpeakingChanged", IsSpeakingChangedListener)
function off(event: "isSpeakingChanged", listener: IsSpeakingChangedListener)
参数
- event
-
"isSpeakingChanged"
- listener
- IsSpeakingChangedListener
off("messageRead", MessageReadListener)
function off(event: "messageRead", listener: MessageReadListener)
参数
- event
-
"messageRead"
- listener
- MessageReadListener
off("messageReceived", MessageReceivedListener)
function off(event: "messageReceived", listener: MessageReceivedListener)
参数
- event
-
"messageReceived"
- listener
- MessageReceivedListener
off("messageSent", MessageReceivedListener)
function off(event: "messageSent", listener: MessageReceivedListener)
参数
- event
-
"messageSent"
- listener
- MessageReceivedListener
off("selectedMicrophoneChanged", PropertyChangedEvent)
function off(event: "selectedMicrophoneChanged", listener: PropertyChangedEvent)
参数
- event
-
"selectedMicrophoneChanged"
- listener
- PropertyChangedEvent
off("selectedSpeakerChanged", PropertyChangedEvent)
function off(event: "selectedSpeakerChanged", listener: PropertyChangedEvent)
参数
- event
-
"selectedSpeakerChanged"
- listener
- PropertyChangedEvent
offStateChange((state: CallWithChatAdapterState) => void)
取消订阅 stateChanged 事件的处理程序。
function offStateChange(handler: (state: CallWithChatAdapterState) => void)
参数
- handler
-
(state: CallWithChatAdapterState) => void
on("callEnded", CallEndedListener)
function on(event: "callEnded", listener: CallEndedListener)
参数
- event
-
"callEnded"
- listener
- CallEndedListener
on("callError", (e: AdapterError) => void)
function on(event: "callError", listener: (e: AdapterError) => void)
参数
- event
-
"callError"
- listener
-
(e: AdapterError) => void
on("callIdChanged", CallIdChangedListener)
function on(event: "callIdChanged", listener: CallIdChangedListener)
参数
- event
-
"callIdChanged"
- listener
- CallIdChangedListener
on("callParticipantsJoined", ParticipantsJoinedListener)
function on(event: "callParticipantsJoined", listener: ParticipantsJoinedListener)
参数
- event
-
"callParticipantsJoined"
- listener
- ParticipantsJoinedListener
on("callParticipantsLeft", ParticipantsLeftListener)
function on(event: "callParticipantsLeft", listener: ParticipantsLeftListener)
参数
- event
-
"callParticipantsLeft"
- listener
- ParticipantsLeftListener
on("chatError", (e: AdapterError) => void)
function on(event: "chatError", listener: (e: AdapterError) => void)
参数
- event
-
"chatError"
- listener
-
(e: AdapterError) => void
on("chatParticipantsAdded", ParticipantsAddedListener)
function on(event: "chatParticipantsAdded", listener: ParticipantsAddedListener)
参数
- event
-
"chatParticipantsAdded"
- listener
- ParticipantsAddedListener
on("chatParticipantsRemoved", ParticipantsRemovedListener)
function on(event: "chatParticipantsRemoved", listener: ParticipantsRemovedListener)
参数
- event
-
"chatParticipantsRemoved"
- listener
- ParticipantsRemovedListener
on("displayNameChanged", DisplayNameChangedListener)
function on(event: "displayNameChanged", listener: DisplayNameChangedListener)
参数
- event
-
"displayNameChanged"
- listener
- DisplayNameChangedListener
on("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)
function on(event: "isLocalScreenSharingActiveChanged", listener: IsLocalScreenSharingActiveChangedListener)
参数
- event
-
"isLocalScreenSharingActiveChanged"
on("isMutedChanged", IsMutedChangedListener)
function on(event: "isMutedChanged", listener: IsMutedChangedListener)
参数
- event
-
"isMutedChanged"
- listener
- IsMutedChangedListener
on("isSpeakingChanged", IsSpeakingChangedListener)
function on(event: "isSpeakingChanged", listener: IsSpeakingChangedListener)
参数
- event
-
"isSpeakingChanged"
- listener
- IsSpeakingChangedListener
on("messageRead", MessageReadListener)
function on(event: "messageRead", listener: MessageReadListener)
参数
- event
-
"messageRead"
- listener
- MessageReadListener
on("messageReceived", MessageReceivedListener)
function on(event: "messageReceived", listener: MessageReceivedListener)
参数
- event
-
"messageReceived"
- listener
- MessageReceivedListener
on("messageSent", MessageReceivedListener)
function on(event: "messageSent", listener: MessageReceivedListener)
参数
- event
-
"messageSent"
- listener
- MessageReceivedListener
on("selectedMicrophoneChanged", PropertyChangedEvent)
function on(event: "selectedMicrophoneChanged", listener: PropertyChangedEvent)
参数
- event
-
"selectedMicrophoneChanged"
- listener
- PropertyChangedEvent
on("selectedSpeakerChanged", PropertyChangedEvent)
function on(event: "selectedSpeakerChanged", listener: PropertyChangedEvent)
参数
- event
-
"selectedSpeakerChanged"
- listener
- PropertyChangedEvent
onStateChange((state: CallWithChatAdapterState) => void)
将处理程序订阅到 stateChanged 事件。
function onStateChange(handler: (state: CallWithChatAdapterState) => void)
参数
- handler
-
(state: CallWithChatAdapterState) => void
queryCameras()
查询可用的相机设备。
function queryCameras(): Promise<VideoDeviceInfo[]>
返回
Promise<VideoDeviceInfo[]>
视频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23VideoDeviceInfo>
注解
应在 askDevicePermission () 之后调用此方法
queryMicrophones()
查询可用的麦克风设备。
function queryMicrophones(): Promise<AudioDeviceInfo[]>
返回
Promise<AudioDeviceInfo[]>
音频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23AudioDeviceInfo>
注解
应在 askDevicePermission () 之后调用此方法
querySpeakers()
查询可用的麦克风设备。
function querySpeakers(): Promise<AudioDeviceInfo[]>
返回
Promise<AudioDeviceInfo[]>
音频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23AudioDeviceInfo>
注解
应在 askDevicePermission () 之后调用此方法
removeParticipant(string)
从通话中删除参与者。
function removeParticipant(userId: string): Promise<void>
参数
- userId
-
string
要删除的参与者的 UserId。
返回
Promise<void>
sendMessage(string, SendMessageOptions)
在线程中发送消息。
function sendMessage(content: string, options?: SendMessageOptions): Promise<void>
参数
- content
-
string
- options
- SendMessageOptions
返回
Promise<void>
sendReadReceipt(string)
发送邮件的已读回执。
function sendReadReceipt(chatMessageId: string): Promise<void>
参数
- chatMessageId
-
string
返回
Promise<void>
sendTypingIndicator()
在线程中发送键入指示器。
function sendTypingIndicator(): Promise<void>
返回
Promise<void>
setCamera(VideoDeviceInfo, VideoStreamOptions)
设置在调用中使用的相机。
function setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>
参数
- sourceInfo
- VideoDeviceInfo
要选择的相机设备,选择 queryCameras 返回的相机设备
- options
- VideoStreamOptions
用于控制如何呈现相机流的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>
返回
Promise<void>
setMicrophone(AudioDeviceInfo)
设置在通话中使用的麦克风。
function setMicrophone(sourceInfo: AudioDeviceInfo): Promise<void>
参数
- sourceInfo
- AudioDeviceInfo
麦克风设备可供选择,选择查询麦克风返回的麦克风设备
返回
Promise<void>
setSpeaker(AudioDeviceInfo)
设置在呼叫中使用的扬声器。
function setSpeaker(sourceInfo: AudioDeviceInfo): Promise<void>
参数
- sourceInfo
- AudioDeviceInfo
要选择的扬声器设备,选择 querySpeakers 返回的一个
返回
Promise<void>
startCall(string[], StartCallOptions)
启动呼叫。
function startCall(participants: string[], options?: StartCallOptions): undefined | Call
参数
- participants
-
string[]
要加入的参与者 ID 数组
- options
- StartCallOptions
返回
undefined | Call
startCamera(VideoStreamOptions)
启动相机。
当调用不处于活动状态时,此方法将开始呈现本地相机视图。
function startCamera(options?: VideoStreamOptions): Promise<void>
参数
- options
- VideoStreamOptions
用于控制视频流的呈现方式的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>
返回
Promise<void>
startScreenShare()
开始在通话期间共享屏幕。
function startScreenShare(): Promise<void>
返回
Promise<void>
stopCamera()
停止相机。
当调用不处于活动状态时,此方法将停止呈现本地相机视图。
function stopCamera(): Promise<void>
返回
Promise<void>
stopScreenShare()
停止共享屏幕。
function stopScreenShare(): Promise<void>
返回
Promise<void>
unmute()
呼叫期间取消当前用户的静音,或在本地启用麦克风。
function unmute(): Promise<void>
返回
Promise<void>
updateMessage(string, string, Record<string, string>)
更新消息内容。
function updateMessage(messageId: string, content: string, metadata?: Record<string, string>): Promise<void>
参数
- messageId
-
string
- content
-
string
- metadata
-
Record<string, string>
返回
Promise<void>