From 98084c3d78fa8abd404d81d2d0a40a6d4e17ab6f Mon Sep 17 00:00:00 2001 From: liujia178 Date: Fri, 16 May 2025 14:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9multimedia=20avSession=20arkt?= =?UTF-8?q?s1.2=20=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujia178 --- .../apis-avsession-kit/js-apis-avsession.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) 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 fe209b7d0a5..83b6eadc3fb 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' | -- Gitee