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

StatefulCallClient interface

定义允许有状态使用 CallClient <xref:%40azure%2Fcommunication-calling%23CallClient> 的方法。 该接口提供对代理状态的访问,并允许注册状态更改事件的处理程序。 有关状态定义,请参阅 CallClientState

状态更改事件由:

  • 从 <xref:%40azure%2Fcommunication-calling%23DeviceManager> API 返回的数据。
  • 从 <xref:%40azure%2Fcommunication-calling%23CallAgent> API 返回的数据。
  • 自动附加到各种 Azure 通信调用对象的侦听器:
    • CallAgent “incomingCall”
    • CallAgent “callsUpdated”
    • DeviceManager “videoDevicesUpdated”
    • DeviceManager 'audioDevicesUpdated
    • DeviceManager “selectedMicrophoneChanged”
    • DeviceManager “selectedSpeakerChanged”
    • 调用“stateChanged”
    • 调用“idChanged”
    • 调用“isMutedChanged”
    • 调用“isScreenSharingOnChanged”
    • 调用“remoteParticipantsUpdated”
    • 调用“localVideoStreamsUpdated”
    • IncomingCall “callEnded”
    • RemoteParticipant 'stateChanged'
    • RemoteParticipant 'isMutedChanged'
    • RemoteParticipant 'displayNameChanged'
    • 远程参与者 'isSpeakingChanged'
    • RemoteParticipant 'videoStreamsUpdated'
    • RemoteVideoStream “isAvailableChanged”
    • TranscriptionCallFeature 'isTranscriptionActiveChanged'
    • RecordingCallFeature “isRecordingActiveChanged”
    • LocalRecordingCallFeature 'isLocalRecordingActiveChanged'
    • RaiseHandCallFeature 'raisedHandEvent'
    • RaiseHandCallFeature 'loweredHandEvent'
    • PPTLiveCallFeature 'isAciveChanged'
    • ReactionCallFeature '反应'
扩展

方法

createCallAgent([tokenCredential, options])

CallAgent 用于处理调用。 若要创建 CallAgent,请传递从 SDK 提供的 CommunicationTokenCredential 对象。

  • CallClient 一次只能有一个活动的 CallAgent 实例。
  • 可以创建新的 CallClient 实例来创建新的 CallAgent。
  • 可以释放 CallClient 的当前活动 CallAgent,并再次调用 CallClient 的 createCallAgent() 方法来创建新的 CallAgent。
createTeamsCallAgent([tokenCredential, options])

TeamsCallAgent 用于处理呼叫。 若要创建 TeamsCallAgent,请传递从 SDK 提供的 CommunicationTokenCredential 对象。

  • CallClient 一次只能有一个活动的 TeamsCallAgent 实例。
  • 可以创建新的 CallClient 实例以创建新的 TeamsCallAgent。
  • 可以释放 CallClient 的当前活动 TeamsCallAgent,并再次调用 CallClient 的 createTeamsCallAgent() 方法来创建新的 TeamsCallAgent。
createView(undefined | string, undefined | CommunicationIdentifier, CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState, CreateViewOptions)

呈现 RemoteVideoStreamStateLocalVideoStreamState,并将生成的 videoStreamRendererViewState 存储在相关RemoteVideoStreamStateLocalVideoStreamState 或状态中未指定视图下。 在头罩下 <xref:%40azure%2Fcommunication-calling%23VideoStreamRenderer.createView>。

方案 1:Render RemoteVideoStreamState

方案 2:为调用呈现 LocalVideoStreamState

  • CallId 是必需的,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • <xref:%40azure%2Fcommunication-calling%23Call.localVideoStreams> 必须已开始使用 <xref:%40azure%2Fcommunication-calling%23Call.startVideo>。

  • 生成的 VideoStreamRendererViewState 存储在 CallClientState中给定 callId localVideoStreams 中。

  • 方案 2:呈现 LocalVideoStreamState 不是调用的一部分(用于本地预览的示例渲染相机)

  • CallId 必须未定义,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • 生成的 VideoStreamRendererViewState 存储在 <xref:CallClientState.deviceManager.unparentedViews> 中给定的 LocalVideoStreamState 下

