你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CallAdapter interface

特定于 Azure 通信标识的适配器接口,用于扩展 CommonCallAdapter

Extends

方法

joinCall(boolean)

最初打开/关闭麦克风加入呼叫。

startCall(string[], StartCallOptions)

启动呼叫。

继承的方法

askDevicePermission(PermissionConstraints)

请求设备的权限。

createStreamView(string, VideoStreamOptions)

为流创建 html 视图。

dispose()

释放复合

disposeStreamView(string, VideoStreamOptions)

释放流的 html 视图。

getState()

获取当前状态

leaveCall(boolean)

离开呼叫

mute()

呼叫期间将当前用户静音或在本地禁用麦克风

off("callEnded", CallEndedListener)

取消订阅“callEnded”事件的函数。

off("callIdChanged", CallIdChangedListener)

取消订阅“callIdChanged”事件的函数。

off("diagnosticChanged", DiagnosticChangedEventListner)

取消订阅“diagnosticChanged”事件的函数。

off("displayNameChanged", DisplayNameChangedListener)

“displayNameChanged”事件的取消订阅函数。

off("error", (e: AdapterError) => void)

取消订阅“error”事件的函数。

off("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)

取消订阅“isLocalScreenSharingActiveChanged”事件的函数。

off("isMutedChanged", IsMutedChangedListener)

“isMutedChanged”事件的取消订阅函数。

off("isSpeakingChanged", IsSpeakingChangedListener)

取消订阅“isSpeakingChanged”事件的函数。

off("participantsJoined", ParticipantsJoinedListener)

“participantsJoined”事件的取消订阅函数。

off("participantsLeft", ParticipantsLeftListener)

“participantsLeft”事件的取消订阅函数。

off("selectedMicrophoneChanged", PropertyChangedEvent)

取消订阅“selectedMicrophoneChanged”事件的函数。

off("selectedSpeakerChanged", PropertyChangedEvent)

取消订阅“selectedSpeakerChanged”事件的函数。

offStateChange((state: CallAdapterState) => void)

取消订阅 stateChanged 事件的处理程序。

on("callEnded", CallEndedListener)

“callEnded”事件的 Subscribe 函数。

on("callIdChanged", CallIdChangedListener)

“callIdChanged”事件的 Subscribe 函数。

on("diagnosticChanged", DiagnosticChangedEventListner)

“diagnosticChanged”事件的 Subscribe 函数。

每当用户面对有关正在进行的呼叫诊断发生更改时,将触发此事件。

on("displayNameChanged", DisplayNameChangedListener)

“displayNameChanged”事件的 Subscribe 函数。

on("error", (e: AdapterError) => void)

“error”事件的 Subscribe 函数。

on("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)

“isLocalScreenSharingActiveChanged”事件的 Subscribe 函数。

on("isMutedChanged", IsMutedChangedListener)

“isMutedChanged”事件的 Subscribe 函数。

on("isSpeakingChanged", IsSpeakingChangedListener)

“isSpeakingChanged”事件的 Subscribe 函数。

on("participantsJoined", ParticipantsJoinedListener)

“participantsJoined”事件的 Subscribe 函数。

on("participantsLeft", ParticipantsLeftListener)

“participantsLeft”事件的 Subscribe 函数。

on("selectedMicrophoneChanged", PropertyChangedEvent)

“selectedMicrophoneChanged”事件的 Subscribe 函数。

每当用户选择新的麦克风设备时,将触发此事件。

on("selectedSpeakerChanged", PropertyChangedEvent)

“selectedSpeakerChanged”事件的 Subscribe 函数。

每当用户选择新的扬声器设备时,就会触发此事件。

onStateChange((state: CallAdapterState) => void)

将处理程序订阅到 stateChanged 事件。

queryCameras()

查询可用的相机设备。

queryMicrophones()

查询可用的麦克风设备。

querySpeakers()

查询可用的麦克风设备。

removeParticipant(string)

从通话中删除参与者。

setCamera(VideoDeviceInfo, VideoStreamOptions)

设置在通话中使用的相机。

setMicrophone(AudioDeviceInfo)

设置在通话中使用的麦克风。

setSpeaker(AudioDeviceInfo)

设置在呼叫中使用的扬声器。

startCamera(VideoStreamOptions)

启动相机 此方法将在调用未处于活动状态时开始呈现本地相机视图

startScreenShare()

开始在通话期间共享屏幕。

stopCamera()

停止相机 此方法将在调用未处于活动状态时停止呈现本地相机视图

stopScreenShare()

停止共享屏幕

unmute()

呼叫期间取消当前用户的静音或在本地启用麦克风

方法详细信息

joinCall(boolean)

最初打开/关闭麦克风加入呼叫。

function joinCall(microphoneOn?: boolean): undefined | Call

参数

microphoneOn

boolean

最初是否启用麦克风

返回

undefined | Call

startCall(string[], StartCallOptions)

启动呼叫。

function startCall(participants: string[], options?: StartCallOptions): undefined | Call

参数

participants

string[]

要加入的参与者 ID 数组

返回

undefined | Call

继承的方法详细信息

askDevicePermission(PermissionConstraints)

请求设备的权限。

function askDevicePermission(constrain: PermissionConstraints): Promise<void>

参数

constrain
PermissionConstraints

定义访问本地设备的约束 <xref:%40azure%2Fcommunication-calling%23PermissionConstraints>

返回

Promise<void>

注解

如果尚未授予权限,将弹出浏览器权限窗口

继承自CommonCallAdapter.askDevicePermission

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>

注解

此方法是针对复合实现的

继承自CommonCallAdapter.createStreamView

dispose()

释放复合

function dispose()

继承自CommonCallAdapter.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>

注解

此方法是针对复合实现的

继承自CommonCallAdapter.disposeStreamView

getState()

获取当前状态

function getState(): CallAdapterState

返回

继承自CommonCallAdapter.getState

leaveCall(boolean)

离开呼叫

function leaveCall(forEveryone?: boolean): Promise<void>

参数

forEveryone

boolean

离开时是否删除所有参与者

返回

Promise<void>

继承自CommonCallAdapter.leaveCall

mute()

呼叫期间将当前用户静音或在本地禁用麦克风

function mute(): Promise<void>

返回

Promise<void>

继承自CommonCallAdapter.mute

off("callEnded", CallEndedListener)

取消订阅“callEnded”事件的函数。

function off(event: "callEnded", listener: CallEndedListener)

参数

event

"callEnded"

继承自CommonCallAdapter.off

off("callIdChanged", CallIdChangedListener)

取消订阅“callIdChanged”事件的函数。

function off(event: "callIdChanged", listener: CallIdChangedListener)

参数

event

"callIdChanged"

继承自CommonCallAdapter.off

off("diagnosticChanged", DiagnosticChangedEventListner)

取消订阅“diagnosticChanged”事件的函数。

function off(event: "diagnosticChanged", listener: DiagnosticChangedEventListner)

参数

event

"diagnosticChanged"

继承自CommonCallAdapter.off

off("displayNameChanged", DisplayNameChangedListener)

“displayNameChanged”事件的取消订阅函数。

function off(event: "displayNameChanged", listener: DisplayNameChangedListener)

参数

event

"displayNameChanged"

继承自CommonCallAdapter.off

off("error", (e: AdapterError) => void)

取消订阅“error”事件的函数。

function off(event: "error", listener: (e: AdapterError) => void)

参数

event

"error"

listener

(e: AdapterError) => void

继承自CommonCallAdapter.off

off("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)

取消订阅“isLocalScreenSharingActiveChanged”事件的函数。

function off(event: "isLocalScreenSharingActiveChanged", listener: IsLocalScreenSharingActiveChangedListener)

参数

event

"isLocalScreenSharingActiveChanged"

继承自CommonCallAdapter.off

off("isMutedChanged", IsMutedChangedListener)

“isMutedChanged”事件的取消订阅函数。

function off(event: "isMutedChanged", listener: IsMutedChangedListener)

参数

event

"isMutedChanged"

继承自CommonCallAdapter.off

off("isSpeakingChanged", IsSpeakingChangedListener)

取消订阅“isSpeakingChanged”事件的函数。

function off(event: "isSpeakingChanged", listener: IsSpeakingChangedListener)

参数

event

"isSpeakingChanged"

继承自CommonCallAdapter.off

off("participantsJoined", ParticipantsJoinedListener)

“participantsJoined”事件的取消订阅函数。

function off(event: "participantsJoined", listener: ParticipantsJoinedListener)

参数

event

"participantsJoined"

继承自CommonCallAdapter.off

off("participantsLeft", ParticipantsLeftListener)

“participantsLeft”事件的取消订阅函数。

function off(event: "participantsLeft", listener: ParticipantsLeftListener)

参数

event

"participantsLeft"

继承自CommonCallAdapter.off

off("selectedMicrophoneChanged", PropertyChangedEvent)

取消订阅“selectedMicrophoneChanged”事件的函数。

function off(event: "selectedMicrophoneChanged", listener: PropertyChangedEvent)

参数

event

"selectedMicrophoneChanged"

继承自CommonCallAdapter.off

off("selectedSpeakerChanged", PropertyChangedEvent)

取消订阅“selectedSpeakerChanged”事件的函数。

function off(event: "selectedSpeakerChanged", listener: PropertyChangedEvent)

参数

event

"selectedSpeakerChanged"

继承自CommonCallAdapter.off

offStateChange((state: CallAdapterState) => void)

取消订阅 stateChanged 事件的处理程序。

function offStateChange(handler: (state: CallAdapterState) => void)

参数

handler

(state: CallAdapterState) => void

继承自CommonCallAdapter.offStateChange

on("callEnded", CallEndedListener)

“callEnded”事件的 Subscribe 函数。

function on(event: "callEnded", listener: CallEndedListener)

参数

event

"callEnded"

继承自CommonCallAdapter.on

on("callIdChanged", CallIdChangedListener)

“callIdChanged”事件的 Subscribe 函数。

function on(event: "callIdChanged", listener: CallIdChangedListener)

参数

event

"callIdChanged"

注解

当当前用户的 callId 发生更改时,将触发该事件。

继承自CommonCallAdapter.on

on("diagnosticChanged", DiagnosticChangedEventListner)

“diagnosticChanged”事件的 Subscribe 函数。

每当用户面对有关正在进行的呼叫诊断发生更改时,将触发此事件。

function on(event: "diagnosticChanged", listener: DiagnosticChangedEventListner)

参数

event

"diagnosticChanged"

继承自CommonCallAdapter.on

on("displayNameChanged", DisplayNameChangedListener)

“displayNameChanged”事件的 Subscribe 函数。

function on(event: "displayNameChanged", listener: DisplayNameChangedListener)

参数

event

"displayNameChanged"

继承自CommonCallAdapter.on

on("error", (e: AdapterError) => void)

“error”事件的 Subscribe 函数。

function on(event: "error", listener: (e: AdapterError) => void)

参数

event

"error"

listener

(e: AdapterError) => void

继承自CommonCallAdapter.on

on("isLocalScreenSharingActiveChanged", IsLocalScreenSharingActiveChangedListener)

“isLocalScreenSharingActiveChanged”事件的 Subscribe 函数。

function on(event: "isLocalScreenSharingActiveChanged", listener: IsLocalScreenSharingActiveChangedListener)

参数

event

"isLocalScreenSharingActiveChanged"

继承自CommonCallAdapter.on

on("isMutedChanged", IsMutedChangedListener)

“isMutedChanged”事件的 Subscribe 函数。

function on(event: "isMutedChanged", listener: IsMutedChangedListener)

参数

event

"isMutedChanged"

注解

每当当前用户或远程用户静音状态更改时,都会触发该事件

继承自CommonCallAdapter.on

on("isSpeakingChanged", IsSpeakingChangedListener)

“isSpeakingChanged”事件的 Subscribe 函数。

function on(event: "isSpeakingChanged", listener: IsSpeakingChangedListener)

参数

event

"isSpeakingChanged"

继承自CommonCallAdapter.on

on("participantsJoined", ParticipantsJoinedListener)

“participantsJoined”事件的 Subscribe 函数。

function on(event: "participantsJoined", listener: ParticipantsJoinedListener)

参数

event

"participantsJoined"

继承自CommonCallAdapter.on

on("participantsLeft", ParticipantsLeftListener)

“participantsLeft”事件的 Subscribe 函数。

function on(event: "participantsLeft", listener: ParticipantsLeftListener)

参数

event

"participantsLeft"

继承自CommonCallAdapter.on

on("selectedMicrophoneChanged", PropertyChangedEvent)

“selectedMicrophoneChanged”事件的 Subscribe 函数。

每当用户选择新的麦克风设备时,将触发此事件。

function on(event: "selectedMicrophoneChanged", listener: PropertyChangedEvent)

参数

event

"selectedMicrophoneChanged"

继承自CommonCallAdapter.on

on("selectedSpeakerChanged", PropertyChangedEvent)

“selectedSpeakerChanged”事件的 Subscribe 函数。

每当用户选择新的扬声器设备时,就会触发此事件。

function on(event: "selectedSpeakerChanged", listener: PropertyChangedEvent)

参数

event

"selectedSpeakerChanged"

继承自CommonCallAdapter.on

onStateChange((state: CallAdapterState) => void)

将处理程序订阅到 stateChanged 事件。

function onStateChange(handler: (state: CallAdapterState) => void)

参数

handler

(state: CallAdapterState) => void

继承自CommonCallAdapter.onStateChange

queryCameras()

查询可用的相机设备。

function queryCameras(): Promise<VideoDeviceInfo[]>

返回

Promise<VideoDeviceInfo[]>

视频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23VideoDeviceInfo>

注解

应在 askDevicePermission () 之后调用此方法

继承自CommonCallAdapter.queryCameras

queryMicrophones()

查询可用的麦克风设备。

function queryMicrophones(): Promise<AudioDeviceInfo[]>

返回

Promise<AudioDeviceInfo[]>

音频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23AudioDeviceInfo>

注解

应在 askDevicePermission () 之后调用此方法

继承自CommonCallAdapter.queryMicrophones

querySpeakers()

查询可用的麦克风设备。

function querySpeakers(): Promise<AudioDeviceInfo[]>

返回

Promise<AudioDeviceInfo[]>

音频设备信息实体的数组 <xref:%40azure%2Fcommunication-calling%23AudioDeviceInfo>

注解

应在 askDevicePermission () 之后调用此方法

继承自CommonCallAdapter.querySpeakers

removeParticipant(string)

从通话中删除参与者。

function removeParticipant(userId: string): Promise<void>

参数

userId

string

要删除的参与者的 ID

返回

Promise<void>

继承自CommonCallAdapter.removeParticipant

setCamera(VideoDeviceInfo, VideoStreamOptions)

设置在通话中使用的相机。

function setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>

参数

sourceInfo
VideoDeviceInfo

要选择的相机设备,选择 queryCameras 返回的相机设备

options
VideoStreamOptions

用于控制如何呈现相机流的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>

返回

Promise<void>

继承自CommonCallAdapter.setCamera

setMicrophone(AudioDeviceInfo)

设置在通话中使用的麦克风。

function setMicrophone(sourceInfo: AudioDeviceInfo): Promise<void>

参数

sourceInfo
AudioDeviceInfo

麦克风设备可供选择,选择查询麦克风返回的麦克风设备

返回

Promise<void>

继承自CommonCallAdapter.setMicrophone

setSpeaker(AudioDeviceInfo)

设置在呼叫中使用的扬声器。

function setSpeaker(sourceInfo: AudioDeviceInfo): Promise<void>

参数

sourceInfo
AudioDeviceInfo

要选择的扬声器设备,选择 querySpeakers 返回的一个

返回

Promise<void>

继承自CommonCallAdapter.setSpeaker

startCamera(VideoStreamOptions)

启动相机 此方法将在调用未处于活动状态时开始呈现本地相机视图

function startCamera(options?: VideoStreamOptions): Promise<void>

参数

options
VideoStreamOptions

用于控制视频流的呈现方式的选项 <xref:%40azure%2Fcommunication-calling%23VideoStreamOptions>

返回

Promise<void>

继承自CommonCallAdapter.startCamera

startScreenShare()

开始在通话期间共享屏幕。

function startScreenShare(): Promise<void>

返回

Promise<void>

继承自CommonCallAdapter.startScreenShare

stopCamera()

停止相机 此方法将在调用未处于活动状态时停止呈现本地相机视图

function stopCamera(): Promise<void>

返回

Promise<void>

继承自CommonCallAdapter.stopCamera

stopScreenShare()

停止共享屏幕

function stopScreenShare(): Promise<void>

返回

Promise<void>

继承自CommonCallAdapter.stopScreenShare

unmute()

呼叫期间取消当前用户的静音或在本地启用麦克风

function unmute(): Promise<void>

返回

Promise<void>

继承自CommonCallAdapter.unmute