From 35bfaf85ed6e2496ead0efc0a2bfb80b9e33161d Mon Sep 17 00:00:00 2001 From: xuyong Date: Tue, 8 Feb 2022 10:13:20 +0800 Subject: [PATCH 01/28] =?UTF-8?q?HiTrace=20Js=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- api/@ohos.hitrace.d.ts | 214 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 api/@ohos.hitrace.d.ts diff --git a/api/@ohos.hitrace.d.ts b/api/@ohos.hitrace.d.ts new file mode 100644 index 0000000000..cebf79a519 --- /dev/null +++ b/api/@ohos.hitrace.d.ts @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Provides APIs to implement call chain tracing throughout a service process. + * With HiTrace, you can quickly obtain the run log for the call chain of a + * specified service process and locate faults in cross-device, cross-process, + * or cross-thread communications. + * + * @since 9 + */ +declare namespace hitrace { + /** + * Enumerate trace flag + */ + enum HiTraceFlag { + /** + * default value + */ + DEFAULT = 0, + + /** + * trace sync and async call. default: trace sync call only. + */ + INCLUDE_ASYNC = 1, + + /** + * do not create child span. default: create child span. + */ + DONOT_CREATE_SPAN = 1 << 1, + + /** + * output tracepoint info in span. default: do not output tracepoint info. + */ + TP_INFO = 1 << 2, + + /** + * do not output begin and end info. default: output begin and end info. + */ + NO_BE_INFO = 1 << 3, + + /** + * do not add id to log. default: add id to log. + */ + DONOT_ENABLE_LOG = 1 << 4, + + /** + * the trace is triggered by fault. + */ + FAILURE_TRIGGER = 1 << 5, + + /** + * output device-to-device tracepoint info in span only. default: do not output device-to-device tracepoint info. + */ + D2D_TP_INFO = 1 << 6, + } + + /** + * Enumerate trace point type + */ + enum HiTraceTracePointType { + /** + * client send + */ + CS = 0, + + /** + * client receive + */ + CR = 1, + + /** + * server send + */ + SS = 2, + + /** + * server receive + */ + SR = 3, + + /** + * general info + */ + GENERAL = 4, + } + + /** + * Enumerate trace communication mode + */ + enum HiTraceCommunicationMode { + /** + * unspecified + */ + DEFAULT = 0, + + /** + * thread-to-thread + */ + THREAD = 1, + + /** + * process-to-process + */ + PROCESS = 2, + + /** + * device-to-device + */ + DEVICE = 3, + } + + /** + * trace id + */ + interface HiTraceId { + chainId: bigint; /* 0n: invalid */ + spandId?: number; + parentSpanId?: number; + flags?: number; + } + + /** + * begin a new trace. + * + * @param {string} name trace name. + * @param {number} flags trace flags. + * @return {HiTraceId} id of the trace. + */ + function begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId; + + /** + * end a trace by trace id. + * + * @param {HiTraceId} id trace id of the trace. + */ + function end(id: HiTraceId): void; + + /** + * get the trace id of a trace. + * + * @return {HiTraceId} trace id of a trace. + */ + function getId(): HiTraceId; + + /** + * change the trace id for a trace. + * + * @param {HiTraceId} id trace id which will be set into a trace. + */ + function setId(id: HiTraceId): void; + + /** + * clear the id of a trace. + * + */ + function clearId(): void; + + /** + * create span for a trace. + * + * @return {HiTraceId} trace id of the trace which has created a span. + */ + function createSpan(): HiTraceId; + + /** + * set a trace point + * + * @param {HiTraceCommunicationMode} mode communication mode. + * @param {HiTraceTracePointType} type trace point type. + * @param {HiTraceId} id trace id of the trace. + * @param {string} msg description about this trace point. + */ + function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracePointType, id: HiTraceId, msg?: string): void; + + /** + * check whether a trace id is valid. + * + * @param {HiTraceId} id the trace id to check. + * @return {boolean} true if trace id is valid. + */ + function isValid(id: HiTraceId): boolean; + + /** + * check whether a trace id has enabled the designative trace flag. + * + * @param {HiTraceId} id the trace id to check. + * @param {HiTraceFlag} flag the trace flag to check. + * @return {boolean} true if the flag has been enabled in a trace. + */ + function isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean; + + /** + * enable a designative trace flag for a trace id. + * + * @param {HiTraceId} id trace id which need enable a flag. + * @param {HiTraceFlag} flag the designative trace flag which will be enabled. + */ + function enableFlag(id: HiTraceId, flag: HiTraceFlag): void; +} + +export default hitrace; -- Gitee From 9f480588bf5397a49c6e2320229605c21f0fc197 Mon Sep 17 00:00:00 2001 From: xuyong Date: Tue, 8 Feb 2022 11:27:58 +0800 Subject: [PATCH 02/28] =?UTF-8?q?hitrace=20js=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- api/@ohos.hitrace.d.ts | 47 +++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/api/@ohos.hitrace.d.ts b/api/@ohos.hitrace.d.ts index cebf79a519..af1126b058 100644 --- a/api/@ohos.hitrace.d.ts +++ b/api/@ohos.hitrace.d.ts @@ -18,12 +18,16 @@ * With HiTrace, you can quickly obtain the run log for the call chain of a * specified service process and locate faults in cross-device, cross-process, * or cross-thread communications. - * - * @since 9 + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ declare namespace hitrace { /** * Enumerate trace flag + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ enum HiTraceFlag { /** @@ -69,6 +73,9 @@ declare namespace hitrace { /** * Enumerate trace point type + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ enum HiTraceTracePointType { /** @@ -99,6 +106,9 @@ declare namespace hitrace { /** * Enumerate trace communication mode + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ enum HiTraceCommunicationMode { /** @@ -124,6 +134,9 @@ declare namespace hitrace { /** * trace id + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ interface HiTraceId { chainId: bigint; /* 0n: invalid */ @@ -135,6 +148,8 @@ declare namespace hitrace { /** * begin a new trace. * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {string} name trace name. * @param {number} flags trace flags. * @return {HiTraceId} id of the trace. @@ -144,6 +159,8 @@ declare namespace hitrace { /** * end a trace by trace id. * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id trace id of the trace. */ function end(id: HiTraceId): void; @@ -151,6 +168,8 @@ declare namespace hitrace { /** * get the trace id of a trace. * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @return {HiTraceId} trace id of a trace. */ function getId(): HiTraceId; @@ -158,6 +177,8 @@ declare namespace hitrace { /** * change the trace id for a trace. * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id trace id which will be set into a trace. */ function setId(id: HiTraceId): void; @@ -165,19 +186,25 @@ declare namespace hitrace { /** * clear the id of a trace. * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace */ function clearId(): void; /** * create span for a trace. - * + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @return {HiTraceId} trace id of the trace which has created a span. */ function createSpan(): HiTraceId; /** * set a trace point - * + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceCommunicationMode} mode communication mode. * @param {HiTraceTracePointType} type trace point type. * @param {HiTraceId} id trace id of the trace. @@ -187,7 +214,9 @@ declare namespace hitrace { /** * check whether a trace id is valid. - * + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id the trace id to check. * @return {boolean} true if trace id is valid. */ @@ -195,7 +224,9 @@ declare namespace hitrace { /** * check whether a trace id has enabled the designative trace flag. - * + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id the trace id to check. * @param {HiTraceFlag} flag the trace flag to check. * @return {boolean} true if the flag has been enabled in a trace. @@ -204,7 +235,9 @@ declare namespace hitrace { /** * enable a designative trace flag for a trace id. - * + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id trace id which need enable a flag. * @param {HiTraceFlag} flag the designative trace flag which will be enabled. */ -- Gitee From b4d55e729a4ae575a353c1d1a5e8347fefca18f6 Mon Sep 17 00:00:00 2001 From: xuyong Date: Tue, 8 Feb 2022 11:47:38 +0800 Subject: [PATCH 03/28] =?UTF-8?q?hitrace=20js=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- api/@ohos.hitrace.d.ts | 58 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/api/@ohos.hitrace.d.ts b/api/@ohos.hitrace.d.ts index af1126b058..70437f6867 100644 --- a/api/@ohos.hitrace.d.ts +++ b/api/@ohos.hitrace.d.ts @@ -133,7 +133,7 @@ declare namespace hitrace { } /** - * trace id + * trace id, for tracing process. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -150,41 +150,43 @@ declare namespace hitrace { * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {string} name trace name. - * @param {number} flags trace flags. - * @return {HiTraceId} id of the trace. + * @param {string} name Process name. + * @param {number} flags Trace function flag. + * @return {HiTraceId} Valid if first call, otherwise invalid. */ function begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId; /** - * end a trace by trace id. + * Stop process tracing and clear trace id of current thread if the given trace + * id is valid, otherwise do nothing. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceId} id trace id of the trace. + * @param {HiTraceId} id The trace id that need to stop. */ function end(id: HiTraceId): void; /** - * get the trace id of a trace. + * Get trace id of current thread, and return a invalid trace id if no + * trace id belong to current thread * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @return {HiTraceId} trace id of a trace. + * @return {HiTraceId} Valid if current thread have a trace id, otherwise invalid. */ function getId(): HiTraceId; /** - * change the trace id for a trace. + * Set id as trace iod of current thread. Do nothing if id is invalid. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceId} id trace id which will be set into a trace. + * @param {HiTraceId} id Set id as trace id of current thread. */ function setId(id: HiTraceId): void; /** - * clear the id of a trace. + * Clear trace id of current thread and set it invalid. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -192,54 +194,54 @@ declare namespace hitrace { function clearId(): void; /** - * create span for a trace. + * Create a new span Id according to the trace id of current thread. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @return {HiTraceId} trace id of the trace which has created a span. + * @return {HiTraceId} A valid span trace id. Otherwise trace id of current thread if do not allow create span. */ function createSpan(): HiTraceId; /** - * set a trace point + * Print hitrace info, include trace id info. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceCommunicationMode} mode communication mode. - * @param {HiTraceTracePointType} type trace point type. - * @param {HiTraceId} id trace id of the trace. - * @param {string} msg description about this trace point. + * @param {HiTraceCommunicationMode} mode Trace communication mode. + * @param {HiTraceTracePointType} type Trace info type. + * @param {HiTraceId} id Trace id that need to print. + * @param {string} msg Customized info that need to print. */ function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracePointType, id: HiTraceId, msg?: string): void; /** - * check whether a trace id is valid. + * Judge whether the trace id is valid. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceId} id the trace id to check. - * @return {boolean} true if trace id is valid. + * @param {HiTraceId} id Trace id that need to judge. + * @return {boolean} True for a valid trace id, otherwise false. */ function isValid(id: HiTraceId): boolean; /** - * check whether a trace id has enabled the designative trace flag. + * Judge whether the trace id has enabled a flag or not. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceId} id the trace id to check. - * @param {HiTraceFlag} flag the trace flag to check. - * @return {boolean} true if the flag has been enabled in a trace. + * @param {HiTraceId} id Trace id that need to judge. + * @param {HiTraceFlag} flag Trace flag that need to judge. + * @return {boolean} true if the trace id has enabled the flag. */ function isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean; /** - * enable a designative trace flag for a trace id. + * Enable the designative trace flag for the trace id. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace - * @param {HiTraceId} id trace id which need enable a flag. - * @param {HiTraceFlag} flag the designative trace flag which will be enabled. + * @param {HiTraceId} id Trace id that need to enable a flag. + * @param {HiTraceFlag} flag the designative trace flag that need to be enabled in the trace id. */ function enableFlag(id: HiTraceId, flag: HiTraceFlag): void; } -- Gitee From ac70ebd468b561afcb1d4c5aa30340ac43c886cf Mon Sep 17 00:00:00 2001 From: xuyong Date: Thu, 10 Feb 2022 15:43:18 +0800 Subject: [PATCH 04/28] =?UTF-8?q?HiTrace=20JS=20API=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- ...s.hitrace.d.ts => @ohos.hiTraceChain.d.ts} | 4 +- api/@ohos.hiTraceMeter.d.ts | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) rename api/{@ohos.hitrace.d.ts => @ohos.hiTraceChain.d.ts} (99%) create mode 100644 api/@ohos.hiTraceMeter.d.ts diff --git a/api/@ohos.hitrace.d.ts b/api/@ohos.hiTraceChain.d.ts similarity index 99% rename from api/@ohos.hitrace.d.ts rename to api/@ohos.hiTraceChain.d.ts index 70437f6867..ccbce6ca6b 100644 --- a/api/@ohos.hitrace.d.ts +++ b/api/@ohos.hiTraceChain.d.ts @@ -22,7 +22,7 @@ * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace */ -declare namespace hitrace { +declare namespace hiTraceChain { /** * Enumerate trace flag * @@ -246,4 +246,4 @@ declare namespace hitrace { function enableFlag(id: HiTraceId, flag: HiTraceFlag): void; } -export default hitrace; +export default hiTraceChain; diff --git a/api/@ohos.hiTraceMeter.d.ts b/api/@ohos.hiTraceMeter.d.ts new file mode 100644 index 0000000000..7d5a4cd4c9 --- /dev/null +++ b/api/@ohos.hiTraceMeter.d.ts @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import bytrace from './@ohos.bytrace' + +/** + * Provides interfaces to trace a task for performance measure, the logs can be capture by the + * bytrace cmdline available on the device. + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace + */ + declare namespace hiTraceMeter { + /** + * Records a trace marking it as the start of a task, can with the expected completion time between + * startTrace and finishTrace. + * + * This method is invoked at the start of a transaction to indicate that a task has started, whose name + * is specified by {@code name}, and the taskId is used to distinguish the tasks. It must be followed by + * {@link #finishTrace}, the name and taskId need to be the same. + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace + * @param name Indicates the task name. + * @param taskId The unique id used to distinguish the tasks and match with the id in follow finishTrace. + * @param expectedTime Indicates the expected time required for completing the task, in milliseconds. + */ + function startTrace(name: string, taskId: number, expectedTime?: number): void { + bytrace.startTrace(name, taskId, expectedTime); + } + + /** + * Records a trace and marks it as the end of a task. + * + * This method is invoked at the end of a transaction to indicate that a task has ended, whose name + * is specified by {@code name}. This method must be invoked after the the startTrace. + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace + * @param name Indicates the task name. It must be the same whith the {@code name} of startTrace. + * @param taskId The unique id used to distinguish the tasks and must be the same whith the . + * {@code taskId} of startTrace. + */ + function finishTrace(name: string, taskId: number): void { + bytrace.finishTrace(name, taskId); + } + + /** + * Records a trace for generating a count, such as clock pulse and the number of layers. + * + * @since 8 + * @SysCap SystemCapability.HiviewDFX.HiTrace + * @param name Indicates the name used to identify the count. + * @param count Indicates the number of the count. + */ + function traceByValue(name: string, count: number): void { + bytrace.traceByValue(name, count); + } + } + export default hiTraceMeter; \ No newline at end of file -- Gitee From 866e0ff3b11e6bd8c35394fee4f32c6cc449ae56 Mon Sep 17 00:00:00 2001 From: xuyong Date: Thu, 10 Feb 2022 20:52:54 +0800 Subject: [PATCH 05/28] HiTrace Js Api Signed-off-by: xuyong --- api/@ohos.hiTraceMeter.d.ts | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/api/@ohos.hiTraceMeter.d.ts b/api/@ohos.hiTraceMeter.d.ts index 7d5a4cd4c9..95b1984c12 100644 --- a/api/@ohos.hiTraceMeter.d.ts +++ b/api/@ohos.hiTraceMeter.d.ts @@ -13,8 +13,6 @@ * limitations under the License. */ -import bytrace from './@ohos.bytrace' - /** * Provides interfaces to trace a task for performance measure, the logs can be capture by the * bytrace cmdline available on the device. @@ -22,7 +20,7 @@ import bytrace from './@ohos.bytrace' * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace */ - declare namespace hiTraceMeter { +declare namespace hiTraceMeter { /** * Records a trace marking it as the start of a task, can with the expected completion time between * startTrace and finishTrace. @@ -35,11 +33,8 @@ import bytrace from './@ohos.bytrace' * @SysCap SystemCapability.HiviewDFX.HiTrace * @param name Indicates the task name. * @param taskId The unique id used to distinguish the tasks and match with the id in follow finishTrace. - * @param expectedTime Indicates the expected time required for completing the task, in milliseconds. */ - function startTrace(name: string, taskId: number, expectedTime?: number): void { - bytrace.startTrace(name, taskId, expectedTime); - } + function startTrace(name: string, taskId: number): void; /** * Records a trace and marks it as the end of a task. @@ -53,9 +48,7 @@ import bytrace from './@ohos.bytrace' * @param taskId The unique id used to distinguish the tasks and must be the same whith the . * {@code taskId} of startTrace. */ - function finishTrace(name: string, taskId: number): void { - bytrace.finishTrace(name, taskId); - } + function finishTrace(name: string, taskId: number): void; /** * Records a trace for generating a count, such as clock pulse and the number of layers. @@ -65,8 +58,7 @@ import bytrace from './@ohos.bytrace' * @param name Indicates the name used to identify the count. * @param count Indicates the number of the count. */ - function traceByValue(name: string, count: number): void { - bytrace.traceByValue(name, count); - } - } - export default hiTraceMeter; \ No newline at end of file + function traceByValue(name: string, count: number): void; +} + +export default hiTraceMeter; \ No newline at end of file -- Gitee From 1e84162f47582b7e1b1a2be86b1820453611cd57 Mon Sep 17 00:00:00 2001 From: xuyong Date: Fri, 11 Feb 2022 13:56:38 +0800 Subject: [PATCH 06/28] HiTrace Js Api Signed-off-by: xuyong --- api/@ohos.bytrace.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/@ohos.bytrace.d.ts b/api/@ohos.bytrace.d.ts index dcc5ba1bf0..93c004030a 100644 --- a/api/@ohos.bytrace.d.ts +++ b/api/@ohos.bytrace.d.ts @@ -34,9 +34,9 @@ *

Each {@code startTrace} matches one {@code finishTrace}, and they must have the same name * and taskId. * - * @SysCap SystemCapability.Developtools.Bytrace - * @devices phone, tablet + * @deprecated * @since 7 + * @SysCap SystemCapability.Developtools.Bytrace */ declare namespace bytrace { /** @@ -47,10 +47,12 @@ declare namespace bytrace { * is specified by {@code name}, and the taskId is used to distinguish the tasks. It must be followed by * {@link #finishTrace}, the name and taskId need to be the same. * + * @deprecated + * @since 7 + * @SysCap SystemCapability.Developtools.Bytrace * @param name Indicates the task name. * @param taskId The unique id used to distinguish the tasks and match with the id in follow finishTrace. * @param expectedTime Indicates the expected time required for completing the task, in milliseconds. - * @since 7 */ function startTrace(name: string, taskId: number, expectedTime?: number): void; @@ -60,6 +62,9 @@ declare namespace bytrace { * This method is invoked at the end of a transaction to indicate that a task has ended, whose name * is specified by {@code name}. This method must be invoked after the the startTrace. * + * @deprecated + * @since 7 + * @SysCap SystemCapability.Developtools.Bytrace * @param name Indicates the task name. It must be the same whith the {@code name} of startTrace. * @param taskId The unique id used to distinguish the tasks and must be the same whith the . * {@code taskId} of startTrace. -- Gitee From c3e42b14f8e8dcb7ebb20d1dd4a945ebabf20b45 Mon Sep 17 00:00:00 2001 From: xuyong Date: Fri, 11 Feb 2022 15:17:07 +0800 Subject: [PATCH 07/28] HiTrace Js Api Signed-off-by: xuyong --- api/@ohos.bytrace.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/@ohos.bytrace.d.ts b/api/@ohos.bytrace.d.ts index 93c004030a..1acc5cc2a9 100644 --- a/api/@ohos.bytrace.d.ts +++ b/api/@ohos.bytrace.d.ts @@ -68,16 +68,17 @@ declare namespace bytrace { * @param name Indicates the task name. It must be the same whith the {@code name} of startTrace. * @param taskId The unique id used to distinguish the tasks and must be the same whith the . * {@code taskId} of startTrace. - * @since 7 */ function finishTrace(name: string, taskId: number): void; /** * Records a trace for generating a count, such as clock pulse and the number of layers. * + * @deprecated + * @since 7 + * @SysCap SystemCapability.Developtools.Bytrace * @param name Indicates the name used to identify the count. * @param count Indicates the number of the count. - * @since 7 */ function traceByValue(name: string, count: number): void; } -- Gitee From b287a5d3202337eeb89e0884831a48e443e00d69 Mon Sep 17 00:00:00 2001 From: xuyong Date: Fri, 11 Feb 2022 17:10:03 +0800 Subject: [PATCH 08/28] HiTrace Js Api Signed-off-by: xuyong --- api/@ohos.hiTraceMeter.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/@ohos.hiTraceMeter.d.ts b/api/@ohos.hiTraceMeter.d.ts index 95b1984c12..1d624ced5b 100644 --- a/api/@ohos.hiTraceMeter.d.ts +++ b/api/@ohos.hiTraceMeter.d.ts @@ -17,6 +17,23 @@ * Provides interfaces to trace a task for performance measure, the logs can be capture by the * bytrace cmdline available on the device. * + *

This interfaces trace the start, end, and value changes of key processes that last for at least 3 ms. + * + *

Example: + * To trace a name verification that is expected to complete within 5 ms: + *

{@code
+ * bytrace.startTrace("checkName", 111, 5);
+ * //your process
+ * bytrace.finishTrace("checkName", 111);
+ * }
+ * To trace the number of layers, which is 3: + *
{@code
+ * bytrace.traceByValue("curLayer", 3);
+ * }
+ * + *

Each {@code startTrace} matches one {@code finishTrace}, and they must have the same name + * and taskId. + * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace */ -- Gitee From 0c6dab61dbb3d57f2708a5442959684da21d28cf Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:34:18 +0800 Subject: [PATCH 09/28] add the media js API8 Signed-off-by: sharpshooter_t Change-Id: Iafa739c37072a300bf8fab3216625889a56039c2 --- api/@ohos.multimedia.media.d.ts | 1044 ++++++++++++++++++++++++++++++- 1 file changed, 1028 insertions(+), 16 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 54d94dab6c..8167f0c51a 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -41,13 +41,128 @@ declare namespace media { */ function createAudioRecorder(): AudioRecorder; + /** + * Creates an VideoPlayer instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + */ + function createVideoPlayer(callback: AsyncCallback): void; + /** + * Creates an VideoPlayer instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. + */ + function createVideoPlayer() : Promise; + + /** + * Creates an VideoRecorder instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + */ + function createVideoRecorder(callback: AsyncCallback): void; + /** + * Creates an VideoRecorder instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + */ + function createVideoRecorder(): Promise; + + /** + * Enumerates ErrorCode types, return in BusinessError::code + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaErrorCode { + /** + * operation success. + */ + MSERR_OK = 0, + + /** + * malloc or new memory failed. maybe system have no memory. + */ + MSERR_NO_MEMORY = 1, + + /** + * no permission for the operation. + */ + MSERR_OPERATION_NOT_PERMIT = 2, + + /** + * invalid argument. + */ + MSERR_INVALID_VAL = 3, + + /** + * an IO error occurred. + */ + MSERR_IO = 4, + + /** + * operation time out. + */ + MSERR_TIMEOUT = 5, + + /** + * unknown error. + */ + MSERR_UNKNOWN = 6, + + /** + * media service died. + */ + MSERR_SERVICE_DIED = 7, + + /** + * operation is not permit in current state. + */ + MSERR_INVALID_STATE = 8, + + /** + * operation is not supported in current version. + */ + MSERR_UNSUPPORTED = 9, + } + + /** + * Enumerates buffering info type, for network playback. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum BufferingInfoType { + /* begin to buffering*/ + BUFFERING_START = 1, + + /* end to buffering*/ + BUFFERING_END = 2, + + /* buffering percent*/ + BUFFERING_PERCENT = 3, + + /* cached duration in milliseconds*/ + CACHED_DURATION = 4, + } + /** * Describes audio playback states. */ - type AudioState = 'idle' | 'playing' | 'paused' | 'stopped'; + type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; /** - * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() to create an AudioPlayer instance. + * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() + * or createAudioPlayerAsync() to create an AudioPlayer instance. */ interface AudioPlayer { /** @@ -74,10 +189,10 @@ declare namespace media { */ stop(): void; - /** + /**` * Resets audio playback. * @devices phone, tablet, tv, wearable - * @since 7 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ reset(): void; @@ -107,9 +222,37 @@ declare namespace media { * @SysCap SystemCapability.Multimedia.Media */ release(): void; + /** + * get all track infos in MediaDescription, should be called after data loaded callback. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback async callback return track info in MediaDescription. + */ + getTrackDescription(callback: AsyncCallback>): void; + + /** + * get all track infos in MediaDescription, should be called after data loaded callback.. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param index track index. + * @return A Promise instance used to return the track info in MediaDescription. + */ + getTrackDescription() : Promise>; + /** + * Listens for audio playback buffering events. + * @devices phone, tablet, tv, wearable + * @since 6 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback buffering update event to listen for. + * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; /** * Audio media URI. Mainstream audio formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -133,7 +276,7 @@ declare namespace media { readonly currentTime: number; /** - * Playback duration. When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -180,7 +323,7 @@ declare namespace media { } /** - * Enumerates audio encoding formats. + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' @@ -194,7 +337,7 @@ declare namespace media { } /** - * Enumerates audio output formats. + * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' @@ -216,7 +359,7 @@ declare namespace media { /** * Latitude. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ latitude: number; @@ -224,7 +367,7 @@ declare namespace media { /** * Longitude. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ longitude: number; @@ -232,7 +375,8 @@ declare namespace media { interface AudioRecorderConfig { /** - * Audio encoding format. The default value is DEFAULT. + * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. + * use "audioEncoderMime" instead. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -245,7 +389,7 @@ declare namespace media { * @since 6 * @SysCap SystemCapability.Multimedia.Media */ - audioEncodeBitRate?: number; + audioEncodeBitrate?: number; /** * Audio sampling rate. @@ -264,7 +408,8 @@ declare namespace media { numberOfChannels?: number; /** - * Audio output format. The default value is DEFAULT. + * Audio output format. The default value is DEFAULT, it will be deprecated after API8. + * it will be use "fileFormat" to instead of. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -285,10 +430,25 @@ declare namespace media { /** * Geographical location information. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media */ location?: Location; + + /** + * audio encoding format MIME. it used to instead of audioEncoder. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + audioEncoderMime?: CodecMimeType; + /** + * output file format. see @ContainerFormatType , it used to instead of "format". + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + fileFormat?: ContainerFormatType; } interface AudioRecorder { @@ -343,7 +503,8 @@ declare namespace media { /** * Resets audio recording. - * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, you must call prepare() to set the recording configurations for another recording. + * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, + * you must call prepare() to set the recording configurations for another recording. * @devices phone, tablet, tv, wearable * @since 6 * @SysCap SystemCapability.Multimedia.Media @@ -370,6 +531,857 @@ declare namespace media { */ on(type: 'error', callback: ErrorCallback): void; } -} -export default media; \ No newline at end of file + /** + * Describes video recorder states. + */ + type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + + interface VideoRecorder { + /** + * Prepares for recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param config Recording parameters. + * @param callback A callback instance used to return when prepare completed. + */ + prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param config Recording parameters. + * @return A Promise instance used to return when prepare completed. + */ + prepare(config: VideoRecorderConfig): Promise; + /** + * get input surface.it must be called between prepare completed and start. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback Callback used to return the input surface id in string. + */ + getInputSurface(callback: AsyncCallback): void; + /** + * get input surface. it must be called between prepare completed and start. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return the input surface id in string. + */ + getInputSurface(): Promise; + /** + * Starts video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when start completed. + */ + start(callback: AsyncCallback): void; + /** + * Starts video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when start completed. + */ + start(): Promise; + /** + * Pauses video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when pause completed. + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when pause completed. + */ + pause(): Promise; + /** + * Resumes video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when resume completed. + */ + resume(callback: AsyncCallback): void; + /** + * Resumes video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when resume completed. + */ + resume(): Promise; + /** + * Stops video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when stop completed. + */ + stop(callback: AsyncCallback): void; + /** + * Stops video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when stop completed. + */ + stop(): Promise; + /** + * Releases resources used for video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when release completed. + */ + release(): Promise; + /** + * Resets video recording. + * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, + * you must call prepare() to set the recording configurations for another recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when reset completed. + */ + reset(callback: AsyncCallback): void; + /** + * Resets video recording. + * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, + * you must call prepare() to set the recording configurations for another recording. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when reset completed. + */ + reset(): Promise; + /** + * Listens for video recording error events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the video recording error event to listen for. + * @param callback Callback used to listen for the video recording error event. + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * video recorder state. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly state: VideoRecordState; + } + + /** + * Describes video playback states. + */ + type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + + /** + * Enumerates playback speed. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum PlaybackSpeed { + /* playback at 0.75x normal speed */ + SPEED_FORWARD_0_75_X = 0, + /* playback at normal speed */ + SPEED_FORWARD_1_00_X = 1, + /* playback at 1.25x normal speed */ + SPEED_FORWARD_1_25_X = 2, + /* playback at 1.75x normal speed */ + SPEED_FORWARD_1_75_X = 3, + /* playback at 2.0x normal speed */ + SPEED_FORWARD_2_00_X = 4, + } + + /** + * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer + * instance. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + interface VideoPlayer { + /** + * set display surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param surfaceId surface id, video player will use this id get a surface instance. + * @return A Promise instance used to return when release output buffer completed. + */ + setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; + /** + * set display surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param surfaceId surface id, video player will use this id get a surface instance. + * @return A Promise instance used to return when release output buffer completed. + */ + setDisplaySurface(surfaceId: string): Promise; + /** + * prepare video playback, it will request resource for playing. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when prepare completed. + */ + prepare(callback: AsyncCallback): void; + /** + * prepare video playback, it will request resource for playing. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when prepare completed. + */ + prepare(): Promise; + /** + * Starts video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when start completed. + */ + play(callback: AsyncCallback): void; + /** + * Starts video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when start completed. + */ + play(): Promise; + /** + * Pauses video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when pause completed. + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when pause completed. + */ + pause(): Promise; + /** + * Stops video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when stop completed. + */ + stop(callback: AsyncCallback): void; + /** + * Stops video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when stop completed. + */ + stop(): Promise; + /** + * Resets video playback, it will release the resource. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when reset completed. + */ + reset(callback: AsyncCallback): void; + /** + * Resets video playback, it will release the resource. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when reset completed. + */ + reset(): Promise; + /** + * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), + * the performance may be not the best. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param callback A callback instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param mode seek mode, see @SeekMode . + * @param callback A callback instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param timeMs Playback position to jump + * @param mode seek mode, see @SeekMode . + * @return A Promise instance used to return when seek completed + * and return the seeking position result. + */ + seek(timeMs: number, mode?:SeekMode): Promise; + /** + * Sets the volume. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @param callback A callback instance used to return when set volume completed. + */ + setVolume(vol: number, callback: AsyncCallback): void; + /** + * Sets the volume. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @return A Promise instance used to return when set volume completed. + */ + setVolume(vol: number): Promise; + /** + * Releases resources used for video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback A callback instance used to return when release completed. + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @return A Promise instance used to return when release completed. + */ + release(): Promise; + /** + * get all track infos in MediaDescription, should be called after data loaded callback. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param callback async callback return track info in MediaDescription. + */ + getTrackDescription(callback: AsyncCallback>): void; + + /** + * get all track infos in MediaDescription, should be called after data loaded callback.. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param index track index. + * @return A Promise instance used to return the track info in MediaDescription. + */ + getTrackDescription() : Promise>; + + /** + * media url. Mainstream video formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + url: string; + + /** + * Whether to loop video playback. The value true means to loop playback. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + loop: boolean; + + /** + * Current playback position. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly currentTime: number; + + /** + * Playback duration, if -1 means cannot seek. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly duration: number; + + /** + * Playback state. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly state: VideoPlayState; + + /** + * video width, valid after prepared. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly width: number; + + /** + * video height, valid after prepared. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly height: number; + + /** + * set payback speed. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param speed playback speed, see @PlaybackSpeed . + * @param callback Callback used to return actually speed. + */ + setSpeed(speed:number, callback: AsyncCallback): void; + /** + * set output surface. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param speed playback speed, see @PlaybackSpeed . + * @return A Promise instance used to return actually speed. + */ + setSpeed(speed:number): Promise; + + /** + * Listens for video playback completed events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return . + */ + on(type: 'playbackCompleted', callback: Callback): void; + + /** + * Listens for video playback buffering events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback buffering update event to listen for. + * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + + /** + * Listens for start render video frame events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return . + */ + on(type: 'startRenderFrame', callback: Callback): void; + + /** + * Listens for video size changed event. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback event to listen for. + * @param callback Callback used to listen for the playback event return video size. + */ + on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; + + /** + * Listens for playback error events. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @param type Type of the playback error event to listen for. + * @param callback Callback used to listen for the playback error event. + */ + on(type: 'error', callback: ErrorCallback): void; + } + + /** + * Enumerates container format type(The abbreviation for 'container format type' is CFT). + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum ContainerFormatType { + /** + * A video container format type mp4. + */ + CFT_MPEG_4 = "mp4", + + /** + * A audio container format type m4a. + */ + CFT_MPEG_4A = "m4a", + } + + /** + * Enumerates media data type. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaType { + /** + * track is audio. + */ + MEDIA_TYPE_AUD = 0, + /** + * track is video. + */ + MEDIA_TYPE_VID = 1, + } + + /** + * Enumerates media description key. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum MediaDescriptionKey { + /** + * key for track index, value type is number. + */ + MD_KEY_TRACK_INDEX = "track_index", + + /** + * key for track type, value type is number, see @MediaType . + */ + MD_KEY_TRACK_TYPE = "track_type", + + /** + * key for codec mime type, value type is string. + */ + MD_KEY_CODEC_MIME = "codec_mime", + + /** + * key for duration, value type is number. + */ + MD_KEY_DURATION = "duration", + + /** + * key for bitrate, value type is number. + */ + MD_KEY_BITRATE = "bitrate", + + /** + * key for video width, value type is number. + */ + MD_KEY_WIDTH = "width", + + /** + * key for video height, value type is number. + */ + MD_KEY_HEIGHT = "height", + + /** + * key for video frame rate, value type is number,The value is 100 times the actual frame rate. + * example: The real frame rate is 23.99, so this value is 2399. + */ + MD_KEY_FRAME_RATE = "frame_rate", + + /** + * key for audio channel count, value type is number + */ + MD_KEY_AUD_CHANNEL_COUNT = "channel_count", + + /** + * key for audio sample rate, value type is number + */ + MD_KEY_AUD_SAMPLE_RATE = "sample_rate", + } + + interface VideoRecorderProfile { + /** + * Indicates the audio bit rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioBitrate: number; + + /** + * Indicates the number of audio channels. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioChannels: number; + + /** + * Indicates the audio encoding format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioCodec: CodecMimeType; + + /** + * Indicates the audio sampling rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly audioSampleRate: number; + + /** + * Indicates the output file format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly fileFormat: ContainerFormatType; + + /** + * Indicates the video bit rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoBitrate: number; + + /** + * Indicates the video encoding format. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoCodec: CodecMimeType; + + /** + * Indicates the video width. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameWidth: number; + + /** + * Indicates the video height. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameHeight: number; + + /** + * Indicates the video frame rate. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + readonly videoFrameRate: number; + } + + /** + * Enumerates audio source type for recorder. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum AudioSourceType { + /** + * default audio source type. + */ + AUDIO_SOURCE_TYPE_DEFAULT = 0, + /** + * source type mic. + */ + AUDIO_SOURCE_TYPE_MIC = 1, + } + + /** + * Enumerates video source type for recorder. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum VideoSourceType { + /** + * surface raw data. + */ + VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, + /** + * surface ES data. + */ + VIDEO_SOURCE_TYPE_SURFACE_ES = 1, + } + + interface VideoRecorderConfig { + /** + * audio source type, details see @AudioSourceType . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + audioSourceType: AudioSourceType; + /** + * video source type, details see @VideoSourceType . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + videoSourceType: VideoSourceType; + /** + * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + profile:VideoRecorderProfile; + /** + * video output uri.support two kind of uri now. + * format like: scheme + "://" + "context". + * file: file://path + * fd: fd://fd + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + url: string; + /** + * Sets the video rotation angle in output file, and for the file to playback. mp4 support. + * the range of rotation angle should be {0, 90, 180, 270}, default is 0. + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + rotation?: number; + /** + * geographical location information. + * @devices phone, tablet, tv, wearable + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + location?: Location; + } + + interface MediaDescription { + /** + * key:value pair, key see @MediaDescriptionKey . + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + */ + [key : string]: Object; + } + + /** + * Enumerates seek mode. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum SeekMode { + /** + * seek to the next sync frame of the given timestamp + * @since 8 + */ + SEEK_NEXT_SYNC = 0, + /** + * seek to the previous sync frame of the given timestamp + * @since 8 + */ + SEEK_PREV_SYNC = 1, + } + + /** + * Enumerates Codec MIME types. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media + * @import import media from '@ohos.multimedia.media' + * @devices phone, tablet, tv, wearable, car + */ + enum CodecMimeType { + /** + * H.263 codec MIME type. + * @since 8 + */ + VIDEO_H263 = 'video/h263', + /** + * H.264 codec MIME type. + * @since 8 + */ + VIDEO_AVC = 'video/avc', + /** + * MPEG2 codec MIME type. + * @since 8 + */ + VIDEO_MPEG2 = 'video/mpeg2', + /** + * MPEG4 codec MIME type + * @since 8 + */ + VIDEO_MPEG4 = 'video/mp4v-es', + + /** + * VP8 codec MIME type + * @since 8 + */ + VIDEO_VP8 = 'video/x-vnd.on2.vp8', + + /** + * AAC codec MIME type. + * @since 8 + */ + AUDIO_AAC = 'audio/mp4a-latm', + + /** + * vorbis codec MIME type. + * @since 8 + */ + AUDIO_VORBIS = 'audio/vorbis', + + /** + * flac codec MIME type. + * @since 8 + */ + AUDIO_FLAC = 'audio/flac', + } +} +export default media; -- Gitee From 7f7394fa3b1c6093ce14fff44fb8cc86dec701ce Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:39:33 +0800 Subject: [PATCH 10/28] fix spell Signed-off-by: sharpshooter_t Change-Id: I8db6b39bb526f6ddb98b22dee34b0060fd8b33e8 --- api/@ohos.multimedia.media.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 8167f0c51a..c4b3492c8a 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -189,10 +189,10 @@ declare namespace media { */ stop(): void; - /**` + /** * Resets audio playback. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 7 * @SysCap SystemCapability.Multimedia.Media */ reset(): void; -- Gitee From 76105c934237650df91ec00969cccd6e8989d775 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:45:53 +0800 Subject: [PATCH 11/28] fix spell Signed-off-by: sharpshooter_t Change-Id: I11b51e6077ee521762d0d8b744771365f4fb67d4 --- api/@ohos.multimedia.media.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index c4b3492c8a..36ef1dde04 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -359,7 +359,7 @@ declare namespace media { /** * Latitude. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ latitude: number; @@ -367,7 +367,7 @@ declare namespace media { /** * Longitude. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ longitude: number; @@ -430,7 +430,7 @@ declare namespace media { /** * Geographical location information. * @devices phone, tablet, tv, wearable - * @since 8 + * @since 6 * @SysCap SystemCapability.Multimedia.Media */ location?: Location; -- Gitee From 2c84839cf3e226bb793cadc16dd33843ac8338a9 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:47:51 +0800 Subject: [PATCH 12/28] fix spell Signed-off-by: sharpshooter_t Change-Id: If1f30ce1a9352ba728a89a958a87625382622b9c --- api/@ohos.multimedia.media.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 36ef1dde04..9ad74fec33 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -244,7 +244,7 @@ declare namespace media { /** * Listens for audio playback buffering events. * @devices phone, tablet, tv, wearable - * @since 6 + * @since 8 * @SysCap SystemCapability.Multimedia.Media * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. -- Gitee From ea14f1ace6b776fa6c2fd64424f864a5f13a9e4d Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Fri, 11 Feb 2022 18:55:05 +0800 Subject: [PATCH 13/28] fix comment Signed-off-by: sharpshooter_t Change-Id: Icd4e6c82426f32e83eaf3f30053de00dbce53491 --- api/@ohos.multimedia.media.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 9ad74fec33..07780b9568 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -1117,8 +1117,7 @@ declare namespace media { MD_KEY_HEIGHT = "height", /** - * key for video frame rate, value type is number,The value is 100 times the actual frame rate. - * example: The real frame rate is 23.99, so this value is 2399. + * key for video frame rate, value type is number. */ MD_KEY_FRAME_RATE = "frame_rate", -- Gitee From 6550831b8f94be62ef3e0c327b66b19ddad1c1c5 Mon Sep 17 00:00:00 2001 From: xuyong Date: Sat, 12 Feb 2022 11:51:40 +0800 Subject: [PATCH 14/28] HiTrace Js Api Signed-off-by: xuyong --- api/@ohos.hiTraceChain.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/api/@ohos.hiTraceChain.d.ts b/api/@ohos.hiTraceChain.d.ts index ccbce6ca6b..bdbd9ea02d 100644 --- a/api/@ohos.hiTraceChain.d.ts +++ b/api/@ohos.hiTraceChain.d.ts @@ -133,20 +133,20 @@ declare namespace hiTraceChain { } /** - * trace id, for tracing process. + * Trace id, for tracing process. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace */ interface HiTraceId { chainId: bigint; /* 0n: invalid */ - spandId?: number; + spanId?: number; parentSpanId?: number; flags?: number; } /** - * begin a new trace. + * Start tracing a process impl. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -177,7 +177,7 @@ declare namespace hiTraceChain { function getId(): HiTraceId; /** - * Set id as trace iod of current thread. Do nothing if id is invalid. + * Set id as trace id of current thread. Do nothing if id is invalid. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -194,7 +194,7 @@ declare namespace hiTraceChain { function clearId(): void; /** - * Create a new span Id according to the trace id of current thread. + * Create a new span id according to the trace id of current thread. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -215,7 +215,7 @@ declare namespace hiTraceChain { function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracePointType, id: HiTraceId, msg?: string): void; /** - * Judge whether the trace id is valid. + * Judge whether the trace id is valid or not. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace @@ -225,7 +225,7 @@ declare namespace hiTraceChain { function isValid(id: HiTraceId): boolean; /** - * Judge whether the trace id has enabled a flag or not. + * Judge whether the trace id has enabled a trace flag or not. * * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace -- Gitee From ed480714984b0aa3138ccc1c204fa8c093701057 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 09:50:25 +0800 Subject: [PATCH 15/28] remove the change of api6 interfaces Change-Id: I3c1ba34d3ef12970a889ffbb745a0f71bed27b17 Signed-off-by: sharpshooter_t --- api/@ohos.multimedia.media.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 07780b9568..031435b82b 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -389,7 +389,7 @@ declare namespace media { * @since 6 * @SysCap SystemCapability.Multimedia.Media */ - audioEncodeBitrate?: number; + audioEncodeBitRate?: number; /** * Audio sampling rate. -- Gitee From faf8be79b8a010b138ad0f3d24078fe4ad66f5bb Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 14:41:32 +0800 Subject: [PATCH 16/28] fix the syscaps annotation Signed-off-by: sharpshooter_t Change-Id: Ia64868b9d5d7d587c96cdb8f31f752316f3009bf --- api/@ohos.multimedia.media.d.ts | 384 +++++++++++--------------------- 1 file changed, 134 insertions(+), 250 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 031435b82b..528753e1b7 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -20,13 +20,12 @@ import { ErrorCallback, AsyncCallback, Callback } from './basic'; * @since 6 * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ declare namespace media { /** * Creates an AudioPlayer instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -35,7 +34,7 @@ declare namespace media { /** * Creates an AudioRecorder instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. */ @@ -44,7 +43,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -52,7 +51,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. */ @@ -61,7 +60,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -69,7 +68,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. */ @@ -78,9 +77,8 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaErrorCode { /** @@ -137,9 +135,8 @@ declare namespace media { /** * Enumerates buffering info type, for network playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum BufferingInfoType { /* begin to buffering*/ @@ -157,6 +154,9 @@ declare namespace media { /** * Describes audio playback states. + * @since 6 + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @import import media from '@ohos.multimedia.media' */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -167,75 +167,66 @@ declare namespace media { interface AudioPlayer { /** * Starts audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ play(): void; /** * Pauses audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ pause(): void; /** * Stops audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ stop(): void; /** * Resets audio playback. - * @devices phone, tablet, tv, wearable * @since 7 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ reset(): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param timeMs Playback position to jump */ seek(timeMs: number): void; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). */ setVolume(vol: number): void; /** * Releases resources used for audio playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ release(): void; /** * get all track infos in MediaDescription, should be called after data loaded callback. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; /** * get all track infos in MediaDescription, should be called after data loaded callback.. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -243,9 +234,8 @@ declare namespace media { /** * Listens for audio playback buffering events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. */ @@ -253,49 +243,43 @@ declare namespace media { /** * Audio media URI. Mainstream audio formats are supported. * local:fd://XXX, file://XXX. network:http://xxx - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ src: string; /** * Whether to loop audio playback. The value true means to loop playback. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ loop: boolean; /** * Current playback position. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly currentTime: number; /** * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly duration: number; /** * Playback state. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer */ readonly state: AudioState; /** * Listens for audio playback events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. */ @@ -303,9 +287,8 @@ declare namespace media { /** * Listens for audio playback events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. */ @@ -313,9 +296,8 @@ declare namespace media { /** * Listens for playback error events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. */ @@ -325,9 +307,8 @@ declare namespace media { /** * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ enum AudioEncoder { /** @@ -339,9 +320,8 @@ declare namespace media { /** * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable */ enum AudioOutputFormat { /** @@ -358,17 +338,15 @@ declare namespace media { interface Location { /** * Latitude. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ latitude: number; /** * Longitude. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ longitude: number; } @@ -377,42 +355,37 @@ declare namespace media { /** * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. * use "audioEncoderMime" instead. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoder?: AudioEncoder; /** * Audio encoding bit rate. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncodeBitRate?: number; /** * Audio sampling rate. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioSampleRate?: number; /** * Number of audio channels. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ numberOfChannels?: number; /** * Audio output format. The default value is DEFAULT, it will be deprecated after API8. * it will be use "fileFormat" to instead of. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ format?: AudioOutputFormat; @@ -421,32 +394,28 @@ declare namespace media { * format like: scheme + "://" + "context". * file: file://path * fd: fd://fd - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ uri: string; /** * Geographical location information. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ location?: Location; /** * audio encoding format MIME. it used to instead of audioEncoder. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoderMime?: CodecMimeType; /** * output file format. see @ContainerFormatType , it used to instead of "format". - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ fileFormat?: ContainerFormatType; } @@ -454,50 +423,44 @@ declare namespace media { interface AudioRecorder { /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. */ prepare(config: AudioRecorderConfig): void; /** * Starts audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ start(): void; /** * Pauses audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ pause(): void; /** * Resumes audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ resume(): void; /** * Stops audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ stop(): void; /** * Releases resources used for audio recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ release(): void; @@ -505,17 +468,15 @@ declare namespace media { * Resets audio recording. * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder */ reset(): void; /** * Listens for audio recording events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording event to listen for. * @param callback Callback used to listen for the audio recording event. */ @@ -523,9 +484,8 @@ declare namespace media { /** * Listens for audio recording error events. - * @devices phone, tablet, tv, wearable * @since 6 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording error event to listen for. * @param callback Callback used to listen for the audio recording error event. */ @@ -534,121 +494,109 @@ declare namespace media { /** * Describes video recorder states. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; interface VideoRecorder { /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. */ prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; /** * Prepares for recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @return A Promise instance used to return when prepare completed. */ prepare(config: VideoRecorderConfig): Promise; /** * get input surface.it must be called between prepare completed and start. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback Callback used to return the input surface id in string. */ getInputSurface(callback: AsyncCallback): void; /** * get input surface. it must be called between prepare completed and start. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return the input surface id in string. */ getInputSurface(): Promise; /** * Starts video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. */ start(callback: AsyncCallback): void; /** * Starts video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when start completed. */ start(): Promise; /** * Pauses video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Resumes video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. */ resume(callback: AsyncCallback): void; /** * Resumes video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when resume completed. */ resume(): Promise; /** * Stops video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Releases resources used for video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when release completed. */ release(): Promise; @@ -656,9 +604,8 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; @@ -666,17 +613,15 @@ declare namespace media { * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Listens for video recording error events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @param type Type of the video recording error event to listen for. * @param callback Callback used to listen for the video recording error event. */ @@ -684,24 +629,23 @@ declare namespace media { /** * video recorder state. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly state: VideoRecordState; } /** * Describes video playback states. + * @since 8 + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Enumerates playback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media - * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ enum PlaybackSpeed { /* playback at 0.75x normal speed */ @@ -720,115 +664,101 @@ declare namespace media { * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer * instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ interface VideoPlayer { /** * set display surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. */ setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; /** * set display surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. */ setDisplaySurface(surfaceId: string): Promise; /** * prepare video playback, it will request resource for playing. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when prepare completed. */ prepare(callback: AsyncCallback): void; /** * prepare video playback, it will request resource for playing. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when prepare completed. */ prepare(): Promise; /** * Starts video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when start completed. */ play(callback: AsyncCallback): void; /** * Starts video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when start completed. */ play(): Promise; /** * Pauses video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Stops video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Resets video playback, it will release the resource. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; /** * Resets video playback, it will release the resource. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), * the performance may be not the best. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param callback A callback instance used to return when seek completed * and return the seeking position result. @@ -836,9 +766,8 @@ declare namespace media { seek(timeMs: number, callback: AsyncCallback): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @param callback A callback instance used to return when seek completed @@ -847,9 +776,8 @@ declare namespace media { seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void; /** * Jumps to the specified playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @return A Promise instance used to return when seek completed @@ -858,52 +786,46 @@ declare namespace media { seek(timeMs: number, mode?:SeekMode): Promise; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @param callback A callback instance used to return when set volume completed. */ setVolume(vol: number, callback: AsyncCallback): void; /** * Sets the volume. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @return A Promise instance used to return when set volume completed. */ setVolume(vol: number): Promise; /** * Releases resources used for video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when release completed. */ release(): Promise; /** * get all track infos in MediaDescription, should be called after data loaded callback. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; /** * get all track infos in MediaDescription, should be called after data loaded callback.. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -912,74 +834,65 @@ declare namespace media { /** * media url. Mainstream video formats are supported. * local:fd://XXX, file://XXX. network:http://xxx - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ url: string; /** * Whether to loop video playback. The value true means to loop playback. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ loop: boolean; /** * Current playback position. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly currentTime: number; /** * Playback duration, if -1 means cannot seek. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly duration: number; /** * Playback state. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly state: VideoPlayState; /** * video width, valid after prepared. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly width: number; /** * video height, valid after prepared. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer */ readonly height: number; /** * set payback speed. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @param callback Callback used to return actually speed. */ setSpeed(speed:number, callback: AsyncCallback): void; /** * set output surface. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @return A Promise instance used to return actually speed. */ @@ -987,9 +900,8 @@ declare namespace media { /** * Listens for video playback completed events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . */ @@ -997,9 +909,8 @@ declare namespace media { /** * Listens for video playback buffering events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. */ @@ -1007,9 +918,8 @@ declare namespace media { /** * Listens for start render video frame events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . */ @@ -1017,9 +927,8 @@ declare namespace media { /** * Listens for video size changed event. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return video size. */ @@ -1027,9 +936,8 @@ declare namespace media { /** * Listens for playback error events. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. */ @@ -1039,9 +947,8 @@ declare namespace media { /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum ContainerFormatType { /** @@ -1058,9 +965,8 @@ declare namespace media { /** * Enumerates media data type. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaType { /** @@ -1076,9 +982,8 @@ declare namespace media { /** * Enumerates media description key. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum MediaDescriptionKey { /** @@ -1135,81 +1040,71 @@ declare namespace media { interface VideoRecorderProfile { /** * Indicates the audio bit rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioBitrate: number; /** * Indicates the number of audio channels. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioChannels: number; /** * Indicates the audio encoding format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioSampleRate: number; /** * Indicates the output file format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly fileFormat: ContainerFormatType; /** * Indicates the video bit rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoBitrate: number; /** * Indicates the video encoding format. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoCodec: CodecMimeType; /** * Indicates the video width. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameWidth: number; /** * Indicates the video height. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameHeight: number; /** * Indicates the video frame rate. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameRate: number; } @@ -1217,9 +1112,8 @@ declare namespace media { /** * Enumerates audio source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum AudioSourceType { /** @@ -1235,9 +1129,8 @@ declare namespace media { /** * Enumerates video source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum VideoSourceType { /** @@ -1253,23 +1146,20 @@ declare namespace media { interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ profile:VideoRecorderProfile; /** @@ -1277,24 +1167,21 @@ declare namespace media { * format like: scheme + "://" + "context". * file: file://path * fd: fd://fd - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ url: string; /** * Sets the video rotation angle in output file, and for the file to playback. mp4 support. * the range of rotation angle should be {0, 90, 180, 270}, default is 0. - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ rotation?: number; /** * geographical location information. - * @devices phone, tablet, tv, wearable * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.VideoRecorder */ location?: Location; } @@ -1302,9 +1189,8 @@ declare namespace media { interface MediaDescription { /** * key:value pair, key see @MediaDescriptionKey . - * @devices phone, tablet, tv, wearable, car * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core */ [key : string]: Object; } @@ -1312,9 +1198,8 @@ declare namespace media { /** * Enumerates seek mode. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum SeekMode { /** @@ -1332,9 +1217,8 @@ declare namespace media { /** * Enumerates Codec MIME types. * @since 8 - * @SysCap SystemCapability.Multimedia.Media + * @SysCap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' - * @devices phone, tablet, tv, wearable, car */ enum CodecMimeType { /** -- Gitee From d65a2825850e0d1e42a6d23a17f60aecd25e8531 Mon Sep 17 00:00:00 2001 From: sharpshooter_t Date: Mon, 14 Feb 2022 16:24:30 +0800 Subject: [PATCH 17/28] fix the syscaps annotation Signed-off-by: sharpshooter_t Change-Id: I936e5c82b9a61e7add300edc5e14faf5f6b3779a --- api/@ohos.multimedia.media.d.ts | 446 +++++++++++++++++++++----------- 1 file changed, 298 insertions(+), 148 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 528753e1b7..c33f70bef3 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -18,14 +18,13 @@ import { ErrorCallback, AsyncCallback, Callback } from './basic'; /** * @name media * @since 6 - * @SysCap SystemCapability.Multimedia.Media * @import import media from '@ohos.multimedia.media' */ declare namespace media { /** * Creates an AudioPlayer instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -34,7 +33,7 @@ declare namespace media { /** * Creates an AudioRecorder instance. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. */ @@ -43,7 +42,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -51,7 +50,7 @@ declare namespace media { /** * Creates an VideoPlayer instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. */ @@ -60,7 +59,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. */ @@ -68,7 +67,7 @@ declare namespace media { /** * Creates an VideoRecorder instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. */ @@ -77,57 +76,77 @@ declare namespace media { /** * Enumerates ErrorCode types, return in BusinessError::code * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaErrorCode { /** * operation success. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OK = 0, /** * malloc or new memory failed. maybe system have no memory. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_NO_MEMORY = 1, /** * no permission for the operation. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OPERATION_NOT_PERMIT = 2, /** * invalid argument. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_VAL = 3, /** * an IO error occurred. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_IO = 4, /** * operation time out. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_TIMEOUT = 5, /** * unknown error. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNKNOWN = 6, /** * media service died. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_SERVICE_DIED = 7, /** * operation is not permit in current state. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_STATE = 8, /** * operation is not supported in current version. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNSUPPORTED = 9, } @@ -135,68 +154,86 @@ declare namespace media { /** * Enumerates buffering info type, for network playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum BufferingInfoType { - /* begin to buffering*/ + /** + * begin to buffering + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_START = 1, - /* end to buffering*/ + /** + * end to buffering + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_END = 2, - /* buffering percent*/ + /** + * buffering percent + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ BUFFERING_PERCENT = 3, - /* cached duration in milliseconds*/ + /** + * cached duration in milliseconds + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ CACHED_DURATION = 4, } /** * Describes audio playback states. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @import import media from '@ohos.multimedia.media' */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() - * or createAudioPlayerAsync() to create an AudioPlayer instance. + * to create an AudioPlayer instance. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ interface AudioPlayer { /** * Starts audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ play(): void; /** * Pauses audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ pause(): void; /** * Stops audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ stop(): void; /** * Resets audio playback. * @since 7 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ reset(): void; /** * Jumps to the specified playback position. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param timeMs Playback position to jump */ seek(timeMs: number): void; @@ -204,7 +241,7 @@ declare namespace media { /** * Sets the volume. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). */ setVolume(vol: number): void; @@ -212,13 +249,13 @@ declare namespace media { /** * Releases resources used for audio playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ release(): void; /** * get all track infos in MediaDescription, should be called after data loaded callback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; @@ -226,7 +263,7 @@ declare namespace media { /** * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -235,7 +272,7 @@ declare namespace media { /** * Listens for audio playback buffering events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. */ @@ -244,42 +281,42 @@ declare namespace media { * Audio media URI. Mainstream audio formats are supported. * local:fd://XXX, file://XXX. network:http://xxx * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ src: string; /** * Whether to loop audio playback. The value true means to loop playback. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ loop: boolean; /** * Current playback position. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly currentTime: number; /** * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly duration: number; /** * Playback state. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer */ readonly state: AudioState; /** * Listens for audio playback events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. */ @@ -288,7 +325,7 @@ declare namespace media { /** * Listens for audio playback events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event. */ @@ -297,7 +334,7 @@ declare namespace media { /** * Listens for playback error events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. */ @@ -305,87 +342,107 @@ declare namespace media { } /** - * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to instead of. + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' + * @deprecated since 8 */ enum AudioEncoder { /** * Advanced Audio Coding Low Complexity (AAC-LC). + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ AAC_LC = 3, } /** - * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to instead of. + * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @import import media from '@ohos.multimedia.media' + * @deprecated since 8 */ enum AudioOutputFormat { /** * Indicates the Moving Picture Experts Group-4 (MPEG4) media format. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ MPEG_4 = 2, /** * Audio Data Transport Stream (ADTS), a transmission stream format of Advanced Audio Coding (AAC) audio. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ AAC_ADTS = 6 } + /** + * Provides the geographical location definitions for media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.Core + */ interface Location { /** * Latitude. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ latitude: number; /** * Longitude. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ longitude: number; } + /** + * Provides the audio recorder configuration definitions. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + */ interface AudioRecorderConfig { /** * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. * use "audioEncoderMime" instead. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 8 */ audioEncoder?: AudioEncoder; /** * Audio encoding bit rate. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncodeBitRate?: number; /** * Audio sampling rate. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioSampleRate?: number; /** * Number of audio channels. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ numberOfChannels?: number; /** * Audio output format. The default value is DEFAULT, it will be deprecated after API8. - * it will be use "fileFormat" to instead of. + * it will be replaced with "fileFormat". * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @deprecated since 8 */ format?: AudioOutputFormat; @@ -395,36 +452,42 @@ declare namespace media { * file: file://path * fd: fd://fd * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ uri: string; /** * Geographical location information. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ location?: Location; /** - * audio encoding format MIME. it used to instead of audioEncoder. + * audio encoding format MIME. it used to replace audioEncoder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ audioEncoderMime?: CodecMimeType; /** - * output file format. see @ContainerFormatType , it used to instead of "format". + * output file format. see @ContainerFormatType , it used to replace "format". * @since 8 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ fileFormat?: ContainerFormatType; } + /** + * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder() + * to create an AudioRecorder instance. + * @since 6 + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + */ interface AudioRecorder { /** * Prepares for recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param config Recording parameters. */ prepare(config: AudioRecorderConfig): void; @@ -432,35 +495,35 @@ declare namespace media { /** * Starts audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ start(): void; /** * Pauses audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ pause(): void; /** * Resumes audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ resume(): void; /** * Stops audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ stop(): void; /** * Releases resources used for audio recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ release(): void; @@ -469,14 +532,14 @@ declare namespace media { * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, * you must call prepare() to set the recording configurations for another recording. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder */ reset(): void; /** * Listens for audio recording events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording event to listen for. * @param callback Callback used to listen for the audio recording event. */ @@ -485,7 +548,7 @@ declare namespace media { /** * Listens for audio recording error events. * @since 6 - * @SysCap SystemCapability.Multimedia.Media.AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @param type Type of the audio recording error event to listen for. * @param callback Callback used to listen for the audio recording error event. */ @@ -495,15 +558,21 @@ declare namespace media { /** * Describes video recorder states. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + /** + * Manages and record video. Before calling an VideoRecorder method, you must use createVideoRecorder() + * to create an VideoRecorder instance. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorder { /** * Prepares for recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. */ @@ -511,7 +580,7 @@ declare namespace media { /** * Prepares for recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. * @return A Promise instance used to return when prepare completed. */ @@ -519,84 +588,84 @@ declare namespace media { /** * get input surface.it must be called between prepare completed and start. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback Callback used to return the input surface id in string. */ getInputSurface(callback: AsyncCallback): void; /** * get input surface. it must be called between prepare completed and start. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return the input surface id in string. */ getInputSurface(): Promise; /** * Starts video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. */ start(callback: AsyncCallback): void; /** * Starts video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when start completed. */ start(): Promise; /** * Pauses video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Resumes video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. */ resume(callback: AsyncCallback): void; /** * Resumes video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when resume completed. */ resume(): Promise; /** * Stops video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Releases resources used for video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when release completed. */ release(): Promise; @@ -605,7 +674,7 @@ declare namespace media { * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; @@ -614,14 +683,14 @@ declare namespace media { * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, * you must call prepare() to set the recording configurations for another recording. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @return A Promise instance used to return when reset completed. */ reset(): Promise; /** * Listens for video recording error events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param type Type of the video recording error event to listen for. * @param callback Callback used to listen for the video recording error event. */ @@ -630,7 +699,7 @@ declare namespace media { /** * video recorder state. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly state: VideoRecordState; } @@ -638,25 +707,45 @@ declare namespace media { /** * Describes video playback states. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; /** * Enumerates playback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ enum PlaybackSpeed { - /* playback at 0.75x normal speed */ + /** + * playback at 0.75x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_0_75_X = 0, - /* playback at normal speed */ + /** + * playback at normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_00_X = 1, - /* playback at 1.25x normal speed */ + /** + * playback at 1.25x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_25_X = 2, - /* playback at 1.75x normal speed */ + /** + * playback at 1.75x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_1_75_X = 3, - /* playback at 2.0x normal speed */ + /** + * playback at 2.0x normal speed + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + */ SPEED_FORWARD_2_00_X = 4, } @@ -664,14 +753,14 @@ declare namespace media { * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer * instance. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @import import media from '@ohos.multimedia.media' */ interface VideoPlayer { /** * set display surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. */ @@ -679,7 +768,7 @@ declare namespace media { /** * set display surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. * @return A Promise instance used to return when release output buffer completed. */ @@ -687,70 +776,70 @@ declare namespace media { /** * prepare video playback, it will request resource for playing. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when prepare completed. */ prepare(callback: AsyncCallback): void; /** * prepare video playback, it will request resource for playing. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when prepare completed. */ prepare(): Promise; /** * Starts video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when start completed. */ play(callback: AsyncCallback): void; /** * Starts video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when start completed. */ play(): Promise; /** * Pauses video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when pause completed. */ pause(callback: AsyncCallback): void; /** * Pauses video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when pause completed. */ pause(): Promise; /** * Stops video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when stop completed. */ stop(callback: AsyncCallback): void; /** * Stops video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when stop completed. */ stop(): Promise; /** * Resets video playback, it will release the resource. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when reset completed. */ reset(callback: AsyncCallback): void; /** * Resets video playback, it will release the resource. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when reset completed. */ reset(): Promise; @@ -758,7 +847,7 @@ declare namespace media { * Jumps to the specified playback position by default SeekMode(SEEK_CLOSEST), * the performance may be not the best. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param callback A callback instance used to return when seek completed * and return the seeking position result. @@ -767,7 +856,7 @@ declare namespace media { /** * Jumps to the specified playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @param callback A callback instance used to return when seek completed @@ -777,7 +866,7 @@ declare namespace media { /** * Jumps to the specified playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . * @return A Promise instance used to return when seek completed @@ -787,7 +876,7 @@ declare namespace media { /** * Sets the volume. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @param callback A callback instance used to return when set volume completed. */ @@ -795,7 +884,7 @@ declare namespace media { /** * Sets the volume. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). * @return A Promise instance used to return when set volume completed. */ @@ -803,21 +892,21 @@ declare namespace media { /** * Releases resources used for video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback A callback instance used to return when release completed. */ release(callback: AsyncCallback): void; /** * Releases resources used for video playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @return A Promise instance used to return when release completed. */ release(): Promise; /** * get all track infos in MediaDescription, should be called after data loaded callback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param callback async callback return track info in MediaDescription. */ getTrackDescription(callback: AsyncCallback>): void; @@ -825,7 +914,7 @@ declare namespace media { /** * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param index track index. * @return A Promise instance used to return the track info in MediaDescription. */ @@ -835,56 +924,56 @@ declare namespace media { * media url. Mainstream video formats are supported. * local:fd://XXX, file://XXX. network:http://xxx * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ url: string; /** * Whether to loop video playback. The value true means to loop playback. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ loop: boolean; /** * Current playback position. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly currentTime: number; /** * Playback duration, if -1 means cannot seek. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly duration: number; /** * Playback state. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly state: VideoPlayState; /** * video width, valid after prepared. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly width: number; /** * video height, valid after prepared. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer */ readonly height: number; /** * set payback speed. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @param callback Callback used to return actually speed. */ @@ -892,7 +981,7 @@ declare namespace media { /** * set output surface. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . * @return A Promise instance used to return actually speed. */ @@ -901,7 +990,7 @@ declare namespace media { /** * Listens for video playback completed events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . */ @@ -910,7 +999,7 @@ declare namespace media { /** * Listens for video playback buffering events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback buffering update event to listen for. * @param callback Callback used to listen for the buffering update event, return BufferingInfoType and the value. */ @@ -919,7 +1008,7 @@ declare namespace media { /** * Listens for start render video frame events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return . */ @@ -928,7 +1017,7 @@ declare namespace media { /** * Listens for video size changed event. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback event to listen for. * @param callback Callback used to listen for the playback event return video size. */ @@ -937,7 +1026,7 @@ declare namespace media { /** * Listens for playback error events. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param type Type of the playback error event to listen for. * @param callback Callback used to listen for the playback error event. */ @@ -947,17 +1036,21 @@ declare namespace media { /** * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum ContainerFormatType { /** * A video container format type mp4. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ CFT_MPEG_4 = "mp4", /** * A audio container format type m4a. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ CFT_MPEG_4A = "m4a", } @@ -965,16 +1058,20 @@ declare namespace media { /** * Enumerates media data type. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaType { /** * track is audio. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MEDIA_TYPE_AUD = 0, /** * track is video. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MEDIA_TYPE_VID = 1, } @@ -982,129 +1079,154 @@ declare namespace media { /** * Enumerates media description key. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum MediaDescriptionKey { /** * key for track index, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_TRACK_INDEX = "track_index", /** - * key for track type, value type is number, see @MediaType . + * key for track type, value type is number, see @MediaType. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_TRACK_TYPE = "track_type", /** * key for codec mime type, value type is string. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_CODEC_MIME = "codec_mime", /** * key for duration, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_DURATION = "duration", /** * key for bitrate, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_BITRATE = "bitrate", /** * key for video width, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_WIDTH = "width", /** * key for video height, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_HEIGHT = "height", /** * key for video frame rate, value type is number. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_FRAME_RATE = "frame_rate", /** * key for audio channel count, value type is number + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_AUD_CHANNEL_COUNT = "channel_count", /** * key for audio sample rate, value type is number + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ MD_KEY_AUD_SAMPLE_RATE = "sample_rate", } + /** + * Provides the video recorder profile definitions. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorderProfile { /** * Indicates the audio bit rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioBitrate: number; /** * Indicates the number of audio channels. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioChannels: number; /** * Indicates the audio encoding format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioCodec: CodecMimeType; /** * Indicates the audio sampling rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly audioSampleRate: number; /** * Indicates the output file format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly fileFormat: ContainerFormatType; /** * Indicates the video bit rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoBitrate: number; /** * Indicates the video encoding format. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoCodec: CodecMimeType; /** * Indicates the video width. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameWidth: number; /** * Indicates the video height. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameHeight: number; /** * Indicates the video frame rate. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ readonly videoFrameRate: number; } @@ -1112,16 +1234,20 @@ declare namespace media { /** * Enumerates audio source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' */ enum AudioSourceType { /** * default audio source type. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, } @@ -1129,37 +1255,46 @@ declare namespace media { /** * Enumerates video source type for recorder. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @import import media from '@ohos.multimedia.media' */ enum VideoSourceType { /** * surface raw data. - */ + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } + /** + * Provides the video recorder configuration definitions. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + */ interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ audioSourceType: AudioSourceType; /** * video source type, details see @VideoSourceType . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ profile:VideoRecorderProfile; /** @@ -1168,29 +1303,34 @@ declare namespace media { * file: file://path * fd: fd://fd * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ url: string; /** * Sets the video rotation angle in output file, and for the file to playback. mp4 support. * the range of rotation angle should be {0, 90, 180, 270}, default is 0. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ rotation?: number; /** * geographical location information. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.VideoRecorder + * @syscap SystemCapability.Multimedia.Media.VideoRecorder */ location?: Location; } + /** + * Provides the container definition for media description key-value pairs. + * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core + */ interface MediaDescription { /** * key:value pair, key see @MediaDescriptionKey . * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core */ [key : string]: Object; } @@ -1198,18 +1338,20 @@ declare namespace media { /** * Enumerates seek mode. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum SeekMode { /** * seek to the next sync frame of the given timestamp * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ SEEK_NEXT_SYNC = 0, /** * seek to the previous sync frame of the given timestamp * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ SEEK_PREV_SYNC = 1, } @@ -1217,52 +1359,60 @@ declare namespace media { /** * Enumerates Codec MIME types. * @since 8 - * @SysCap SystemCapability.Multimedia.Media.Core + * @syscap SystemCapability.Multimedia.Media.Core * @import import media from '@ohos.multimedia.media' */ enum CodecMimeType { /** * H.263 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_H263 = 'video/h263', /** * H.264 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_AVC = 'video/avc', /** * MPEG2 codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_MPEG2 = 'video/mpeg2', /** * MPEG4 codec MIME type * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_MPEG4 = 'video/mp4v-es', /** * VP8 codec MIME type * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ VIDEO_VP8 = 'video/x-vnd.on2.vp8', /** * AAC codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_AAC = 'audio/mp4a-latm', /** * vorbis codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_VORBIS = 'audio/vorbis', /** * flac codec MIME type. * @since 8 + * @syscap SystemCapability.Multimedia.Media.Core */ AUDIO_FLAC = 'audio/flac', } -- Gitee From e00dab4bbcbd1f3e8e59541cd9da4d5b946a0fdd Mon Sep 17 00:00:00 2001 From: xuyong Date: Tue, 15 Feb 2022 14:48:09 +0800 Subject: [PATCH 18/28] =?UTF-8?q?HiTrace=20NAPI=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- api/@ohos.hiTraceChain.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.hiTraceChain.d.ts b/api/@ohos.hiTraceChain.d.ts index bdbd9ea02d..8b7ba82fdd 100644 --- a/api/@ohos.hiTraceChain.d.ts +++ b/api/@ohos.hiTraceChain.d.ts @@ -58,7 +58,7 @@ declare namespace hiTraceChain { /** * do not add id to log. default: add id to log. */ - DONOT_ENABLE_LOG = 1 << 4, + DISABLE_LOG = 1 << 4, /** * the trace is triggered by fault. -- Gitee From 0d930f38d58951cb56067e0f7757a306af0afce0 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 15 Feb 2022 15:49:09 +0800 Subject: [PATCH 19/28] update d.ts file Signed-off-by: wanchengzhen --- api/@ohos.application.Ability.d.ts | 24 ++++++++++++++++++++ api/@ohos.application.AbilityStage.d.ts | 12 ++++++++++ api/@ohos.application.StartOptions.d.ts | 10 ++++++++ api/@ohos.application.abilityManager.d.ts | 3 +-- api/application/AbilityContext.d.ts | 10 ++++++++ api/application/ServiceExtensionContext.d.ts | 9 ++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 822a6d7038..27f734df0b 100644 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -17,6 +17,7 @@ import AbilityConstant from "./@ohos.application.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; +import { Configuration } from './@ohos.application.Configuration'; /** * The class of an ability. @@ -123,4 +124,27 @@ export default class Ability { * @StageModelOnly */ onContinue(wantParam : {[key: string]: any}): boolean; + + /** + * Called when the launch mode of an ability is set to singleton. + * This happens when you re-launch an ability that has been at the top of the ability stack. + * + * @devices phone, tablet, tv, wearable, car + * @since 9 + * @sysCap AAFwk + * @return - + * @StageModelOnly + */ + onNewWant(want: Want): void; + + /** + * Called when the system configuration is updated. + * + * @devices phone, tablet, tv, wearable, car + * @since 9 + * @sysCap AAFwk + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; } diff --git a/api/@ohos.application.AbilityStage.d.ts b/api/@ohos.application.AbilityStage.d.ts index 60fbfac572..9f6a4a8b56 100644 --- a/api/@ohos.application.AbilityStage.d.ts +++ b/api/@ohos.application.AbilityStage.d.ts @@ -14,6 +14,7 @@ */ import AbilityStageContext from "./application/AbilityStageContext"; +import Want from './@ohos.application.Want'; /** * The class of an ability stage. @@ -42,4 +43,15 @@ export default class AbilityStage { * @StageModelOnly */ onCreate(): void; + + /** + * Called back when start specified ability. + * + * @devices phone, tablet, tv, wearable, car + * @since 9 + * @sysCap AAFwk + * @return - + * @StageModelOnly + */ + onAcceptWant(want: Want): string; } \ No newline at end of file diff --git a/api/@ohos.application.StartOptions.d.ts b/api/@ohos.application.StartOptions.d.ts index 17b7bcc7da..5c0b9e7d04 100644 --- a/api/@ohos.application.StartOptions.d.ts +++ b/api/@ohos.application.StartOptions.d.ts @@ -31,4 +31,14 @@ export default class StartOptions { * @StageModelOnly */ windowMode?: number; + + /** + * displayId + * @default - + * @devices phone, tablet + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + displayId?: number; } \ No newline at end of file diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index 36bfa7f40c..ff2426a5e7 100644 --- a/api/@ohos.application.abilityManager.d.ts +++ b/api/@ohos.application.abilityManager.d.ts @@ -58,7 +58,6 @@ declare namespace abilityManager { * * @since 8 * @SysCap SystemCapability.Ability.AbilityRuntime.Core - * @param config Indicates the new configuration. * @systemapi Hide this for inner system use. * @return - */ @@ -70,7 +69,7 @@ declare namespace abilityManager { * * @since 9 * @SysCap SystemCapability.Ability.AbilityRuntime.Core - * @param config Indicates the new configuration. + * @param upperLimit Get the maximum limit of the number of messages * @systemapi Hide this for inner system use. * @return - */ diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 68cf988156..55e5cf9a52 100644 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -22,6 +22,7 @@ import Context from "./Context"; import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; +import { Configuration } from '../@ohos.application.Configuration'; /** * The context of an ability. It allows access to ability-specific resources. @@ -50,6 +51,15 @@ export default class AbilityContext extends Context { */ currentHapModuleInfo: HapModuleInfo; + /** + * Indicates configuration information. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + config: Configuration; + /** * Starts a new ability. * diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index 41017e1042..ce5e61f065 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -18,6 +18,7 @@ import { ConnectOptions } from "../ability/connectOptions"; import ExtensionContext from "./ExtensionContext"; import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; +import { ExtensionAbilityInfo } from "../bundle/extensionAbilityInfo"; /** * The context of service extension. It allows access to @@ -30,6 +31,14 @@ import StartOptions from "../@ohos.application.StartOptions"; * @StageModelOnly */ export default class ServiceExtensionContext extends ExtensionContext { + /** + * Service extension information. + * + * @since 9 + * @sysCap AAFwk + */ + extensionAbilityInfo: ExtensionAbilityInfo; + /** * Service extension uses this method to start a specific ability. * -- Gitee From a4149dd7e48b630b746e59e4ea611c61aa703e48 Mon Sep 17 00:00:00 2001 From: gudehe Date: Thu, 10 Feb 2022 19:08:10 +0800 Subject: [PATCH 20/28] Add MediaLibrary d.ts file Signed-off-by: gudehe --- api/@ohos.multimedia.mediaLibrary.d.ts | 1147 ++++++++++++++++++++++++ 1 file changed, 1147 insertions(+) create mode 100644 api/@ohos.multimedia.mediaLibrary.d.ts diff --git a/api/@ohos.multimedia.mediaLibrary.d.ts b/api/@ohos.multimedia.mediaLibrary.d.ts new file mode 100644 index 0000000000..72b7e28cf1 --- /dev/null +++ b/api/@ohos.multimedia.mediaLibrary.d.ts @@ -0,0 +1,1147 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './basic'; +import Context from './@ohos.ability'; +import image from './@ohos.multimedia.image'; + +/** + * @name mediaLibrary + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import media from '@ohos.multimedia.mediaLibrary' + */ +declare namespace mediaLibrary { + /** + * Obtains a MediaLibrary instance. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' + * @FAModelOnly + * @return Returns a MediaLibrary instance if the operation is successful; returns null otherwise. + */ + function getMediaLibrary(): MediaLibrary; + /** + * Returns an instance of MediaLibrary + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @StageModelOnly + * @param Hap context information + * @return Instance of MediaLibrary + */ + function getMediaLibrary(context: Context): MediaLibrary; + + /** + * Enumeration types for different kind of Media Files + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + enum MediaType { + /** + * File media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + FILE = 0, + /** + * Image media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + IMAGE, + /** + * Video media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + VIDEO, + /** + * Audio media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + AUDIO + } + + /** + * Describes media resource options. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' + */ + interface MediaAssetOption { + /** + * URI of the media source. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + src: string; + /** + * Multipurpose Internet Mail Extensions (MIME) type of the media. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + mimeType: string; + /** + * Relative path for storing media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + relativePath?: string; + } + + /** + * Describes media selection options. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' + */ + interface MediaSelectOption { + /** + * Media type, which can be image, video, or media (indicating both image and video). + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + type: 'image' | 'video' | 'media'; + /** + * Maximum number of media items that can be selected + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + count: number; + } + + /** + * Provides methods to encapsulate file attributes. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' + */ + interface FileAsset { + /** + * File ID. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly id: number; + /** + * URI of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly uri: string; + /** + * MIME type, for example, video/mp4, audio/mp4, or audio/amr-wb. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly mimeType: string; + /** + * Media type, for example, IMAGE, VIDEO, FILE, AUDIO + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly mediaType: MediaType; + /** + * Display name (with a file name extension) of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + displayName: string; + /** + * File name title (without the file name extension). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + title: string; + /** + * Relative Path of the file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + relativePath: string; + /** + * Parent folder's file_id of the file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly parent: number; + /** + * Data size of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly size: number; + /** + * Date (timestamp) when the file was added. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly dateAdded: number; + /** + * Date (timestamp) when the file was modified. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly dateModified: number; + /** + * Date (timestamp) when the file was taken. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly dateTaken: number; + /** + * Artist of the audio file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly artist: string; + /** + * audioAlbum of the audio file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly audioAlbum: string; + /** + * Display width of the file. This is valid only for videos and images. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly width: number; + /** + * Display height of the file. This is valid only for videos and images. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly height: number; + /** + * Rotation angle of the file, in degrees. + * The rotation angle can be 0, 90, 180, or 270 degrees. This is valid only for videos. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + orientation: number; + /** + * duration of the audio and video file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly duration: number; + /** + * ID of the album where the file is located. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly albumId: number; + /** + * URI of the album where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly albumUri: string; + /** + * Name of the album where the file is located. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly albumName: string; + + /** + * If it is a directory where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback, Callback return the result of isDerectory. + */ + isDirectory(callback: AsyncCallback): void; + /** + * If it is a directory where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + isDirectory():Promise; + /** + * Modify meta data where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback, no value will be returned. + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify meta data where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + commitModify(): Promise; + /** + * Open the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param mode, mode for open, for example: rw, r, w. + * @param callback, Callback return the fd of the file. + */ + open(mode: string, callback: AsyncCallback): void; + /** + * Open the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param mode, mode for open, for example: rw, r, w. + */ + open(mode: string): Promise; + /** + * Close the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param fd, fd of the file which had been opened + * @param callback, no value will be returned. + */ + close(fd: number, callback: AsyncCallback): void; + /** + * Close the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param fd, fd of the file which had been opened + */ + close(fd: number): Promise; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the thumbnail's pixelmap. + */ + getThumbnail(callback: AsyncCallback): void; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param size, thumbnail's size + * @param callback Callback used to return the thumbnail's pixelmap. + */ + getThumbnail(size: Size, callback: AsyncCallback): void; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param size, thumbnail's size + */ + getThumbnail(size?: Size): Promise; + /** + * Set favorite for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param isFavorite ture is favorite file, false is not favorite file + * @param callback Callback used to return, No value is returned. + */ + favorite(isFavorite: boolean, callback: AsyncCallback): void; + /** + * Set favorite for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param isFavorite ture is favorite file, false is not favorite file + */ + favorite(isFavorite: boolean): Promise; + /** + * If the file is favorite when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return true or false. + */ + isFavorite(callback: AsyncCallback): void; + /** + * If the file is favorite when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + isFavorite():Promise; + /** + * Set trash for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param isTrash true is trashed file, false is not trashed file + * @param callback Callback used to return, No value is returned. + */ + trash(isTrash: boolean, callback: AsyncCallback): void; + /** + * Set trash for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param isTrash true is trashed file, false is not trashed file + */ + trash(isTrash: boolean,): Promise; + /** + * If the file is in trash when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return true or false. + */ + isTrash(callback: AsyncCallback): void; + /** + * If the file is in trash when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + isTrash():Promise; + } + + /** + * Describes MediaFetchOptions's selection + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + enum FileKey { + /** + * File ID + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + ID = "file_id", + /** + * Relative Path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + RELATIVE_PATH = "relative_path", + /** + * File name + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DISPLAY_NAME = "display_name", + /** + * Parent folder file id + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + PARENT = "parent", + /** + * Mime type of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + MIME_TYPE = "mime_type", + /** + * Media type of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + MEDIA_TYPE = "media_type", + /** + * Size of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + SIZE = "size", + /** + * Date of the file creation + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DATE_ADDED = "date_added", + /** + * Modify date of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DATE_MODIFIED = "date_modified", + /** + * Date taken of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DATE_TAKEN = "date_taken", + /** + * Title of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + TITLE = "title", + /** + * Artist of the audio file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + ARTIST = "artist", + /** + * Audio album of the audio file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + AUDIOALBUM = "audio_album", + /** + * Duration of the audio and video file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DURATION = "duration", + /** + * Width of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + WIDTH = "width", + /** + * Height of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + HEIGHT = "height", + /** + * Orientation of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + ORIENTATION = "orientation", + /** + * Album id of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + ALBUM_ID = "bucket_id", + /** + * Album name of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + ALBUM_NAME = "bucket_display_name", + } + + /** + * Fetch parameters applicable on images, videos, audios, albums and other media + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + interface MediaFetchOptions { + /** + * Fields to retrieve, for example, selections: "media_type =? OR media_type =?". + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + selections: string; + /** + * Conditions for retrieval, for example, selectionArgs: [IMAGE, VIDEO]. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + selectionArgs: Array; + /** + * Sorting criterion of the retrieval results, for example, order: "datetaken DESC,_display_name DESC, _id DESC". + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + order?: string; + /** + * uri for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + uri?: string; + /** + * networkId for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + networkId?: string; + /** + * extendArgs for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + extendArgs?: string; + } + + /** + * Implements file retrieval. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' + */ + interface FetchFileResult { + /** + * Obtains the total number of files in the file retrieval result. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return Total number of files. + */ + getCount(): number; + /** + * Checks whether the result set points to the last row. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return Whether the file is the last one. + * You need to check whether the file is the last one before calling getNextObject, + * which returns the next file only when True is returned for this method. + */ + isAfterLast(): boolean; + /** + * Releases the FetchFileResult instance and invalidates it. Other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + close(): void; + /** + * Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + */ + getFirstObject(callback: AsyncCallback): void; + /** + * Obtains the first FileAsset in the file retrieval result. This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return A Promise instance used to return the file in the format of a FileAsset instance. + */ + getFirstObject(): Promise; + /** + * Obtains the next FileAsset in the file retrieval result. + * This method uses a callback to return the file. + * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. + * This method returns the next file only when True is returned for isAfterLast(). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + */ + getNextObject(callback: AsyncCallback): void; + /** + * Obtains the next FileAsset in the file retrieval result. + * This method uses a promise to return the file. + * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. + * This method returns the next file only when True is returned for isAfterLast(). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return A Promise instance used to return the file in the format of a FileAsset instance. + */ + getNextObject(): Promise; + /** + * Obtains the last FileAsset in the file retrieval result. This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + */ + getLastObject(callback: AsyncCallback): void; + /** + * Obtains the last FileAsset in the file retrieval result. This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return A Promise instance used to return the file in the format of a FileAsset instance. + */ + getLastObject(): Promise; + /** + * Obtains the FileAsset with the specified index in the file retrieval result. + * This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param index Index of the file to obtain. + * @param callback Callback used to return the file in the format of a FileAsset instance. + */ + getPositionObject(index: number, callback: AsyncCallback): void; + /** + * Obtains the FileAsset with the specified index in the file retrieval result. + * This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param index Index of the file to obtain. + * @return A Promise instance used to return the file in the format of a FileAsset instance. + */ + getPositionObject(index: number): Promise; + /** + * Obtains all FileAssets in the file retrieval result. + * This method uses a callback to return the result. After this method is called, + * close() is automatically called to release the FetchFileResult instance and invalidate it. + * In this case, other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return a FileAsset array. + */ + getAllObject(callback: AsyncCallback>): void; + /** + * Obtains all FileAssets in the file retrieval result. + * This method uses a promise to return the result. that store the selected media resources. + * close() is automatically called to release the FetchFileResult instance and invalidate it. + * In this case, other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @return A Promise instance used to return a FileAsset array. + */ + getAllObject(): Promise>; + } + + /** + * Defines the album. + * + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 7 + */ + interface Album { + /** + * Album ID. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly albumId: number; + /** + * Album name. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + albumName: string; + /** + * Album uri. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly albumUri: string; + /** + * Date (timestamp) when the album was last modified. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly dateModified: number; + /** + * File count for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly count: number; + /** + * Relative path for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly relativePath: string; + /** + * coverUri for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + readonly coverUri: string; + + /** + * Modify the meta data for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback, no value will be returned. + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify the meta data for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + commitModify(): Promise; + /** + * SObtains files in an album. This method uses an asynchronous callback to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the files in the format of a FetchFileResult instance. + */ + getFileAssets(callback: AsyncCallback): void; + /** + * SObtains files in an album. This method uses an asynchronous callback to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media retrieval options. + * @param callback Callback used to return the files in the format of a FetchFileResult instance. + */ + getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; + /** + * Obtains files in an album. This method uses a promise to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media retrieval options. + * @return A Promise instance used to return the files in the format of a FetchFileResult instance. + */ + getFileAssets(options?: MediaFetchOptions): Promise; + } + + /** + * Enumeration public directory that predefined + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + enum DirectoryType { + /** + * predefined public directory for files token by Camera. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_CAMERA = 0, + /** + * predefined public directory for VIDEO files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_VIDEO, + /** + * predefined public directory for IMAGE files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_IMAGE, + /** + * predefined public directory for AUDIO files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_AUDIO, + /** + * predefined public directory for DOCUMENTS files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_DOCUMENTS, + /** + * predefined public directory for DOWNLOAD files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + DIR_DOWNLOAD + } + + /** + * Defines the MediaLibrary class and provides functions to access the data in media storage. + * + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 6 + */ + interface MediaLibrary { + /** + * get system predefined root dir, use to create file asset by relative path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type, public directory predefined in DirectoryType. + * @param callback, Callback return the FetchFileResult. + */ + getPublicDirectory(type: DirectoryType, callback: AsyncCallback): void; + /** + * get system predefined root dir, use to create file asset by relative path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type, public directory predefined in DirectoryType. + * @param return A promise instance used to return the public directory in the format of string + */ + getPublicDirectory(type: DirectoryType): Promise; + /** + * query all assets just for count & first cover + * if need all data, getAllObject from FetchFileResult + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param options, Media retrieval options. + * @param callback, Callback return the FetchFileResult. + */ + getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; + /** + * query all assets just for count & first cover + * if need all data, getAllObject from FetchFileResult + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param options, Media retrieval options. + * @return A promise instance used to return the files in the format of a FetchFileResult instance + */ + getFileAssets(options: MediaFetchOptions): Promise; + /** + * Trun on mornitor the data changes by media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type, mediaType + * @param callback no value returned + */ + on(type: 'Device'|'Album'|'Image'|'Audio'|'Video'|'File'| 'Remote file', callback: () => {}): void; + /** + * Trun off Mornitor the data changes by media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type, mediaType + * @param callback no value returned + */ + off(type: 'Device'|'Album'|'Image'|'Audio'|'Video'|'File'| 'Remote file', callback?: () => {}): void; + /** + * Create File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param mediaType, mediaType for example:IMAGE, VIDEO, AUDIO, FILE + * @param displayName, file name + * @param relativePath, relative path + * @param callback Callback used to return the FileAsset + */ + createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback): void; + /** + * Create File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param mediaType, mediaType for example:IMAGE, VIDEO, AUDIO, FILE + * @param displayName, file name + * @param relativePath, relative path + * @return A Promise instance used to return the FileAsset + */ + createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise; + /** + * Delete File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param uri, FileAsset's URI + * @param callback no value returned + */ + deleteAsset(uri: string, callback: AsyncCallback): void; + /** + * Delete File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param uri, FileAsset's URI + * @return A Promise instance, no value returned + */ + deleteAsset(uri: string): Promise; + /** + * Obtains albums based on the media retrieval options. This method uses an asynchronous callback to return. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media retrieval options. + * @param callback Callback used to return an album array. + */ + getAlbums(options: MediaFetchOptions, callback: AsyncCallback>): void; + /** + * Obtains albums based on the media retrieval options. This method uses a promise to return the albums. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media retrieval options. + * @return A Promise instance used to return an album array. + */ + getAlbums(options: MediaFetchOptions): Promise>; + /** + * Stores media resources. This method uses an asynchronous callback to return the URI that stores + * the media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media resource option. + * @param callback Callback used to return the URI that stores the media resources. + */ + storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback): void; + /** + * Stores media resources. This method uses a promise to return the URI that stores the media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media resource option. + * @return Promise used to return the URI that stores the media resources. + */ + storeMediaAsset(option: MediaAssetOption): Promise; + /** + * Starts image preview, with the first image to preview specified. This method uses an asynchronous callback + * to receive the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param index Sequence number of the first image to preview. + * @param callback Callback used for image preview. No value is returned. + */ + startImagePreview(images: Array, index: number, callback: AsyncCallback): void; + /** + * Starts image preview. This method uses an asynchronous callback to receive the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param callback Callback used for image preview. No value is returned. + */ + startImagePreview(images: Array, callback: AsyncCallback): void; + /** + * Starts image preview, with the first image to preview specified. + * This method uses a promise to return the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param index Sequence number of the first image to preview. + * @return Promise used to return whether the operation is successful. + */ + startImagePreview(images: Array, index?: number): Promise; + /** + * Starts media selection. This method uses an asynchronous callback to + * return the list of URIs that store the selected media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media selection option. + * @param callback Callback used to return the list of URIs that store the selected media resources. + */ + startMediaSelect(option: MediaSelectOption, callback: AsyncCallback>): void; + /** + * Starts media selection. This method uses a promise to return the list of URIs + * that store the selected media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media selection option. + * @return Promise used to return the list of URIs that store the selected media resources. + */ + startMediaSelect(option: MediaSelectOption): Promise>; + /** + * Get Active Peer device information + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @param callback, Callback return the list of the active peer devices' information + */ + getActivePeers(callback: AsyncCallback>): void; + /** + * Get Active Peer device information + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @return Promise used to return the list of the active peer devices' information + */ + getActivePeers(): Promise>; + /** + * Get all the peer devices' information + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @param callback, Callback return the list of the all the peer devices' information + */ + getAllPeers(callback: AsyncCallback>): void; + /** + * Get all the peer devices' information + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @return Promise used to return the list of the all the peer devices' information + */ + getAllPeers(): Promise>; + /** + * Release MediaLibrary instance + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback, no value returned + */ + release(callback: AsyncCallback): void; + /** + * Release MediaLibrary instance + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + release(): Promise; + } + + /** + * thumbnail's size which have width and heigh + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 8 + */ + interface Size { + /** + * Width of image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + width: number; + /** + * Height of image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + */ + height: number; + } + + /** + * peer devices' information + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @since 8 + */ + interface PeerInfo { + /** + * Peer device name + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + readonly deviceName: string; + /** + * Peer device network id + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + readonly networkId: string; + /** + * Peer device type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + readonly deviceType: DeviceType; + /** + * Peer device online status + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + readonly isOnline: boolean; + } + + /** + * peer device type + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + * @since 8 + */ + enum DeviceType { + /** + * Unknow device type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_UNKNOWN = 0, + /** + * Laptop device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_LAPTOP, + /** + * Phone device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_PHONE, + /** + * Tablet device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_TABLET, + /** + * Watch device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_WATCH, + /** + * Car device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_CAR, + /** + * TV device + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore + * @systemapi + */ + TYPE_TV + } +} + +export default mediaLibrary; -- Gitee From 5342d62ca578bbe9ca6436c3a03521257c6d3670 Mon Sep 17 00:00:00 2001 From: hujun211 Date: Tue, 15 Feb 2022 00:24:00 -0800 Subject: [PATCH 21/28] fix JS api note Signed-off-by: hujun211 --- api/@ohos.batteryinfo.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.batteryinfo.d.ts b/api/@ohos.batteryinfo.d.ts index 19689de4aa..2fd0e32c79 100644 --- a/api/@ohos.batteryinfo.d.ts +++ b/api/@ohos.batteryinfo.d.ts @@ -30,7 +30,7 @@ declare namespace batteryInfo { const batterySOC: number; /** - * Battery charging status of the current device. + * Battery charging status of the current device, in percent. * @since 6 */ const chargingStatus: BatteryChargeState; @@ -48,7 +48,7 @@ declare namespace batteryInfo { const pluggedType: BatteryPluggedType; /** - * Battery voltage of the current device. + * Battery voltage of the current device, in µV. * @since 6 */ const voltage: number; @@ -60,7 +60,7 @@ declare namespace batteryInfo { const technology: string; /** - * Battery temperature of the current device. + * Battery temperature of the current device, in 0.1℃. * @since 6 */ const batteryTemperature: number; -- Gitee From 27a5cfe9a5b53dc709cbd0456c764b8fbae27d7f Mon Sep 17 00:00:00 2001 From: liweifeng Date: Mon, 14 Feb 2022 09:26:05 +0800 Subject: [PATCH 22/28] moveMissionToFront add startOptions param Change-Id: Ic249b011ae6d5386c66f45b0fae84060a3d1c535 Signed-off-by: liweifeng --- api/@ohos.application.missionManager.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/@ohos.application.missionManager.d.ts b/api/@ohos.application.missionManager.d.ts index 0c4d323a2f..781cd44696 100644 --- a/api/@ohos.application.missionManager.d.ts +++ b/api/@ohos.application.missionManager.d.ts @@ -17,6 +17,7 @@ import { AsyncCallback } from './basic'; import { MissionInfo } from './application/MissionInfo'; import { MissionListener } from './application/MissionListener'; import { MissionSnapshot } from './application/MissionSnapshot'; +import StartOptions from "./@ohos.application.StartOptions"; /** * This module provides the capability to manage abilities and obtaining system task information. @@ -136,7 +137,8 @@ declare namespace missionManager { * @return - */ function moveMissionToFront(missionId: number, callback: AsyncCallback): void; - function moveMissionToFront(missionId: number): Promise; + function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback): void; + function moveMissionToFront(missionId: number, options?: StartOptions): Promise; } export default missionManager; \ No newline at end of file -- Gitee From 4c6ed64b40d4d1f8aa362952f7053d7a475c40a6 Mon Sep 17 00:00:00 2001 From: xuyong Date: Tue, 15 Feb 2022 16:39:43 +0800 Subject: [PATCH 23/28] =?UTF-8?q?HiTrace=20JS=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- api/@ohos.hiTraceChain.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.hiTraceChain.d.ts b/api/@ohos.hiTraceChain.d.ts index 8b7ba82fdd..cd0b78fc53 100644 --- a/api/@ohos.hiTraceChain.d.ts +++ b/api/@ohos.hiTraceChain.d.ts @@ -77,7 +77,7 @@ declare namespace hiTraceChain { * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace */ - enum HiTraceTracePointType { + enum HiTraceTracepointType { /** * client send */ @@ -208,11 +208,11 @@ declare namespace hiTraceChain { * @since 8 * @SysCap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceCommunicationMode} mode Trace communication mode. - * @param {HiTraceTracePointType} type Trace info type. + * @param {HiTraceTracepointType} type Trace info type. * @param {HiTraceId} id Trace id that need to print. * @param {string} msg Customized info that need to print. */ - function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracePointType, id: HiTraceId, msg?: string): void; + function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTraceId, msg?: string): void; /** * Judge whether the trace id is valid or not. -- Gitee From 43c230446209117f51ce4dfd56a60a5a18acd462 Mon Sep 17 00:00:00 2001 From: lixingchi1 Date: Tue, 15 Feb 2022 16:42:27 +0800 Subject: [PATCH 24/28] lixingchi1@huawei.com Signed-off-by: lixingchi1 --- api/@internal/component/ets/web.d.ts | 142 +++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 3f7992093c..09b598a375 100755 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -100,6 +100,23 @@ declare enum HitTestType { Unknown } +declare enum CacheMode { + /** + * load online and not cache. + */ + None, + + /** + * Load cache first, then online. + */ + Online, + + /** + * load cache and not online. + */ + Only +} + declare class JsResult { /** * Constructor. @@ -232,6 +249,26 @@ declare class WebResourceError { getErrorCode(): number; } +declare class WebCookie { + /** + * Constructor. + * @since 8 + */ + constructor(); + + /** + * Sets the cookie. + * @since 8 + */ + setCookie(); + + /** + * Saves the cookies. + * @since 8 + */ + saveCookie(); +} + declare class WebController { /** * Constructor. @@ -251,6 +288,12 @@ declare class WebController { */ onActive(): void; + /** + * Clear the history in the Web. + * @since 8 + */ + clearHistory(): void; + /** * Means to load a piece of code and execute JS code in the context of the currently displayed page * @since 8 @@ -409,6 +452,62 @@ declare class WebAttribute extends CommonMethod { */ javaScriptProxy(javaScriptProxy: { obj: object, name: string, methodList: Array }): WebAttribute; + /* + * Sets whether the Web should save the password. + * @param password {@code ture} means the Web can save the password; {@code false} otherwise. + * + * @since 8 + */ + password(password: boolean): WebAttribute; + + /** + * Sets the mode of cache in the Web. + * @param cacheMode The cache mode, which can be {@link CacheMode}. + * + * @since 8 + */ + cacheMode(cacheMode: CacheMode): WebAttribute; + + /** + * Sets whether the Web should save the table data. + * @param tableData {@code ture} means the Web can save the table data; {@code false} otherwise. + * + * @since 8 + */ + tableData(tableData: boolean): WebAttribute; + + /** + * Sets whether the Web access meta 'viewport' in HTML. + * @param wideViewModeAccess {@code ture} means the Web access meta 'viewport' in HTML; {@code false} otherwise. + * + * @since 8 + */ + wideViewModeAccess(wideViewModeAccess: boolean): WebAttribute; + + /** + * Sets whether the Web access overview mode. + * @param overviewModeAccess {@code ture} means the Web access overview mode; {@code false} otherwise. + * + * @since 8 + */ + overviewModeAccess(overviewModeAccess: boolean): WebAttribute; + + /** + * Sets the atio of the text zoom. + * @param textZoomAtio The atio of the text zoom. + * + * @since 8 + */ + textZoomAtio(textZoomAtio: number): WebAttribute; + + /** + * Sets whether the Web access the database. + * @param databaseAccess {@code ture} means the Web access the database; {@code false} otherwise. + * + * @since 8 + */ + databaseAccess(databaseAccess: boolean): WebAttribute; + /** * Triggered at the end of web page loading * @since 8 @@ -509,6 +608,49 @@ declare class WebAttribute extends CommonMethod { */ onDownloadStart(callback: (event?: {url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number}) => void): WebAttribute; + /** + * Triggered when the Web page refreshes accessed history. + * @param callback The triggered callback when the Web page refreshes accessed history. + * + * @since 8 + */ + onRefreshAccessedHistory(callback: (event?: { url: string, refreshed: boolean }) => void): WebAttribute; + + /** + * Triggered when the url is about to be loaded. + * @param callback The triggered callback when the url is about to be loaded. + * @return Returns {@code ture} to let the load stop; return {@code false} to let the load continue. + * + * @since 8 + */ + onUrlLoadIntercept(callback: (event?: { data: string | WebResourceRequest }) => boolean): WebAttribute; + + /** + * Triggered when the Web page receives the ssl Error. + * @param callback The triggered callback when the Web page receives the ssl Error. + * + * @since 8 + */ + onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute; + + /** + * Triggered when the render process is exited. + * @param callback The triggered when the render process is exited. + * @return Returns {@code ture} to handle the situation; return {@code false} to kill the render process. + * + * @since 8 + */ + onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute; + + /** + * Triggered when the file selector shows. + * @param callback The triggered when the file selector shows. + * @return Returns {@code ture} to handle the situation; return {@code false} to use default handling. + * + * @since 8 + */ + onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute; + /** * Just use for genetate tsbundle * @ignore ide should ignore this arrtibute -- Gitee From f3845cbc6c347d7769cd54a4ed0963d7fdcf9a77 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 15 Feb 2022 17:12:22 +0800 Subject: [PATCH 25/28] update d.ts file Signed-off-by: wanchengzhen --- api/@ohos.application.Ability.d.ts | 90 +++++++++++++++++++++++++++++ api/application/AbilityContext.d.ts | 13 +++++ 2 files changed, 103 insertions(+) mode change 100644 => 100755 api/@ohos.application.Ability.d.ts mode change 100644 => 100755 api/application/AbilityContext.d.ts diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts old mode 100644 new mode 100755 index 27f734df0b..7ba9ec61de --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -18,6 +18,87 @@ import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; import { Configuration } from './@ohos.application.Configuration'; +import rpc from '/@ohos.rpc'; + +/** + * The interface of an Caller. + * + * @since 9 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @StageModelOnly + */ + interface Caller { + /** + * Notify the server of Sequenceable type data. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + call(method, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + release(): void; + + /** + * Register death listener notification callback. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + onRelease(callback: function): void; + } + + /** + * The interface of an Callee. + * + * @since 9 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @StageModelOnly + */ + interface Callee { + + /** + * Register data listener callback. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + on(method: string, callback: function): void; + + /** + * Unregister data listener callback. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + off(method: string): void; + } /** * The class of an ability. @@ -55,6 +136,15 @@ export default class Ability { */ lastRequestWant: Want; + /** + * Call Service Sutb Object + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + callee: Callee; + /** * Called back when an ability is started for initialization. * diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts old mode 100644 new mode 100755 index 55e5cf9a52..442c46a5d0 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -23,6 +23,7 @@ import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; import { Configuration } from '../@ohos.application.Configuration'; +import Caller from '../@ohos.application.Ability'; /** * The context of an ability. It allows access to ability-specific resources. @@ -73,6 +74,18 @@ export default class AbilityContext extends Context { startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; startAbility(want: Want, options?: StartOptions): Promise; + /** + * Get the caller object of the startup capability + * + * @devices phone, tablet, tv, wearable, car + * @since 9 + * @sysCap AAFwk + * @param parameter Indicates the ability to start. + * @return Caller + * @StageModelOnly + */ + startAbilityByCall(want: Want): Promise; + /** * Starts a new ability with account. * -- Gitee From 5a9e3effea95683eee29540b148792c3d72228d1 Mon Sep 17 00:00:00 2001 From: wanchengzhen Date: Tue, 15 Feb 2022 17:30:04 +0800 Subject: [PATCH 26/28] update d.ts file Signed-off-by: wanchengzhen --- api/@ohos.application.Ability.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 7ba9ec61de..b07a0a0022 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -21,7 +21,7 @@ import { Configuration } from './@ohos.application.Configuration'; import rpc from '/@ohos.rpc'; /** - * The interface of an Caller. + * The interface of a Caller. * * @since 9 * @sysCap AAFwk @@ -71,7 +71,7 @@ import rpc from '/@ohos.rpc'; } /** - * The interface of an Callee. + * The interface of a Callee. * * @since 9 * @sysCap AAFwk @@ -137,7 +137,7 @@ export default class Ability { lastRequestWant: Want; /** - * Call Service Sutb Object + * Call Service Stub Object. * * @since 9 * @sysCap AAFwk -- Gitee From c1c99d3d1b483c74addc8652f699e58cfc4ae7d9 Mon Sep 17 00:00:00 2001 From: hujun211 Date: Tue, 15 Feb 2022 18:18:13 -0800 Subject: [PATCH 27/28] fix JS api note error Signed-off-by: hujun211 --- api/@ohos.batteryinfo.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.batteryinfo.d.ts b/api/@ohos.batteryinfo.d.ts index 2fd0e32c79..0130092db3 100644 --- a/api/@ohos.batteryinfo.d.ts +++ b/api/@ohos.batteryinfo.d.ts @@ -24,13 +24,13 @@ */ declare namespace batteryInfo { /** - * Battery state of charge (SoC) of the current device. + * Battery state of charge (SoC) of the current device, in percent. * @since 6 */ const batterySOC: number; /** - * Battery charging status of the current device, in percent. + * Battery charging status of the current device. * @since 6 */ const chargingStatus: BatteryChargeState; -- Gitee From 8a9786db1a0f1ff44ef09d1129b1a6eead094638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=9F=AC?= Date: Wed, 16 Feb 2022 03:31:46 +0000 Subject: [PATCH 28/28] Signed-off-by: lutao --- api/@ohos.hichecker.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/api/@ohos.hichecker.d.ts b/api/@ohos.hichecker.d.ts index 214c73d42d..4aa9b254c0 100644 --- a/api/@ohos.hichecker.d.ts +++ b/api/@ohos.hichecker.d.ts @@ -18,7 +18,7 @@ * *@import import hichecker from '@ohos.hichecker'; * @since 8 -* @Syscap SystemCapability.HiviewDFX.HiChecker +* @syscap SystemCapability.HiviewDFX.HiChecker */ declare namespace hichecker { @@ -26,35 +26,35 @@ declare namespace hichecker { /** * The caution rule print log. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ const RULE_CAUTION_PRINT_LOG: 9223372036854775808n; // 1 << 63 /** * The caution rule trigger crash. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ const RULE_CAUTION_TRIGGER_CRASH: 4611686018427387904n; // 1 << 62 /** * The thread rule check slow process. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ const RULE_THREAD_CHECK_SLOW_PROCESS: 1n; /** * The process rule check slow event. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ const RULE_CHECK_SLOW_EVENT: 4294967296n; // 1 << 32 /** * The process rule check ability connection leak. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ const RULE_CHECK_ABILITY_CONNECTION_LEAK: 8589934592n; // 1 << 33 @@ -62,7 +62,7 @@ declare namespace hichecker { * add one or more rule. * @param rule * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ function addRule(rule: bigint) : void; @@ -70,7 +70,7 @@ declare namespace hichecker { * remove one or more rule. * @param rule * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ function removeRule(rule: bigint) : void; @@ -78,7 +78,7 @@ declare namespace hichecker { * get added rule * @return all added thread rule and process rule. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ function getRule() : bigint; @@ -87,7 +87,7 @@ declare namespace hichecker { * @param rule * @return the result of whether the query rule is added. * @since 8 - * @Syscap SystemCapability.HiviewDFX.HiChecker + * @syscap SystemCapability.HiviewDFX.HiChecker */ function contains(rule: bigint) : boolean; } -- Gitee