提交 c60c9ba7 编写于 作者: G Gloria

Update docs against 15764+15843+15813

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 5cc343cf
...@@ -948,8 +948,18 @@ Creates an **ImageSource** instance based on the URI. ...@@ -948,8 +948,18 @@ Creates an **ImageSource** instance based on the URI.
**Example** **Example**
```js ```js
let context = featureAbility.getContext(); // Stage model
let path = context.getCacheDir() + "test.jpg"; const context = getContext(this);
const path = context.getCacheDir() + "/test.jpg";
const imageSourceApi = image.createImageSource(path);
```
```js
// FA model
import featureAbility from '@ohos.ability.featureAbility';
const context = featureAbility.getContext();
const path = context.getCacheDir() + "/test.jpg";
const imageSourceApi = image.createImageSource(path); const imageSourceApi = image.createImageSource(path);
``` ```
......
...@@ -358,7 +358,7 @@ For details about the AVPlayer demo, see [AVPlayer Development](../../media/avpl ...@@ -358,7 +358,7 @@ For details about the AVPlayer demo, see [AVPlayer Development](../../media/avpl
**System capability**: SystemCapability.Multimedia.Media.AVPlayer **System capability**: SystemCapability.Multimedia.Media.AVPlayer
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| --------------------------------------------------- | ------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | --------------------------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| url<sup>9+</sup> | string | Yes | Yes | URL of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state. <br>The video formats MP4, MPEG-TS, WebM, and MKV are supported.<br>The audio formats M4A, AAC, MP3, OGG, and WAV are supported.<br>**Examples of supported URLs**:<br>1. FD: fd://xx<br>![](figures/en-us_image_url.png)<br>2. HTTP: http://xx<br>3. HTTPS: https://xx<br>4. HLS: http://xx or https://xx| | url<sup>9+</sup> | string | Yes | Yes | URL of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state. <br>The video formats MP4, MPEG-TS, WebM, and MKV are supported.<br>The audio formats M4A, AAC, MP3, OGG, and WAV are supported.<br>**Examples of supported URLs**:<br>1. FD: fd://xx<br>![](figures/en-us_image_url.png)<br>2. HTTP: http://xx<br>3. HTTPS: https://xx<br>4. HLS: http://xx or https://xx|
| fdSrc<sup>9+</sup> | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | FD of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.<br>This attribute is required when media assets of an application are continuously stored in a file.<br>**Example:**<br>Assume that a media file that stores continuous assets consists of the following:<br>Video 1 (address offset: 0, byte length: 100)<br>Video 2 (address offset: 101; byte length: 50)<br>Video 3 (address offset: 151, byte length: 150)<br>1. To play video 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; }<br>2. To play video 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; }<br>3. To play video 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; }<br>To play an independent media file, use **src=fd://xx**.| | fdSrc<sup>9+</sup> | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | FD of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.<br>This attribute is required when media assets of an application are continuously stored in a file.<br>**Example:**<br>Assume that a media file that stores continuous assets consists of the following:<br>Video 1 (address offset: 0, byte length: 100)<br>Video 2 (address offset: 101; byte length: 50)<br>Video 3 (address offset: 151, byte length: 150)<br>1. To play video 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; }<br>2. To play video 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; }<br>3. To play video 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; }<br>To play an independent media file, use **src=fd://xx**.|
| surfaceId<sup>9+</sup> | string | Yes | Yes | Video window ID. By default, there is no video window. It is a static attribute and can be set only when the AVPlayer is in the initialized state.<br>It is used to render the window for video playback and therefore is not required in audio-only playback scenarios.<br>**Example:**<br>[Create a surface ID through XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).| | surfaceId<sup>9+</sup> | string | Yes | Yes | Video window ID. By default, there is no video window. It is a static attribute and can be set only when the AVPlayer is in the initialized state.<br>It is used to render the window for video playback and therefore is not required in audio-only playback scenarios.<br>**Example:**<br>[Create a surface ID through XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).|
...@@ -371,6 +371,10 @@ For details about the AVPlayer demo, see [AVPlayer Development](../../media/avpl ...@@ -371,6 +371,10 @@ For details about the AVPlayer demo, see [AVPlayer Development](../../media/avpl
| width<sup>9+</sup> | number | Yes | No | Video width, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.<br>The value **0** indicates an invalid value.| | width<sup>9+</sup> | number | Yes | No | Video width, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.<br>The value **0** indicates an invalid value.|
| height<sup>9+</sup> | number | Yes | No | Video height, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.<br>The value **0** indicates an invalid value.| | height<sup>9+</sup> | number | Yes | No | Video height, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.<br>The value **0** indicates an invalid value.|
**NOTE**
After the resource handle (FD) is transferred to the AVPlayer, do not use the resource handle to perform read and write operations, including but not limited to transferring it to multiple AVPlayers. Competition occurs when multiple AVPlayers use the same resource handle to read and write files at the same time, resulting in playback errors.
### on('stateChange')<sup>9+</sup><a name = stateChange_on></a> ### on('stateChange')<sup>9+</sup><a name = stateChange_on></a>
on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void
...@@ -926,6 +930,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -926,6 +930,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```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) => { avPlayer.getTrackDescription((error, arrList) => {
if ((arrList) != null) { if ((arrList) != null) {
for (let i = 0; i < arrList.length; i++) { for (let i = 0; i < arrList.length; i++) {
...@@ -963,6 +975,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -963,6 +975,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
```js ```js
let arrayDescription; 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) => { avPlayer.getTrackDescription().then((arrList) => {
if (arrList != null) { if (arrList != null) {
arrayDescription = arrList; arrayDescription = arrList;
...@@ -1059,7 +1079,7 @@ Sets the playback speed. This API can be called only when the AVPlayer is in the ...@@ -1059,7 +1079,7 @@ Sets the playback speed. This API can be called only when the AVPlayer is in the
**Example** **Example**
```js ```js
avPlayer.setSpeed(media.AVPlayerSpeed.SPEED_FORWARD_2_00_X) avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X)
``` ```
### on('speedDone')<sup>9+</sup><a name = speedDone_on></a> ### on('speedDone')<sup>9+</sup><a name = speedDone_on></a>
...@@ -1552,6 +1572,8 @@ Subscribes to the audio interruption event. When multiple audio and video assets ...@@ -1552,6 +1572,8 @@ Subscribes to the audio interruption event. When multiple audio and video assets
**Example** **Example**
```js ```js
import audio from '@ohos.multimedia.audio';
avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => {
console.info('audioInterrupt success,and InterruptEvent info is:' + info) console.info('audioInterrupt success,and InterruptEvent info is:' + info)
}) })
...@@ -1585,7 +1607,7 @@ Enumerates the states of the [AVPlayer](#avplayer9). Your application can proact ...@@ -1585,7 +1607,7 @@ Enumerates the states of the [AVPlayer](#avplayer9). Your application can proact
| Name | Type | Description | | Name | Type | Description |
| :-----------------------------: | :----: | :----------------------------------------------------------- | | :-----------------------------: | :----: | :----------------------------------------------------------- |
| idle | string | The AVPlayer enters this state after [createAVPlayer()](#mediacreateavplayer9) or **reset()** is called.<br>In case **createAVPlayer()** is used, all attributes are set to their default values.<br>In case **reset()** is invoked, the **url<sup>9+</sup>** or **fdSrc<sup>9+</sup>** attribute is reset, and other attributes set by the application are retained.| | idle | string | The AVPlayer enters this state after [createAVPlayer()](#mediacreateavplayer9) or **reset()** is called.<br>In case **createAVPlayer()** is used, all attributes are set to their default values.<br>In case **reset()** is called, the **url<sup>9+</sup>** or **fdSrc<sup>9+</sup>** attribute is reset, and other attributes are retained.|
| initialized | string | The AVPlayer enters this state after **url<sup>9+</sup>** or **fdSrc<sup>9+</sup>** attribute is set in the idle state. In this case, you can configure static attributes such as the window and audio.| | initialized | string | The AVPlayer enters this state after **url<sup>9+</sup>** or **fdSrc<sup>9+</sup>** attribute is set in the idle state. In this case, you can configure static attributes such as the window and audio.|
| prepared | string | The AVPlayer enters this state when **prepare()** is called in the initialized state. In this case, the playback engine has prepared the resources.| | prepared | string | The AVPlayer enters this state when **prepare()** is called in the initialized state. In this case, the playback engine has prepared the resources.|
| playing | string | The AVPlayer enters this state when **play()** is called in the prepared, paused, or completed state.| | playing | string | The AVPlayer enters this state when **play()** is called in the prepared, paused, or completed state.|
...@@ -1741,7 +1763,7 @@ let AVRecorderConfig = { ...@@ -1741,7 +1763,7 @@ let AVRecorderConfig = {
location : { latitude : 30, longitude : 130 } location : { latitude : 30, longitude : 130 }
} }
AVRecorder.prepare(AVRecorderConfig, (err) => { avRecorder.prepare(AVRecorderConfig, (err) => {
if (err == null) { if (err == null) {
console.info('prepare success'); console.info('prepare success');
} else { } else {
...@@ -1812,7 +1834,7 @@ let AVRecorderConfig = { ...@@ -1812,7 +1834,7 @@ let AVRecorderConfig = {
location : { latitude : 30, longitude : 130 } location : { latitude : 30, longitude : 130 }
} }
AVRecorder.prepare(AVRecorderConfig).then(() => { avRecorder.prepare(AVRecorderConfig).then(() => {
console.info('prepare success'); console.info('prepare success');
}).catch((err) => { }).catch((err) => {
console.info('prepare failed and catch error is ' + err.message); console.info('prepare failed and catch error is ' + err.message);
...@@ -1853,7 +1875,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -1853,7 +1875,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
```js ```js
let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. 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) { if (err == null) {
console.info('getInputSurface success'); console.info('getInputSurface success');
surfaceID = surfaceId; surfaceID = surfaceId;
...@@ -1862,8 +1884,6 @@ AVRecorder.getInputSurface((err, surfaceId) => { ...@@ -1862,8 +1884,6 @@ AVRecorder.getInputSurface((err, surfaceId) => {
} }
}); });
// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
``` ```
### getInputSurface<sup>9+</sup> ### getInputSurface<sup>9+</sup>
...@@ -1899,14 +1919,12 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -1899,14 +1919,12 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
```js ```js
let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. 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'); console.info('getInputSurface success');
surfaceID = surfaceId; surfaceID = surfaceId;
}).catch((err) => { }).catch((err) => {
console.info('getInputSurface failed and catch error is ' + err.message); console.info('getInputSurface failed and catch error is ' + err.message);
}); });
// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
``` ```
### start<sup>9+</sup><a name=avrecorder_start></a> ### start<sup>9+</sup><a name=avrecorder_start></a>
...@@ -1938,7 +1956,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -1938,7 +1956,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.start((err) => { avRecorder.start((err) => {
if (err == null) { if (err == null) {
console.info('start AVRecorder success'); console.info('start AVRecorder success');
} else { } else {
...@@ -1976,7 +1994,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -1976,7 +1994,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.start().then(() => { avRecorder.start().then(() => {
console.info('start AVRecorder success'); console.info('start AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('start AVRecorder failed and catch error is ' + err.message); console.info('start AVRecorder failed and catch error is ' + err.message);
...@@ -2012,7 +2030,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2012,7 +2030,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.pause((err) => { avRecorder.pause((err) => {
if (err == null) { if (err == null) {
console.info('pause AVRecorder success'); console.info('pause AVRecorder success');
} else { } else {
...@@ -2050,7 +2068,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2050,7 +2068,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.pause().then(() => { avRecorder.pause().then(() => {
console.info('pause AVRecorder success'); console.info('pause AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('pause AVRecorder failed and catch error is ' + err.message); console.info('pause AVRecorder failed and catch error is ' + err.message);
...@@ -2086,7 +2104,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2086,7 +2104,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.resume((err) => { avRecorder.resume((err) => {
if (err == null) { if (err == null) {
console.info('resume AVRecorder success'); console.info('resume AVRecorder success');
} else { } else {
...@@ -2124,7 +2142,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2124,7 +2142,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.resume().then(() => { avRecorder.resume().then(() => {
console.info('resume AVRecorder success'); console.info('resume AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('resume AVRecorder failed and catch error is ' + err.message); console.info('resume AVRecorder failed and catch error is ' + err.message);
...@@ -2162,7 +2180,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2162,7 +2180,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.stop((err) => { avRecorder.stop((err) => {
if (err == null) { if (err == null) {
console.info('stop AVRecorder success'); console.info('stop AVRecorder success');
} else { } else {
...@@ -2202,7 +2220,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2202,7 +2220,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.stop().then(() => { avRecorder.stop().then(() => {
console.info('stop AVRecorder success'); console.info('stop AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('stop AVRecorder failed and catch error is ' + err.message); console.info('stop AVRecorder failed and catch error is ' + err.message);
...@@ -2237,7 +2255,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2237,7 +2255,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.reset((err) => { avRecorder.reset((err) => {
if (err == null) { if (err == null) {
console.info('reset AVRecorder success'); console.info('reset AVRecorder success');
} else { } else {
...@@ -2274,7 +2292,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2274,7 +2292,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.reset().then(() => { avRecorder.reset().then(() => {
console.info('reset AVRecorder success'); console.info('reset AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('reset AVRecorder failed and catch error is ' + err.message); console.info('reset AVRecorder failed and catch error is ' + err.message);
...@@ -2308,7 +2326,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2308,7 +2326,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.release((err) => { avRecorder.release((err) => {
if (err == null) { if (err == null) {
console.info('release AVRecorder success'); console.info('release AVRecorder success');
} else { } else {
...@@ -2344,7 +2362,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2344,7 +2362,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.release().then(() => { avRecorder.release().then(() => {
console.info('release AVRecorder success'); console.info('release AVRecorder success');
}).catch((err) => { }).catch((err) => {
console.info('release AVRecorder failed and catch error is ' + err.message); console.info('release AVRecorder failed and catch error is ' + err.message);
...@@ -2369,9 +2387,8 @@ Subscribes to AVRecorder state changes. An application can subscribe to only one ...@@ -2369,9 +2387,8 @@ Subscribes to AVRecorder state changes. An application can subscribe to only one
**Example** **Example**
```js ```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); console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason);
}
}); });
``` ```
...@@ -2392,7 +2409,7 @@ Unsubscribes from AVRecorder state changes. ...@@ -2392,7 +2409,7 @@ Unsubscribes from AVRecorder state changes.
**Example** **Example**
```js ```js
AVRecorder.off('stateChange'); avRecorder.off('stateChange');
``` ```
### on('error')<sup>9+</sup><a name=avrecorder_onerror></a> ### on('error')<sup>9+</sup><a name=avrecorder_onerror></a>
...@@ -2424,7 +2441,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2424,7 +2441,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.on('error', (err) => { avRecorder.on('error', (err) => {
console.info('case avRecorder.on(error) called, errMessage is ' + err.message); console.info('case avRecorder.on(error) called, errMessage is ' + err.message);
}); });
``` ```
...@@ -2455,7 +2472,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ...@@ -2455,7 +2472,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco
**Example** **Example**
```js ```js
AVRecorder.off('error'); avRecorder.off('error');
``` ```
## AVRecorderState<sup>9+</sup> ## AVRecorderState<sup>9+</sup>
...@@ -2485,7 +2502,7 @@ Describes the audio and video recording parameters. ...@@ -2485,7 +2502,7 @@ Describes the audio and video recording parameters.
| audioSourceType | [AudioSourceType](#audiosourcetype9) | No | Type of the audio source to record. This parameter is mandatory for audio recording. | | audioSourceType | [AudioSourceType](#audiosourcetype9) | No | Type of the audio source to record. This parameter is mandatory for audio recording. |
| videoSourceType | [VideoSourceType](#videosourcetype9) | No | Type of the video source to record. This parameter is mandatory for video recording. | | videoSourceType | [VideoSourceType](#videosourcetype9) | No | Type of the video source to record. This parameter is mandatory for video recording. |
| profile | [AVRecorderProfile](#avrecorderprofile9) | Yes | Recording profile. This parameter is mandatory. | | profile | [AVRecorderProfile](#avrecorderprofile9) | Yes | Recording profile. This parameter is mandatory. |
| url | string | Yes | Recording output URL: fd://xx (fd number).<br>![img](figures/en-us_image_url.png)<br>This parameter is mandatory. | | url | string | Yes | Recording output URL: fd://xx (fd number).<br>![img](figures/en-us_image_url.png)<br>This parameter is mandatory.|
| rotation | number | No | Rotation angle of the recorded video. The value can only be 0, 90, 180, or 270. | | rotation | number | No | Rotation angle of the recorded video. The value can only be 0, 90, 180, or 270. |
| location | [Location](#location) | No | Geographical location of the recorded video. | | location | [Location](#location) | No | Geographical location of the recorded video. |
...@@ -3758,7 +3775,7 @@ Subscribes to the audio playback events. ...@@ -3758,7 +3775,7 @@ Subscribes to the audio playback events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------- | ---- | ------------------------------------------------------------ | | -------- | ---------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The following events are supported:<br>- 'play': triggered when the [play()](#audioplayer_play) API is called and audio playback starts.<br>- 'pause': triggered when the [pause()](#audioplayer_pause) API is called and audio playback is paused.<br>- 'stop': triggered when the [stop()](#audioplayer_stop) API is called and audio playback stops.<br>- 'reset': triggered when the [reset()](#audioplayer_reset) API is called and audio playback is reset.<br>- 'dataLoad': triggered when the audio data is loaded, that is, when the **src** attribute is configured.<br>- 'finish': triggered when the audio playback is finished.<br>- 'volumeChange': triggered when the [setVolume()](#audioplayer_setvolume) API is called and the playback volume is changed. | | type | string | Yes | Event type. The following events are supported:<br>- 'play': triggered when the [play()](#audioplayer_play) API is called and audio playback starts.<br>- 'pause': triggered when the [pause()](#audioplayer_pause) API is called and audio playback is paused.<br>- 'stop': triggered when the [stop()](#audioplayer_stop) API is called and audio playback stops.<br>- 'reset': triggered when the [reset()](#audioplayer_reset) API is called and audio playback is reset.<br>- 'dataLoad': triggered when the audio data is loaded, that is, when the **src** attribute is configured.<br>- 'finish': triggered when the audio playback is finished.<br>- 'volumeChange': triggered when the [setVolume()](#audioplayer_setvolume) API is called and the playback volume is changed.|
| callback | () => void | Yes | Callback invoked when the event is triggered. | | callback | () => void | Yes | Callback invoked when the event is triggered. |
**Example** **Example**
...@@ -4873,7 +4890,7 @@ Subscribes to the audio recording events. ...@@ -4873,7 +4890,7 @@ Subscribes to the audio recording events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ------------------------------------------------------------ | | -------- | -------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The following events are supported:<br>- 'prepare': triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.<br>- 'start': triggered when the [start](#audiorecorder_start) API is called and audio recording starts.<br>- 'pause': triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.<br>- 'resume': triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.<br>- 'stop': triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.<br>- 'release': triggered when the [release](#audiorecorder_release) API is called and the recording resources are released.<br>- 'reset': triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset. | | type | string | Yes | Event type. The following events are supported:<br>- 'prepare': triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.<br>- 'start': triggered when the [start](#audiorecorder_start) API is called and audio recording starts.<br>- 'pause': triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.<br>- 'resume': triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.<br>- 'stop': triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.<br>- 'release': triggered when the [release](#audiorecorder_release) API is called and the recording resources are released.<br>- 'reset': triggered when the [reset](#audiorecorder_reset) API is called and audio recording is reset.|
| callback | ()=>void | Yes | Callback invoked when the event is triggered. | | callback | ()=>void | Yes | Callback invoked when the event is triggered. |
**Example** **Example**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册