diff --git a/zh-cn/application-dev/reference/apis-avsession-kit/js-apis-avsession.md b/zh-cn/application-dev/reference/apis-avsession-kit/js-apis-avsession.md index fe209b7d0a595b860292b6375019af8de45282b9..83b6eadc3fb6c9e739a8f474d3a82528e0fb36a5 100644 --- a/zh-cn/application-dev/reference/apis-avsession-kit/js-apis-avsession.md +++ b/zh-cn/application-dev/reference/apis-avsession-kit/js-apis-avsession.md @@ -53,6 +53,8 @@ createAVSession(context: Context, tag: string, type: AVSessionType): Promise\ { + currentAVSession = data; + sessionId = currentAVSession.sessionId; + console.info(`CreateAVSession : SUCCESS : sessionId = ${sessionId}`); +}).catch((err: Error) => { + console.info(`CreateAVSession BusinessError: code: ${(err as BusinessError).code}, message: ${(err as BusinessError).message}`); +}); +``` + ## avSession.createAVSession10+ createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\): void @@ -3210,6 +3231,8 @@ getAllCastDisplays(): Promise> **示例:** +ArkTS1.1示例: + ```ts import { BusinessError } from '@kit.BasicServicesKit'; @@ -3223,6 +3246,21 @@ currentAVSession.getAllCastDisplays().then((data: Array< avSession.CastDisplayIn }); ``` +ArkTS1.2示例: + +```ts +import { BusinessError } from '@kit.BasicServicesKit'; + +let castDisplay: avSession.CastDisplayInfo; +currentAVSession.getAllCastDisplays().then((data: Array< avSession.CastDisplayInfo >) => { + if (data.length >= 1) { + castDisplay = data[0]; + } + }).catch((err: Error) => { + console.error(`Failed to getAllCastDisplay. Code: ${(err as BusinessError).code}, message: ${(err as BusinessError).message}`); + }); +``` + ## AVCastControlCommandType10+ type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' |