disposeView(undefined | string, undefined | CommunicationIdentifier, CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState)

停止呈现 RemoteVideoStreamStateLocalVideoStreamState 并从相关的 <xref:VideoStreamRendererView>CallClientState 或适当的 下 <xref:LocalVideoStream>。

释放视图以正确清理资源非常重要。

方案 1:释放 RemoteVideoStreamState

  • CallId 是必需的,需要 participantId,并且需要 RemoteVideoStreamState 类型的流

方案 2:释放 LocalVideoStreamState 进行调用

  • CallId 是必需的,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • 方案 2:释放 LocalVideoStreamState 不是调用的一部分

  • CallId 必须未定义,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • LocalVideoStreamState 必须是传递给 createView 的原始实例。

getState()

保留可从 CallClient 代理 <xref:%40azure%2Fcommunication-calling%23CallClient> 作为 CallClientState CallClientState的所有状态。

offStateChange((state: CallClientState) => void)

允许取消注册“stateChanged”事件。

onStateChange((state: CallClientState) => void)

允许为“stateChanged”事件注册处理程序。

继承的方法

dispose()

释放此 CallClient,该 CallClient 也会释放关联的 设备管理器 和关联的呼叫代理。

feature<TFeature>(CallClientFeatureFactory<TFeature>)

使用扩展 API 检索已初始化和备忘录化的功能对象。 检查对象 Features.* 中是否有此包中所有可用的扩展调用客户端功能。

getDeviceManager()

DeviceManager 用于处理媒体设备,例如相机、麦克风和扬声器。

方法详细信息

createCallAgent([tokenCredential, options])

CallAgent 用于处理调用。 若要创建 CallAgent,请传递从 SDK 提供的 CommunicationTokenCredential 对象。

  • CallClient 一次只能有一个活动的 CallAgent 实例。
  • 可以创建新的 CallClient 实例来创建新的 CallAgent。
  • 可以释放 CallClient 的当前活动 CallAgent,并再次调用 CallClient 的 createCallAgent() 方法来创建新的 CallAgent。
function createCallAgent(args: [tokenCredential, options]): Promise<DeclarativeCallAgent>

参数

args

[tokenCredential, options]

返回

createTeamsCallAgent([tokenCredential, options])

TeamsCallAgent 用于处理呼叫。 若要创建 TeamsCallAgent,请传递从 SDK 提供的 CommunicationTokenCredential 对象。

  • CallClient 一次只能有一个活动的 TeamsCallAgent 实例。
  • 可以创建新的 CallClient 实例以创建新的 TeamsCallAgent。
  • 可以释放 CallClient 的当前活动 TeamsCallAgent,并再次调用 CallClient 的 createTeamsCallAgent() 方法来创建新的 TeamsCallAgent。
function createTeamsCallAgent(args: [tokenCredential, options]): Promise<DeclarativeTeamsCallAgent>

参数

args

[tokenCredential, options]

返回

createView(undefined | string, undefined | CommunicationIdentifier, CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState, CreateViewOptions)

呈现 RemoteVideoStreamStateLocalVideoStreamState,并将生成的 videoStreamRendererViewState 存储在相关RemoteVideoStreamStateLocalVideoStreamState 或状态中未指定视图下。 在头罩下 <xref:%40azure%2Fcommunication-calling%23VideoStreamRenderer.createView>。

方案 1:Render RemoteVideoStreamState

方案 2:为调用呈现 LocalVideoStreamState

  • CallId 是必需的,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • <xref:%40azure%2Fcommunication-calling%23Call.localVideoStreams> 必须已开始使用 <xref:%40azure%2Fcommunication-calling%23Call.startVideo>。

  • 生成的 VideoStreamRendererViewState 存储在 CallClientState中给定 callId localVideoStreams 中。

  • 方案 2:呈现 LocalVideoStreamState 不是调用的一部分(用于本地预览的示例渲染相机)

  • CallId 必须未定义,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • 生成的 VideoStreamRendererViewState 存储在 <xref:CallClientState.deviceManager.unparentedViews> 中给定的 LocalVideoStreamState 下

