From e52bd196f9b377e33f73667117de16e08e033589 Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 21 Mar 2023 17:39:35 +0800 Subject: [PATCH] Update docs against 15463+16215 Signed-off-by: wusongqing --- en/application-dev/media/avplayer-playback.md | 14 +- .../reference/apis/js-apis-camera.md | 541 ++++++++++++++++++ .../reference/apis/js-apis-media.md | 63 +- 3 files changed, 586 insertions(+), 32 deletions(-) diff --git a/en/application-dev/media/avplayer-playback.md b/en/application-dev/media/avplayer-playback.md index 324dd43e6f..9a7d9ffa10 100644 --- a/en/application-dev/media/avplayer-playback.md +++ b/en/application-dev/media/avplayer-playback.md @@ -292,13 +292,13 @@ export class AVPlayerDemo { async avPlayerDemo() { // Create an AVPlayer instance. this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath + let fileDescriptor = undefined + // Use getRawFileDescriptor of the resource management module to obtain the media assets in the application, and use the fdSrc attribute of the AVPlayer to initialize the media assets. + // For details on the fd/offset/length parameter, see the Media API. The globalThis.abilityContext parameter is a system environment variable and is saved as a global variable on the main page during the system boost. + await globalThis.abilityContext.resourceManager.getRawFileDescriptor('H264_AAC.mp4').then((value) => { + fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length} + }) + this.avPlayer.fdSrc = fileDescriptor } } ``` diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index ec4684a53f..4238ee5df2 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -31,6 +31,15 @@ Obtains a **CameraManager** instance. This API returns the result synchronously. | ----------------------------------------------- | ---------------------------- | | [CameraManager](#cameramanager) | **CameraManager** instance obtained. | +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -255,6 +264,14 @@ Creates a **CameraInput** instance with the specified **CameraDevice** object. T | ---------- | ----------------------------- | | [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -291,6 +308,14 @@ Creates a **CameraInput** instance with the specified camera position and type. | ---------- | ----------------------------- | | [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -327,6 +352,14 @@ Creates a **PreviewOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [PreviewOutput](#previewoutput) | **PreviewOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -361,6 +394,14 @@ Creates a **PhotoOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [PhotoOutput](#photooutput) | **PhotoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -395,6 +436,14 @@ Creates a **VideoOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [VideoOutput](#videooutput) | **VideoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -428,6 +477,14 @@ Creates a **MetadataOutput** instance. This API returns the result synchronously | ---------- | ----------------------------- | | [MetadataOutput](#metadataoutput) | **MetadataOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -455,6 +512,14 @@ Creates a **CaptureSession** instance. This API returns the result synchronously | ---------- | ----------------------------- | | [CaptureSession](#capturesession) | **CaptureSession** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -630,6 +695,16 @@ Opens this camera. This API uses an asynchronous callback to return the result. | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -656,6 +731,16 @@ Opens this camera. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -680,6 +765,14 @@ Closes this camera. This API uses an asynchronous callback to return the result. | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -706,6 +799,14 @@ Closes this camera. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -823,6 +924,14 @@ Starts configuration for the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400105 | Session config locked. | + **Example** ```js @@ -848,6 +957,15 @@ Commits the configuration for this **CaptureSession** instance. This API uses an | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -874,6 +992,15 @@ Commits the configuration for this **CaptureSession** instance. This API uses a | -------------- | ------------------------ | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -905,6 +1032,15 @@ Adds a [CameraInput](#camerainput) instance to the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -936,6 +1072,15 @@ Removes a [CameraInput](#camerainput) instance from the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -967,6 +1112,15 @@ Adds a [CameraOutput](#cameraoutput) instance to the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -998,6 +1152,15 @@ Removes a [CameraOutput](#cameraoutput) instance from the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -1023,6 +1186,15 @@ Starts this **CaptureSession**. This API uses an asynchronous callback to return | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1049,6 +1221,15 @@ Starts this **CaptureSession**. This API uses a promise to return the result. | -------------- | ------------------------ | | Promise| Promise used to return the result.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1073,6 +1254,14 @@ Stops this **CaptureSession**. This API uses an asynchronous callback to return | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1099,6 +1288,14 @@ Stops this **CaptureSession**. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1123,6 +1320,14 @@ Releases this **CaptureSession**. This API uses an asynchronous callback to retu | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1149,6 +1354,14 @@ Releases this **CaptureSession**. This API uses a promise to return the result. | -------------- | ------------------------ | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -1173,6 +1386,14 @@ Checks whether the device has flash. This API uses an asynchronous callback to r | ---------- | ----------------------------- | | boolean | Returns **true** if the device has flash; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1204,6 +1425,14 @@ Checks whether a flash mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the flash mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1240,6 +1469,14 @@ Before the setting, do the following checks: | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1265,6 +1502,14 @@ Obtains the flash mode in use. | ---------- | ----------------------------- | | [FlashMode](#flashmode) | Flash mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1296,6 +1541,14 @@ Checks whether an exposure mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the exposure mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1321,6 +1574,14 @@ Obtains the exposure mode in use. | ---------- | ----------------------------- | | [ExposureMode](#exposuremode) | Exposure mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1352,6 +1613,14 @@ Sets an exposure mode for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1377,6 +1646,14 @@ Obtains the metering point of the device. | ---------- | ----------------------------- | | [Point](#point) | Metering point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1410,6 +1687,14 @@ The coordinate system is based on the horizontal device direction with the devic | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1436,6 +1721,14 @@ Obtains the exposure compensation values of the device. | ---------- | ----------------------------- | | Array | An array of compensation values. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1463,6 +1756,14 @@ Before the setting, you are advised to use **[getExposureBiasRange](#getexposure | -------- | -------------------------------| ---- | ------------------- | | exposureBias | number | Yes | Exposure bias to set, which must be within the range obtained by running **getExposureBiasRange** interface. If the API call fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1489,6 +1790,14 @@ Obtains the exposure value in use. | ---------- | ----------------------------- | | number | Exposure value obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1520,6 +1829,14 @@ Checks whether a focus mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the focus mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1553,6 +1870,14 @@ Before the setting, use **[isFocusModeSupported](#isfocusmodesupported)** to che | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1578,6 +1903,14 @@ Obtains the focus mode in use. | ---------- | ----------------------------- | | [FocusMode](#focusmode) | Focus mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1611,6 +1944,14 @@ The coordinate system is based on the horizontal device direction with the devic | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1637,6 +1978,14 @@ Obtains the focal point of the device. | ---------- | ----------------------------- | | [Point](#point) | Focal point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1662,6 +2011,14 @@ Obtains the focal length of the device. | ---------- | ----------------------------- | | number | Focal length obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1687,6 +2044,14 @@ Obtains the supported zoom ratio range. | ---------- | ----------------------------- | | Array | Callback used to return an array containing the minimum and maximum zoom ratios. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1718,6 +2083,14 @@ Sets a zoom ratio, with a maximum precision of two decimal places. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1744,6 +2117,14 @@ Obtains the zoom ratio in use. | ---------- | ----------------------------- | | number | Zoom ratio obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1775,6 +2156,14 @@ Checks whether the specified video stabilization mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the video stabilization mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1800,6 +2189,14 @@ Obtains the video stabilization mode in use. | ---------- | ----------------------------- | | VideoStabilizationMode | Video stabilization mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1831,6 +2228,14 @@ Sets a video stabilization mode for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1910,6 +2315,14 @@ Starts to output preview streams. This API uses an asynchronous callback to retu | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1936,6 +2349,14 @@ Starts to output preview streams. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -2010,6 +2431,14 @@ Releases output resources. This API uses an asynchronous callback to return the | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2036,6 +2465,14 @@ Releases output resources. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2184,6 +2621,15 @@ Captures a photo with the default shooting parameters. This API uses an asynchro | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2210,6 +2656,15 @@ Captures a photo with the default shooting parameters. This API uses a promise t | -------------- | ------------------------ | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2235,6 +2690,16 @@ Captures a photo with the specified shooting parameters. This API uses an asynch | setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Shooting settings. | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned. | +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2278,6 +2743,15 @@ Captures a photo with the specified shooting parameters. This API uses a promise | -------------- | ------------------------ | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **Example** @@ -2323,6 +2797,14 @@ Releases output resources. This API uses an asynchronous callback to return the | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2349,6 +2831,14 @@ Releases output resources. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2493,6 +2983,15 @@ Starts video recording. This API uses an asynchronous callback to return the res | -------- | -------------------- | ---- | -------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2519,6 +3018,14 @@ Starts video recording. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -2594,6 +3101,14 @@ Releases output resources. This API uses an asynchronous callback to return the | -------- | -------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2620,6 +3135,14 @@ Releases output resources. This API uses a promise to return the result. | -------------- | ----------------------- | | Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2717,6 +3240,15 @@ Starts to output metadata. This API uses an asynchronous callback to return the | -------- | -------------------------- | ---- | ------------------- | | callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -2743,6 +3275,15 @@ Starts to output metadata. This API uses a promise to return the result. | ---------------------- | ------------------------ | | Promise | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | + **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 70e5b8141e..a0d85f43ee 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -932,6 +932,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} + avPlayer.getTrackDescription((error, arrList) => { if ((arrList) != null) { for (let i = 0; i < arrList.length; i++) { @@ -969,6 +977,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let arrayDescription; + +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} avPlayer.getTrackDescription().then((arrList) => { if (arrList != null) { arrayDescription = arrList; @@ -1558,6 +1574,8 @@ Subscribes to the audio interruption event. When multiple audio and video assets **Example** ```js +import audio from '@ohos.multimedia.audio'; + avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { console.info('audioInterrupt success,and InterruptEvent info is:' + info) }) @@ -1759,7 +1777,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig, (err) => { +avRecorder.prepare(AVRecorderConfig, (err) => { if (err == null) { console.info('prepare success'); } else { @@ -1830,7 +1848,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig).then(() => { +avRecorder.prepare(AVRecorderConfig).then(() => { console.info('prepare success'); }).catch((err) => { console.info('prepare failed and catch error is ' + err.message); @@ -1871,7 +1889,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. -AVRecorder.getInputSurface((err, surfaceId) => { +avRecorder.getInputSurface((err, surfaceId) => { if (err == null) { console.info('getInputSurface success'); surfaceID = surfaceId; @@ -1880,8 +1898,6 @@ AVRecorder.getInputSurface((err, surfaceId) => { } }); -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); - ``` ### getInputSurface9+ @@ -1917,14 +1933,12 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. -AVRecorder.getInputSurface().then((surfaceId) => { +avRecorder.getInputSurface().then((surfaceId) => { console.info('getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { console.info('getInputSurface failed and catch error is ' + err.message); }); - -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); ``` ### start9+ @@ -1956,7 +1970,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.start((err) => { +avRecorder.start((err) => { if (err == null) { console.info('start AVRecorder success'); } else { @@ -1994,7 +2008,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.start().then(() => { +avRecorder.start().then(() => { console.info('start AVRecorder success'); }).catch((err) => { console.info('start AVRecorder failed and catch error is ' + err.message); @@ -2030,7 +2044,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.pause((err) => { +avRecorder.pause((err) => { if (err == null) { console.info('pause AVRecorder success'); } else { @@ -2068,7 +2082,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.pause().then(() => { +avRecorder.pause().then(() => { console.info('pause AVRecorder success'); }).catch((err) => { console.info('pause AVRecorder failed and catch error is ' + err.message); @@ -2104,7 +2118,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.resume((err) => { +avRecorder.resume((err) => { if (err == null) { console.info('resume AVRecorder success'); } else { @@ -2142,7 +2156,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.resume().then(() => { +avRecorder.resume().then(() => { console.info('resume AVRecorder success'); }).catch((err) => { console.info('resume AVRecorder failed and catch error is ' + err.message); @@ -2180,7 +2194,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.stop((err) => { +avRecorder.stop((err) => { if (err == null) { console.info('stop AVRecorder success'); } else { @@ -2220,7 +2234,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.stop().then(() => { +avRecorder.stop().then(() => { console.info('stop AVRecorder success'); }).catch((err) => { console.info('stop AVRecorder failed and catch error is ' + err.message); @@ -2255,7 +2269,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.reset((err) => { +avRecorder.reset((err) => { if (err == null) { console.info('reset AVRecorder success'); } else { @@ -2292,7 +2306,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.reset().then(() => { +avRecorder.reset().then(() => { console.info('reset AVRecorder success'); }).catch((err) => { console.info('reset AVRecorder failed and catch error is ' + err.message); @@ -2326,7 +2340,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.release((err) => { +avRecorder.release((err) => { if (err == null) { console.info('release AVRecorder success'); } else { @@ -2362,7 +2376,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.release().then(() => { +avRecorder.release().then(() => { console.info('release AVRecorder success'); }).catch((err) => { console.info('release AVRecorder failed and catch error is ' + err.message); @@ -2387,9 +2401,8 @@ Subscribes to AVRecorder state changes. An application can subscribe to only one **Example** ```js -AVRecorder.on('stateChange', async (state, reason) => { +avRecorder.on('stateChange', async (state, reason) => { console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); - } }); ``` @@ -2410,7 +2423,7 @@ Unsubscribes from AVRecorder state changes. **Example** ```js -AVRecorder.off('stateChange'); +avRecorder.off('stateChange'); ``` ### on('error')9+ @@ -2442,7 +2455,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.on('error', (err) => { +avRecorder.on('error', (err) => { console.info('case avRecorder.on(error) called, errMessage is ' + err.message); }); ``` @@ -2473,7 +2486,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.off('error'); +avRecorder.off('error'); ``` ## AVRecorderState9+ -- GitLab