function createView(callId: undefined | string, participantId: undefined | CommunicationIdentifier, stream: CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState, options?: CreateViewOptions): Promise<undefined | CreateViewResult>

参数

callId

undefined | string

给定流的 CallId。 如果流不是任何调用的一部分,则可以取消定义。

participantId

undefined | CommunicationIdentifier

与给定 RemoteVideoStreamState 关联的 <xref:RemoteParticipant.identifier>。 如果呈现 LocalVideoStreamState,则无法定义。

stream

CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState

要开始呈现的 LocalVideoStreamState 或 RemoteVideoStreamState。

options
CreateViewOptions

传递给 <xref:%40azure%2Fcommunication-calling%23VideoStreamRenderer>的选项。

返回

Promise<undefined | CreateViewResult>

disposeView(undefined | string, undefined | CommunicationIdentifier, CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState)

停止呈现 RemoteVideoStreamStateLocalVideoStreamState 并从相关的 <xref:VideoStreamRendererView>CallClientState 或适当的 下 <xref:LocalVideoStream>。

释放视图以正确清理资源非常重要。

方案 1:释放 RemoteVideoStreamState

  • CallId 是必需的,需要 participantId,并且需要 RemoteVideoStreamState 类型的流

方案 2:释放 LocalVideoStreamState 进行调用

  • CallId 是必需的,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • 方案 2:释放 LocalVideoStreamState 不是调用的一部分

  • CallId 必须未定义,参与者 Id 必须未定义,并且需要 LocalVideoStreamState 类型的流。

  • LocalVideoStreamState 必须是传递给 createView 的原始实例。

function disposeView(callId: undefined | string, participantId: undefined | CommunicationIdentifier, stream: CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState)

参数

callId

undefined | string

给定流的 CallId。 如果流不是任何调用的一部分,则可以取消定义。

participantId

undefined | CommunicationIdentifier

与给定 RemoteVideoStreamState 关联的 <xref:RemoteParticipant.identifier>。 如果释放 LocalVideoStreamState,则无法定义。

stream

CallFeatureStreamState | RemoteVideoStreamState | LocalVideoStreamState

要释放的 LocalVideoStreamState 或 RemoteVideoStreamState。

getState()

保留可从 CallClient 代理 <xref:%40azure%2Fcommunication-calling%23CallClient> 作为 CallClientState CallClientState的所有状态。

function getState(): CallClientState

返回

offStateChange((state: CallClientState) => void)

允许取消注册“stateChanged”事件。

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

参数

handler

(state: CallClientState) => void

要取消订阅的原始回调。

onStateChange((state: CallClientState) => void)

允许为“stateChanged”事件注册处理程序。

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

参数

handler

(state: CallClientState) => void

用于接收状态的回调。

继承的方法详细信息

dispose()

释放此 CallClient,该 CallClient 也会释放关联的 设备管理器 和关联的呼叫代理。

function dispose(): Promise<void>

返回

Promise<void>

继承自 CallClient.dispose

feature<TFeature>(CallClientFeatureFactory<TFeature>)

使用扩展 API 检索已初始化和备忘录化的功能对象。 检查对象 Features.* 中是否有此包中所有可用的扩展调用客户端功能。

function feature<TFeature>(factory: CallClientFeatureFactory<TFeature>): TFeature

参数

factory

CallClientFeatureFactory<TFeature>

用于提供扩展 API 的调用客户端功能构造函数的工厂。

返回

TFeature

继承自 CallClient.feature

getDeviceManager()

DeviceManager 用于处理媒体设备,例如相机、麦克风和扬声器。

function getDeviceManager(): Promise<DeviceManager>

返回

Promise<DeviceManager>

继承自 CallClient.getDeviceManager