未验证 提交 cd37c5ce 编写于 作者: O openharmony_ci 提交者: Gitee

!21915 翻译完成:TR21335 0803 master EN 合入到4.0 beta2

Merge pull request !21915 from wusongqing/TR21335
...@@ -86,13 +86,13 @@ The application file paths obtained by the preceding contexts are different. ...@@ -86,13 +86,13 @@ The application file paths obtained by the preceding contexts are different.
| Name| Path| | Name| Path|
| -------- | -------- | | -------- | -------- |
| bundleCodeDir | \<Path prefix>/el1/bundle/| | bundleCodeDir | \<Path prefix>/el1/bundle|
| cacheDir | \<Path prefix>/\<Encryption level>/base/cache/| | cacheDir | \<Path prefix>/\<Encryption level>/base/cache|
| filesDir | \<Path prefix>/\<Encryption level>/base/files/| | filesDir | \<Path prefix>/\<Encryption level>/base/files|
| preferencesDir | \<Path prefix>/\<Encryption level>/base/preferences/| | preferencesDir | \<Path prefix>/\<Encryption level>/base/preferences|
| tempDir | \<Path prefix>/\<Encryption level>/base/temp/| | tempDir | \<Path prefix>/\<Encryption level>/base/temp|
| databaseDir | \<Path prefix>/\<Encryption level>/database/| | databaseDir | \<Path prefix>/\<Encryption level>/database|
| distributedFilesDir | \<Path prefix>/el2/distributedFiles/| | distributedFilesDir | \<Path prefix>/el2/distributedFiles|
The sample code is as follows: The sample code is as follows:
...@@ -110,6 +110,9 @@ The application file paths obtained by the preceding contexts are different. ...@@ -110,6 +110,9 @@ The application file paths obtained by the preceding contexts are different.
let distributedFilesDir = applicationContext.distributedFilesDir; let distributedFilesDir = applicationContext.distributedFilesDir;
let preferencesDir = applicationContext.preferencesDir; let preferencesDir = applicationContext.preferencesDir;
... ...
// Obtain the application file path.
let filePath = tempDir + 'test.txt';
console.info(`filePath: ${filePath}`);
} }
} }
``` ```
...@@ -118,13 +121,13 @@ The application file paths obtained by the preceding contexts are different. ...@@ -118,13 +121,13 @@ The application file paths obtained by the preceding contexts are different.
| Name| Path| | Name| Path|
| -------- | -------- | | -------- | -------- |
| bundleCodeDir | \<Path prefix>/el1/bundle/| | bundleCodeDir | \<Path prefix>/el1/bundle|
| cacheDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/cache/| | cacheDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/cache|
| filesDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/files/| | filesDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/files|
| preferencesDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/preferences/| | preferencesDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/preferences|
| tempDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/temp/| | tempDir | \<Path prefix>/\<Encryption level>/base/**haps/\<module-name>**/temp|
| databaseDir | \<Path prefix>/\<Encryption level>/database/**\<module-name>**/| | databaseDir | \<Path prefix>/\<Encryption level>/database/**\<module-name>**|
| distributedFilesDir | \<Path prefix>/el2/distributedFiles/**\<module-name>**/| | distributedFilesDir | \<Path prefix>/el2/distributedFiles/**\<module-name>**|
The sample code is as follows: The sample code is as follows:
...@@ -141,6 +144,9 @@ The application file paths obtained by the preceding contexts are different. ...@@ -141,6 +144,9 @@ The application file paths obtained by the preceding contexts are different.
let distributedFilesDir = this.context.distributedFilesDir; let distributedFilesDir = this.context.distributedFilesDir;
let preferencesDir = this.context.preferencesDir; let preferencesDir = this.context.preferencesDir;
... ...
// Obtain the application file path.
let filePath = tempDir + 'test.txt';
console.info(`filePath: ${filePath}`);
} }
} }
``` ```
......
...@@ -53,9 +53,9 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -53,9 +53,9 @@ The table below describes the main APIs used for cross-device migration. For det
| **API**| Description| | **API**| Description|
| -------- | -------- | | -------- | -------- |
| onContinue(wantParam : {[key: string]: any}): OnContinueResult | Called by the initiator to store the data required for migration and indicate whether the migration is accepted.<br>- **AGREE**: The migration is accepted.<br>- **REJECT**: The migration is rejected, for example, when an application is abnormal in **onContinue()**.<br>- **MISMATCH**: The version does not match. The application on the initiator can obtain the version number of the target application from **onContinue()**. If the migration cannot be performed due to version mismatch, this error code is returned.| | onContinue(wantParam : {[key: string]: Object}): OnContinueResult | Called by the initiator to store the data required for migration and indicate whether the migration is accepted.<br>- **AGREE**: The migration is accepted.<br>- **REJECT**: The migration is rejected, for example, when an application is abnormal in **onContinue()**.<br>- **MISMATCH**: The version does not match. The application on the initiator can obtain the version number of the target application from **onContinue()**. If the migration cannot be performed due to version mismatch, this error code is returned.|
| onCreate(want: Want, param: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page in the multiton migration scenario. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).| | onCreate(want: Want, param: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page when the target uses cold start or the target is a multiton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).|
| onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page in the singleton migration scenario. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).| | onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page when the target is a singleton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).|
...@@ -90,7 +90,7 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -90,7 +90,7 @@ The table below describes the main APIs used for cross-device migration. For det
4. Implement [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) in the UIAbility of the initiator. 4. Implement [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) in the UIAbility of the initiator.
[onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) is called on the initiator. You can save the data in this method to implement application compatibility check and migration decision. [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) is called on the initiator. You can save the data in this method to implement application compatibility check and migration decision.
- Saving migrated data: You can save the data to be migrated in key-value pairs in **wantParam**. - Saving migrated data: You can save the data to be migrated in key-value pairs in **wantParam**.
- Checking application compatibility: You can obtain the version number of the target application from **wantParam** and that of the current application from **wantParam.version** of the **onContinue()** callback. Then you can check the compatibility between the two. - Checking application compatibility: You can obtain the version number of the target application from **wantParam** and that of the current application from **wantParam.version** of the **onContinue()** callback. Then you can check the compatibility between the two.
...@@ -114,7 +114,7 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -114,7 +114,7 @@ The table below describes the main APIs used for cross-device migration. For det
``` ```
5. Implement **onCreate()** and **onNewWant()** in the UIAbility of the target application to implement data restoration. 5. Implement **onCreate()** and **onNewWant()** in the UIAbility of the target application to implement data restoration.
- Implementation example of **onCreate** in the multiton scenario - Implementation example of **onCreate**
- The target device determines whether the startup is **LaunchReason.CONTINUATION** based on **launchReason** in **onCreate()**. - The target device determines whether the startup is **LaunchReason.CONTINUATION** based on **launchReason** in **onCreate()**.
- You can obtain the saved migration data from the **want** parameter. - You can obtain the saved migration data from the **want** parameter.
- After data restoration is complete, call **restoreWindowStage** to trigger page restoration, including page stack information. - After data restoration is complete, call **restoreWindowStage** to trigger page restoration, including page stack information.
...@@ -139,11 +139,29 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -139,11 +139,29 @@ The table below describes the main APIs used for cross-device migration. For det
} }
} }
``` ```
- For a singleton ability, use **onNewWant()** to achieve the same implementation. - For a singleton application, you must also implement **onNewWant()**, in the same way as **onCreate()**.
- Determine the migration scenario in **onNewWant()**, restore data, and trigger page restoration.
```ts
export default class EntryAbility extends UIAbility {
storage : LocalStorage;
onNewWant(want, launchParam) {
console.info(`EntryAbility onNewWant ${AbilityConstant.LaunchReason.CONTINUATION}`)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// Obtain the user data from the want parameter.
let workInput = want.parameters.work
console.info(`work input ${workInput}`)
AppStorage.SetOrCreate<string>('ContinueWork', workInput)
this.storage = new LocalStorage();
this.context.restoreWindowStage(this.storage);
}
}
}
```
6. (Optional) Call [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) to set the mission continuation state. 6. (Optional) Call [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) to set the mission continuation state.
For an application that supports migration, mission migration is enabled by default, and the system notifies peripheral trusted devices that a mission can be migrated or canceled based on the gain/loss focus state of the mission. If you want the system to send a notification to peripheral devices only when your application is in a specific scenario, set the migration continuation state to **INACTIVE** when the application is started and change it to **ACTIVE** when the application enters that specific scenario. For details about the API, see [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10). For an application that supports migration, mission migration is enabled by default, and the system notifies peripheral trusted devices that a mission can be migrated or canceled based on the gain/loss focus state of the mission. If you want the system to send a notification to peripheral devices only when your application is in a specific scenario, set the migration continuation state to **INACTIVE** when the application is started and change it to **ACTIVE** when the application enters that specific scenario.
- Example: An application does not require migration during startup. - Example: An application does not require migration during startup.
...@@ -180,7 +198,7 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -180,7 +198,7 @@ The table below describes the main APIs used for cross-device migration. For det
onContinue(wantParam : {[key: string]: any}) { onContinue(wantParam : {[key: string]: any}) {
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
wantParam[wantConstant.SUPPORT_CONTINUE_PAGE_STACK_KEY] = false; wantParam[wantConstant.Params.SUPPORT_CONTINUE_PAGE_STACK_KEY] = false;
return AbilityConstant.OnContinueResult.AGREE; return AbilityConstant.OnContinueResult.AGREE;
} }
...@@ -202,7 +220,7 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -202,7 +220,7 @@ The table below describes the main APIs used for cross-device migration. For det
onContinue(wantParam : {[key: string]: any}) { onContinue(wantParam : {[key: string]: any}) {
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
wantParam[wantConstant.SUPPORT_CONTINUE_SOURCE_EXIT_KEY] = false; wantParam[wantConstant.Params.SUPPORT_CONTINUE_SOURCE_EXIT_KEY] = false;
return AbilityConstant.OnContinueResult.AGREE; return AbilityConstant.OnContinueResult.AGREE;
} }
``` ```
# mediaLibrary Switching # mediaLibrary Switching
| API in the FA Model| Corresponding .d.ts File in the Stage Model| Corresponding API in the Stage Model| | API in the FA Model| Corresponding .d.ts File in the Stage Model| Corresponding API in the Stage Model|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| [getMediaLibrary(): MediaLibrary;](../reference/apis/js-apis-medialibrary.md#medialibrarygetmedialibrary) | \@ohos.multimedia.mediaLibrary.d.ts | [getMediaLibrary(context: Context): MediaLibrary;](../reference/apis/js-apis-medialibrary.md#medialibrarygetmedialibrary8) | | [getMediaLibrary():&nbsp;MediaLibrary;](../reference/apis/js-apis-medialibrary.md#medialibrarygetmedialibrary) | \@ohos.file.photoAccessHelper.d.ts | [getPhotoAccessHelper(context: Context): PhotoAccessHelper;](../reference/apis/js-apis-photoAccessHelper.md#photoaccesshelpergetphotoaccesshelper) |
...@@ -15,65 +15,64 @@ For details about the APIs, see [Sensor](../reference/apis/js-apis-sensor.md). ...@@ -15,65 +15,64 @@ For details about the APIs, see [Sensor](../reference/apis/js-apis-sensor.md).
| ohos.sensor | sensor.on(sensorId, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to data changes of a type of sensor.| | ohos.sensor | sensor.on(sensorId, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to data changes of a type of sensor.|
| ohos.sensor | sensor.once(sensorId, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to only one data change of a type of sensor.| | ohos.sensor | sensor.once(sensorId, callback:AsyncCallback&lt;Response&gt;): void | Subscribes to only one data change of a type of sensor.|
| ohos.sensor | sensor.off(sensorId, callback?:AsyncCallback&lt;void&gt;): void | Unsubscribes from sensor data changes.| | ohos.sensor | sensor.off(sensorId, callback?:AsyncCallback&lt;void&gt;): void | Unsubscribes from sensor data changes.|
| ohos.sensor | sensor.getSensorList(callback: AsyncCallback\<Array\<Sensor>>): void| Obtains information about all sensors on the device. This API uses an asynchronous callback to return the result.|
## How to Develop ## How to Develop
1. Before obtaining data from a type of sensor, check whether the required permission has been configured.<br> The acceleration sensor is used as an example.
The system provides the following sensor-related permissions:
- ohos.permission.ACCELEROMETER
- ohos.permission.GYROSCOPE 1. Import the module.
- ohos.permission.ACTIVITY_MOTION
- ohos.permission.READ_HEALTH_DATA
For details about how to configure a permission, see [Declaring Permissions](../security/accesstoken-guidelines.md).
2. Subscribe to data changes of a type of sensor. The following uses the acceleration sensor as an example.
```ts ```ts
import sensor from "@ohos.sensor"; import sensor from "@ohos.sensor";
sensor.on(sensor.SensorId.ACCELEROMETER, function (data) {
console.info("Succeeded in obtaining data. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained.
});
``` ```
![171e6f30-a8d9-414c-bafa-b430340305fb](figures/171e6f30-a8d9-414c-bafa-b430340305fb.png)
3. Unsubscribe from sensor data changes. 2. Obtain information about all sensors on the device.
```ts ```ts
import sensor from "@ohos.sensor"; sensor.getSensorList(function (error, data) {
sensor.off(sensor.SensorId.ACCELEROMETER); if (error) {
``` console.info('getSensorList failed');
} else {
![65d69983-29f6-4381-80a3-f9ef2ec19e53](figures/65d69983-29f6-4381-80a3-f9ef2ec19e53.png) console.info('getSensorList success');
for (let i = 0; i < data.length; i++) {
console.info(JSON.stringify(data[i]));
}
}
});
```
4. Subscribe to only one data change of a type of sensor. ![](figures/001.png)
```ts
import sensor from "@ohos.sensor";
sensor.once(sensor.SensorId.ACCELEROMETER, function (data) { The minimum and the maximum sampling periods supported by the sensor are 5000000 ns and 200000000 ns, respectively. Therefore, the value of **interval** must be within this range.
console.info("Succeeded in obtaining data. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained.
}); 3. Check whether the corresponding permission has been configured. For details, see [Applying for Permissions](../security/accesstoken-guidelines.md).
```
![db5d017d-6c1c-4a71-a2dd-f74b7f23239e](figures/db5d017d-6c1c-4a71-a2dd-f74b7f23239e.png)
If the API fails to be called, you are advised to use the **try/catch** statement to capture error information that may occur in the code. Example: 4. Register a listener. You can call **on()** or **once()** to listen for sensor data changes.
- The **on()** API is used to continuously listen for data changes of the sensor. The sensor reporting interval is set to 100000000 ns.
```ts
sensor.on(sensor.SensorId.ACCELEROMETER, function (data) {
console.info("Succeeded in obtaining data. x: " + data.x + " y: " + data.y + " z: " + data.z);
}, {'interval': 100000000});
```
![](figures/002.png)
- The **once()** API is used to listen for only one data change of the sensor.
```ts ```ts
import sensor from "@ohos.sensor"; sensor.once(sensor.SensorId.ACCELEROMETER, function (data) {
console.info("Succeeded in obtaining data. x: " + data.x + " y: " + data.y + " z: " + data.z);
});
```
![](figures/003.png)
try { 5. Cancel continuous listening.
sensor.once(sensor.SensorId.ACCELEROMETER, function (data) {
console.info("Succeeded in obtaining data. x: " + data.x + "y: " + data.y + "z: " + data.z); // Data is obtained. ```ts
}); sensor.off(sensor.SensorId.ACCELEROMETER);
} catch (error) {
console.error(`Failed to get sensor data. Code: ${error.code}, message: ${error.message}`);
}
``` ```
...@@ -76,9 +76,9 @@ This JSON file contains two attributes: **MetaData** and **Channels**. ...@@ -76,9 +76,9 @@ This JSON file contains two attributes: **MetaData** and **Channels**.
- **Create**: time when the file was created. This parameter is optional. - **Create**: time when the file was created. This parameter is optional.
- **Description**: additional information such as the vibration effect and creation information. This parameter is optional. - **Description**: additional information such as the vibration effect and creation information. This parameter is optional.
- **Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**. - **Channels** provides information about the vibration channel. It is a JSON array that holds information about each channel. It contains two attributes: **Parameters** and **Pattern**.
- **Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory. - **Parameters** provides parameters related to the channel. Under it, **Index** indicates the channel ID. The value is fixed at **1** for a single channel. This parameter is mandatory.
- **Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types: - **Pattern** indicates the vibration sequence. It is a JSON array. Under it, **Event** indicates a vibration event, which can be either of the following types:
- **transient**: short vibration - **transient**: short vibration
- **continuous**: long vibration - **continuous**: long vibration
The table below describes the parameters under **Event**. The table below describes the parameters under **Event**.
...@@ -89,7 +89,7 @@ The table below describes the parameters under **Event**. ...@@ -89,7 +89,7 @@ The table below describes the parameters under **Event**.
| StartTime | Start time of the vibration. This parameter is mandatory.| [0, 1800 000], in ms, without overlapping| | StartTime | Start time of the vibration. This parameter is mandatory.| [0, 1800 000], in ms, without overlapping|
| Duration | Duration of the vibration. This parameter is valid only when **Type** is **continuous**.| (10, 1600), in ms| | Duration | Duration of the vibration. This parameter is valid only when **Type** is **continuous**.| (10, 1600), in ms|
| Intensity | Intensity of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration strength.| | Intensity | Intensity of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration strength.|
| Frequency | Frequency of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration frequency| | Frequency | Frequency of the vibration. This parameter is mandatory.| [0, 100], a relative value that does not represent the actual vibration frequency.|
The following requirements must be met: The following requirements must be met:
...@@ -221,45 +221,42 @@ The following requirements must be met: ...@@ -221,45 +221,42 @@ The following requirements must be met:
```ts ```ts
import vibrator from '@ohos.vibrator'; import vibrator from '@ohos.vibrator';
const FILE_NAME = "xxx.json";
// Obtain the file descriptor of the vibration configuration file. // Obtain the file descriptor of the vibration configuration file.
let fileDescriptor = undefined; async function getRawfileFd(fileName) {
getContext().resourceManager.getRawFd(FILE_NAME).then(value => { let rawFd = await globalThis.getContext().resourceManager.getRawFd(fileName);
fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; return rawFd;
console.info('Succeed in getting resource file descriptor'); }
}).catch(error => {
console.error(`Failed to get resource file descriptor. Code: ${error.code}, message: ${error.message}`); // Close the file descriptor of the vibration configuration file.
}); async function closeRawfileFd(fileName) {
// To use startVibration and stopVibration, you must configure the ohos.permission.VIBRATE permission. await globalThis.getContext().resourceManager.closeRawFd(fileName)
try { }
// Start custom vibration.
vibrator.startVibration({ // Play the custom vibration. To use startVibration and stopVibration, you must configure the ohos.permission.VIBRATE permission.
type: "file", async function playCustomHaptic(fileName) {
hapticFd: { fd: fileDescriptor.fd, offset: fileDescriptor.offset, length: fileDescriptor.length } try {
}, { let rawFd = await getRawfileFd(fileName);
usage: "alarm" vibrator.startVibration({
}).then(() => { type: "file",
console.info('Succeed in starting vibration'); hapticFd: { fd: rawFd.fd, offset: rawFd.offset, length: rawFd.length }
}, (error) => { }, {
console.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`); usage: "alarm"
}); }).then(() => {
// Stop vibration in all modes. console.info('Succeed in starting vibration');
vibrator.stopVibration(function (error) { }, (error) => {
if (error) { console.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`);
console.error(`Failed to stop vibration. Code: ${error.code}, message: ${error.message}`); });
return; vibrator.stopVibration(function (error) {
} if (error) {
console.info('Succeed in stopping vibration'); console.error(`Failed to stop vibration. Code: ${error.code}, message: ${error.message}`);
}) return;
} catch (error) { }
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`); console.info('Succeed in stopping vibration');
})
await closeRawfileFd(fileName);
} catch (error) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
}
} }
// Close the vibration file.
getContext().resourceManager.closeRawFd(FILE_NAME).then(() => {
console.info('Succeed in closing resource file descriptor');
}).catch(error => {
console.error(`Failed to close resource file descriptor. Code: ${error.code}, message: ${error.message}`);
});
``` ```
...@@ -91,7 +91,7 @@ Enable the default system audio effect. ...@@ -91,7 +91,7 @@ Enable the default system audio effect.
## Obtaining the Global Audio Effect Mode ## Obtaining the Global Audio Effect Mode
You can obtain the global audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**). You can obtain the global audio effect mode corresponding to a specific audio stream usage (specified by **StreamUsage**).
For an audio playback application, pay attention to the audio effect mode used by the audio stream of the application and perform corresponding operations. For example, for a music application, select the audio effect mode for the music scenario. Before obtaining the global audio effect mode, call **getStreamManager()** to create an **AudioStreamManager** instance. For an audio playback application, pay attention to the audio effect mode used by the audio stream of the application and perform corresponding operations. For example, for a music application, select the audio effect mode for the music scenario. Before obtaining the global audio effect mode, call **getStreamManager()** to create an **AudioStreamManager** instance.
### Creating an AudioStreamManager Instance ### Creating an AudioStreamManager Instance
...@@ -107,7 +107,7 @@ Create an **AudioStreamManager** instance. Before using **AudioStreamManager** A ...@@ -107,7 +107,7 @@ Create an **AudioStreamManager** instance. Before using **AudioStreamManager** A
### Querying the Audio Effect Mode of the Corresponding Scenario ### Querying the Audio Effect Mode of the Corresponding Scenario
```js ```js
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => { audioStreamManager.getAudioEffectInfoArray(audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, audioEffectInfoArray) => {
if (err) { if (err) {
console.error('Failed to get effect info array'); console.error('Failed to get effect info array');
return; return;
......
...@@ -18,8 +18,8 @@ import freeInstall from '@ohos.bundle.freeInstall'; ...@@ -18,8 +18,8 @@ import freeInstall from '@ohos.bundle.freeInstall';
| Permission | Permission Level | Description | | Permission | Permission Level | Description |
| ------------------------------------------ | ------------ | ------------------ | | ------------------------------------------ | ------------ | ------------------ |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | Permission to query information about all bundles.| | ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | Permission to query information about all aplications.|
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall bundles. | | ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall other applications except enterprise applications, including enterprise InHouse, mobile device management (MDM), and Normal applications. |
For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels). For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels).
## UpgradeFlag ## UpgradeFlag
......
...@@ -883,7 +883,7 @@ async function Demo() { ...@@ -883,7 +883,7 @@ async function Demo() {
getColorSpace(): colorSpaceManager.ColorSpaceManager getColorSpace(): colorSpaceManager.ColorSpaceManager
Obtains the color space of this image Obtains the color space of this image.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
......
...@@ -16,7 +16,11 @@ import installer from '@ohos.bundle.installer'; ...@@ -16,7 +16,11 @@ import installer from '@ohos.bundle.installer';
| Permission | Permission Level | Description | | Permission | Permission Level | Description |
| ------------------------------ | ----------- | ---------------- | | ------------------------------ | ----------- | ---------------- |
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall bundles.| | ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall other applications except enterprise applications, including enterprise InHouse, mobile device management (MDM), and Normal applications.|
| ohos.permission.INSTALL_ENTERPRISE_BUNDLE | system_core | Permission to install enterprise InHouse applications.|
| ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE | system_core | Permission to install enterprise MDM applications.|
| ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE | system_core | Permission to install enterprise Normal applications.|
For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels). For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels).
......
...@@ -310,19 +310,18 @@ Enumerates the media description keys. ...@@ -310,19 +310,18 @@ Enumerates the media description keys.
**System capability**: SystemCapability.Multimedia.Media.Core **System capability**: SystemCapability.Multimedia.Media.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | --------------- | ------------------------------------------------------------ | | ------------------------ | --------------- | ------------------------------------------------------------ |
| MD_KEY_TRACK_INDEX | 'track_index' | Track index, which is a number. | | MD_KEY_TRACK_INDEX | 'track_index' | Track index, which is a number. |
| MD_KEY_TRACK_TYPE | 'track_type' | Track type, which is a number. For details, see [MediaType](#mediatype8).| | MD_KEY_TRACK_TYPE | 'track_type' | Track type, which is a number. For details, see [MediaType](#mediatype8).|
| MD_KEY_CODEC_MIME | 'codec_mime' | Codec MIME type, which is a string. | | MD_KEY_CODEC_MIME | 'codec_mime' | Codec MIME type, which is a string. |
| MD_KEY_DURATION | 'duration' | Media duration, which is a number, in units of ms. | | MD_KEY_DURATION | 'duration' | Media duration, which is a number, in units of ms. |
| MD_KEY_BITRATE | 'bitrate' | Bit rate, which is a number, in units of bit/s. | | MD_KEY_BITRATE | 'bitrate' | Bit rate, which is a number, in units of bit/s. |
| MD_KEY_WIDTH | 'width' | Video width, which is a number, in units of pixel. | | MD_KEY_WIDTH | 'width' | Video width, which is a number, in units of pixel. |
| MD_KEY_HEIGHT | 'height' | Video height, which is a number, in units of pixel. | | MD_KEY_HEIGHT | 'height' | Video height, which is a number, in units of pixel. |
| MD_KEY_FRAME_RATE | 'frame_rate' | Video frame rate, which is a number, in units of 100 fps.| | MD_KEY_FRAME_RATE | 'frame_rate' | Video frame rate, which is a number, in units of 100 fps.|
| MD_KEY_AUD_CHANNEL_COUNT | 'channel_count' | Number of audio channels, which is a number. | | MD_KEY_AUD_CHANNEL_COUNT | 'channel_count' | Number of audio channels, which is a number. |
| MD_KEY_AUD_SAMPLE_RATE | 'sample_rate' | Sampling rate, which is a number, in units of Hz. | | MD_KEY_AUD_SAMPLE_RATE | 'sample_rate' | Sampling rate, which is a number, in units of Hz. |
| MD_KEY_LANGUAGE<sup>10+</sup> | "language" | Language, which is a string. |
## BufferingInfoType<sup>8+</sup> ## BufferingInfoType<sup>8+</sup>
...@@ -1001,124 +1000,6 @@ for (let i = 0; i < arrayDescription.length; i++) { ...@@ -1001,124 +1000,6 @@ for (let i = 0; i < arrayDescription.length; i++) {
} }
``` ```
### selectTrack<sup>10+</sup><a name=avplayer_selecttrack></a>
selectTrack(index: number): void
Selects an audio track. This API can be called only when the AVPlayer is in the prepared state. You can listen for the [trackChange event](#trackchange_on) to determine whether the API calling takes effect.
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| index | number | Yes | Track ID, which can be obtained by calling [getTrackDescription](#avplayer_gettrackdescription).|
**Example**
```js
let index = 2
avPlayer.selectTrack(index)
```
### deselectTrack<sup>10+</sup><a name=avplayer_deselecttrack></a>
deselectTrack(index: number): void
Deselects an audio track. The default audio track will be used after the audio track is deselected. This API can be called only when the AVPlayer is in the prepared state. You can listen for the [trackChange event](#trackchange_on) to determine whether the API calling takes effect.
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
| index | number | Yes | Track ID. You can obtain the ID of the current track by calling [getCurrentTrack](#avplayer_getcurrenttrack).|
**Example**
```js
let index = 2
avPlayer.deselectTrack(index)
```
### getCurrentTrack<sup>10+</sup><a name=avplayer_getcurrenttrack></a>
getCurrentTrack(trackType: MediaType, callback: AsyncCallback\<number>): void
Obtains the ID of the current track. This API uses an asynchronous callback to return the result. It can be called only when the AVPlayer is in the prepared, playing, paused, or completed state.
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | ----------------------- | ---- | ------------------------------------------------------------ |
| trackType | [MediaType](#mediatype) | Yes | Enumerates the media types. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the current track. If **-1** is returned, no track for the specified media type exists.|
**Error codes**
For details about the error codes, see [Media Error Codes](../errorcodes/errorcode-media.md).
| ID| Error Message |
| -------- | ------------------------------------------ |
| 5400102 | Operation not allowed. Return by callback. |
**Example**
```js
let mediaType = media.MediaType.MEDIA_TYPE_AUD;
let trackIndex = null;
avPlayer.getCurrentTrack(mediaType, (err, index) => {
if (err == null) {
console.info('getCurrentTrack success');
trackIndex = index;
} else {
console.error('getCurrentTrack failed and error is ' + err.message);
}
});
```
### getCurrentTrack<sup>10+</sup>
getCurrentTrack(trackType: MediaType): Promise\<number>
Obtains the ID of the current track. This API uses a promise to return the result. It can be called only when the AVPlayer is in the prepared, playing, paused, or completed state.
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Return value**
| Type | Description |
| ---------------- | ------------------------------------------------------------ |
| trackType | [MediaType](#mediatype) |
| Promise\<number>| Promise used to return the current track. If **-1** is returned, no track for the specified media type exists.|
**Error codes**
For details about the error codes, see [Media Error Codes](../errorcodes/errorcode-media.md).
| ID| Error Message |
| -------- | ----------------------------------------- |
| 5400102 | Operation not allowed. Return by promise. |
**Example**
```js
let mediaType = media.MediaType.MEDIA_TYPE_AUD;
let trackIndex = null;
avPlayer.getCurrentTrack(mediaType).then((index) => {
console.info('getCurrentTrack success');
trackIndex = index;
}).catch((err) => {
console.error('getCurrentTrack failed and catch error is ' + err.message);
});
```
### seek<sup>9+</sup><a name=avplayer_seek></a> ### seek<sup>9+</sup><a name=avplayer_seek></a>
seek(timeMs: number, mode?:SeekMode): void seek(timeMs: number, mode?:SeekMode): void
...@@ -1725,49 +1606,6 @@ Unsubscribes from the audio interruption event. ...@@ -1725,49 +1606,6 @@ Unsubscribes from the audio interruption event.
avPlayer.off('audioInterrupt') avPlayer.off('audioInterrupt')
``` ```
### on('trackChange')<sup>10+</sup><a name = trackchange_on></a>
on(type: 'trackChange', callback: (index: number, isSelect: boolean) => void): void;
Subscribes to track changes, which are triggered by calling **selectTrack** or **deselectTrack**.
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------- | ---- | ----------------------------------------------------- |
| type | string | Yes | Event type, which is **'trackChange'** in this case.|
| callback | function | Yes | Callback invoked when the event is triggered. |
**Example**
```js
avPlayer.on('trackChange', (index: number, isSelect: boolean) => {
console.info('trackChange success, and index is:' + index + ', isSelect is :' + isSelect)
})
```
### off('trackChange')<sup>10+</sup><a name = trackchange_off></a>
off(type: 'trackChange'): void
Unsubscribes from track changes
**System capability**: SystemCapability.Multimedia.Media.AVPlayer
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type, which is **'trackChange'** in this case.|
**Example**
```js
avPlayer.off('trackChange')
```
## AVPlayerState<sup>9+</sup><a name = avplayerstate></a> ## AVPlayerState<sup>9+</sup><a name = avplayerstate></a>
Enumerates the states of the [AVPlayer](#avplayer9). Your application can proactively obtain the AVPlayer state through the **state** attribute or obtain the reported AVPlayer state by subscribing to the [stateChange](#stateChange_on) event. For details about the rules for state transition, see [Audio Playback](../../media/using-avplayer-for-playback.md). Enumerates the states of the [AVPlayer](#avplayer9). Your application can proactively obtain the AVPlayer state through the **state** attribute or obtain the reported AVPlayer state by subscribing to the [stateChange](#stateChange_on) event. For details about the rules for state transition, see [Audio Playback](../../media/using-avplayer-for-playback.md).
...@@ -2680,6 +2518,8 @@ Enumerates the AVRecorder states. You can obtain the state through the **state** ...@@ -2680,6 +2518,8 @@ Enumerates the AVRecorder states. You can obtain the state through the **state**
Describes the audio and video recording parameters. Describes the audio and video recording parameters.
The **audioSourceType** and **videoSourceType** parameters are used to distinguish audio-only recording, video-only recording, and audio and video recording. For audio-only recording, set only **audioSourceType**. For video-only recording, set only **videoSourceType**. For audio and video recording, set both **audioSourceType** and **videoSourceType**.
**System capability**: SystemCapability.Multimedia.Media.AVRecorder **System capability**: SystemCapability.Multimedia.Media.AVRecorder
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
...@@ -2691,8 +2531,6 @@ Describes the audio and video recording parameters. ...@@ -2691,8 +2531,6 @@ Describes the audio and video recording parameters.
| rotation | number | No | Rotation angle of the recorded video. The value can only be 0 (default), 90, 180, or 270. | | rotation | number | No | Rotation angle of the recorded video. The value can only be 0 (default), 90, 180, or 270. |
| location | [Location](#location) | No | Geographical location of the recorded video. By default, the geographical location information is not recorded. | | location | [Location](#location) | No | Geographical location of the recorded video. By default, the geographical location information is not recorded. |
The **audioSourceType** and **videoSourceType** parameters are used to distinguish audio-only recording, video-only recording, and audio and video recording. For audio-only recording, set only **audioSourceType**. For video-only recording, set only **videoSourceType**. For audio and video recording, set both **audioSourceType** and **videoSourceType**.
## AVRecorderProfile<sup>9+</sup> ## AVRecorderProfile<sup>9+</sup>
Describes the audio and video recording profile. Describes the audio and video recording profile.
...@@ -3517,13 +3355,15 @@ Enumerates the video recording states. You can obtain the state through the **st ...@@ -3517,13 +3355,15 @@ Enumerates the video recording states. You can obtain the state through the **st
Describes the video recording parameters. Describes the video recording parameters.
The **audioSourceType** and **videoSourceType** parameters are used to distinguish video-only recording from audio and video recording. (For audio-only recording recording, use **[AVRecorder](#avrecorder9)** or **[AudioRecorder](#audiorecorderdeprecated)**.) For video-only recording, set only **videoSourceType**. For audio and video recording, set both **audioSourceType** and **videoSourceType**.
**System capability**: SystemCapability.Multimedia.Media.VideoRecorder **System capability**: SystemCapability.Multimedia.Media.VideoRecorder
**System API**: This is a system API. **System API**: This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | | --------------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
| audioSourceType | [AudioSourceType](#audiosourcetype9) | Yes | Type of the audio source for video recording. | | audioSourceType | [AudioSourceType](#audiosourcetype9) | No | Type of the audio source for video recording. This parameter is mandatory for audio recording. |
| videoSourceType | [VideoSourceType](#videosourcetype9) | Yes | Type of the video source for video recording. | | videoSourceType | [VideoSourceType](#videosourcetype9) | Yes | Type of the video source for video recording. |
| profile | [VideoRecorderProfile](#videorecorderprofile9) | Yes | Video recording profile. | | profile | [VideoRecorderProfile](#videorecorderprofile9) | Yes | Video recording profile. |
| rotation | number | No | Rotation angle of the recorded video. The value can only be 0 (default), 90, 180, or 270. | | rotation | number | No | Rotation angle of the recorded video. The value can only be 0 (default), 90, 180, or 270. |
...@@ -3540,10 +3380,10 @@ Describes the video recording profile. ...@@ -3540,10 +3380,10 @@ Describes the video recording profile.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------- | -------------------------------------------- | ---- | ---------------- | | ---------------- | -------------------------------------------- | ---- | ---------------- |
| audioBitrate | number | Yes | Audio encoding bit rate.| | audioBitrate | number | No | Audio encoding bit rate. This parameter is mandatory for audio recording.|
| audioChannels | number | Yes | Number of audio channels.| | audioChannels | number | No | Number of audio channels. This parameter is mandatory for audio recording.|
| audioCodec | [CodecMimeType](#codecmimetype8) | Yes | Audio encoding format. | | audioCodec | [CodecMimeType](#codecmimetype8) | No | Audio encoding format. This parameter is mandatory for audio recording. |
| audioSampleRate | number | Yes | Audio sampling rate. | | audioSampleRate | number | No | Audio sampling rate. This parameter is mandatory for audio recording. |
| fileFormat | [ContainerFormatType](#containerformattype8) | Yes | Container format of a file.| | fileFormat | [ContainerFormatType](#containerformattype8) | Yes | Container format of a file.|
| videoBitrate | number | Yes | Video encoding bit rate.| | videoBitrate | number | Yes | Video encoding bit rate.|
| videoCodec | [CodecMimeType](#codecmimetype8) | Yes | Video encoding format. | | videoCodec | [CodecMimeType](#codecmimetype8) | Yes | Video encoding format. |
......
...@@ -49,7 +49,7 @@ console.log(view1) //<?xml version="1.0" encoding="utf-8"?> ...@@ -49,7 +49,7 @@ console.log(view1) //<?xml version="1.0" encoding="utf-8"?>
setAttributes(name: string, value: string): void setAttributes(name: string, value: string): void
Sets an attribute. Writes an attribute and its value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -57,8 +57,8 @@ Sets an attribute. ...@@ -57,8 +57,8 @@ Sets an attribute.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | --------------- | | ------ | ------ | ---- | --------------- |
| name | string | Yes | Key of the attribute. | | name | string | Yes | Attribute to write. |
| value | string | Yes | Value of the attribute.| | value | string | Yes | Attribute value to write.|
**Example** **Example**
...@@ -114,7 +114,7 @@ console.log(view1) //<d/> ...@@ -114,7 +114,7 @@ console.log(view1) //<d/>
setDeclaration(): void setDeclaration(): void
Sets a declaration. Writes an XML file declaration.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -237,7 +237,7 @@ console.log(JSON.stringify(view1)) //<?xml version="1.0" encoding="utf-8"?>\r\n< ...@@ -237,7 +237,7 @@ console.log(JSON.stringify(view1)) //<?xml version="1.0" encoding="utf-8"?>\r\n<
setComment(text: string): void setComment(text: string): void
Sets the comment. Writes a comment.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -245,7 +245,7 @@ Sets the comment. ...@@ -245,7 +245,7 @@ Sets the comment.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| text | string | Yes | Comment to set.| | text | string | Yes | Comment to write.|
**Example** **Example**
...@@ -268,7 +268,7 @@ console.log(view1) //<!--Hello, World!-->' ...@@ -268,7 +268,7 @@ console.log(view1) //<!--Hello, World!-->'
setCDATA(text: string): void setCDATA(text: string): void
Sets CDATA attributes. Writes CDATA data.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -276,7 +276,7 @@ Sets CDATA attributes. ...@@ -276,7 +276,7 @@ Sets CDATA attributes.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------------- | | ------ | ------ | ---- | ----------------- |
| text | string | Yes | CDATA attribute to set.| | text | string | Yes | CDATA data to write.|
**Example** **Example**
...@@ -299,7 +299,7 @@ console.log(view1) //'<![CDATA[root SYSTEM]]>'' ...@@ -299,7 +299,7 @@ console.log(view1) //'<![CDATA[root SYSTEM]]>''
setText(text: string): void setText(text: string): void
Sets **Text**. Writes a tag value.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -307,7 +307,7 @@ Sets **Text**. ...@@ -307,7 +307,7 @@ Sets **Text**.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------- | | ------ | ------ | ---- | ---------------- |
| text | string | Yes | Content of the **Text** to set.| | text | string | Yes | Tag value to write, which is the content of the **text** attribute.|
**Example** **Example**
...@@ -333,7 +333,7 @@ console.log(view1) // '<note importance="high">Happy1</note>' ...@@ -333,7 +333,7 @@ console.log(view1) // '<note importance="high">Happy1</note>'
setDocType(text: string): void setDocType(text: string): void
Sets **DocType**. Writes a document type.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
...@@ -341,7 +341,7 @@ Sets **DocType**. ...@@ -341,7 +341,7 @@ Sets **DocType**.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------- | | ------ | ------ | ---- | ------------------- |
| text | string | Yes | Content of **DocType** to set.| | text | string | Yes | Content of **DocType** to write.|
**Example** **Example**
...@@ -473,11 +473,11 @@ Defines the XML parsing options. ...@@ -473,11 +473,11 @@ Defines the XML parsing options.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------------------------ | ------------------------------------------------------------ | ---- | --------------------------------------- | | ------------------------------ | ------------------------------------------------------------ | ---- | --------------------------------------- |
| supportDoctype | boolean | No | Whether to ignore **Doctype**. The default value is **false**.| | supportDoctype | boolean | No | Whether to ignore the document type. The default value is **false**, indicating that the document type is parsed.|
| ignoreNameSpace | boolean | No | Whether to ignore **Namespace**. The default value is **false**. | | ignoreNameSpace | boolean | No | Whether to ignore the namespace. The default value is **false**, indicating that the namespace is parsed.|
| tagValueCallbackFunction | (name: string, value: string) =&gt; boolean | No | Callback used to return **tagValue**. The default value is **null**. | | tagValueCallbackFunction | (name: string, value: string) =&gt; boolean | No | Callback used to return **tagValue** for parsing the tag and tag value. The default value is **null**, indicating that the tag and tag value are not parsed. |
| attributeValueCallbackFunction | (name: string, value: string) =&gt; boolean | No | Callback used to return **attributeValue**. The default value is **null**. | | attributeValueCallbackFunction | (name: string, value: string) =&gt; boolean | No | Callback used to return **attributeValue** for parsing the attribute and attribute value. The default value is **null**, indicating that the attribute and attribute value are not parsed.|
| tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo)) =&gt; boolean | No | Callback used to return **tokenValue**. The default value is **null**. | | tokenValueCallbackFunction | (eventType: [EventType](#eventtype), value: [ParseInfo](#parseinfo)) =&gt; boolean | No | Callback used to return **tokenValue** for parsing the [EventType](#eventtype) and [ParseInfo](#parseinfo) attributes. The default value is **null**, indicating that the **EventType** and **ParseInfo** attribute are not parsed.|
## ParseInfo ## ParseInfo
...@@ -923,20 +923,20 @@ console.log(str); ...@@ -923,20 +923,20 @@ console.log(str);
## EventType ## EventType
Enumerates the events. Enumerates the event types.
**System capability**: SystemCapability.Utils.Lang **System capability**: SystemCapability.Utils.Lang
| Name | Value | Description | | Name | Value | Description |
| ---------------- | ---- | --------------------- | | ---------------- | ---- | --------------------- |
| START_DOCUMENT | 0 | Indicates a start document event. | | START_DOCUMENT | 0 | Start document event. |
| END_DOCUMENT | 1 | Indicates an end document event. | | END_DOCUMENT | 1 | End document event. |
| START_TAG | 2 | Indicates a start tag event. | | START_TAG | 2 | Start tag event. |
| END_TAG | 3 | Indicates an end tag event. | | END_TAG | 3 | End tag event. |
| TEXT | 4 | Indicates a text event. | | TEXT | 4 | Text event. |
| CDSECT | 5 | Indicates a CDATA section event. | | CDSECT | 5 | CDATA section event. |
| COMMENT | 6 | Indicates an XML comment event. | | COMMENT | 6 | XML comment event. |
| DOCDECL | 7 | Indicates an XML document type declaration event.| | DOCDECL | 7 | XML document type declaration event. |
| INSTRUCTION | 8 | Indicates an XML processing instruction event.| | INSTRUCTION | 8 | XML processing instruction event. |
| ENTITY_REFERENCE | 9 | Indicates an entity reference event. | | ENTITY_REFERENCE | 9 | Entity reference event. |
| WHITESPACE | 10 | Indicates a whitespace character event. | | WHITESPACE | 10 | Whitespace character event. |
# Multimedia Subsystem Changelog
## cl.multimedia.1 Reference Paths Changed for the Audio/Video Encapsulation and Decapsulation Header Files
| Header File | Original Reference Path | New Reference Path |
| ------------------------------- | ------------------------------------- | ------------------------------------- |
| native_avmuxer.h | <multimedia/native_avmuxer.h> | <multimedia/player_framework/native_avmuxer.h> |
| native_avdemuxer.h | <multimedia/native_avdemuxer.h> | <multimedia/player_framework/native_avdemuxer.h> |
| native_avsource.h | <multimedia/native_avsource.h> | <multimedia/player_framework/native_avsource.h> |
**Change Impact**
Applications that use the involved APIs may have compatibility issues.
**Adaptation Guide**
Modify the reference paths when referencing the encapsulation and decapsulation header files.
...@@ -14,7 +14,6 @@ The bottom-layer implementation is changed. The result value of **getAllBundleIn ...@@ -14,7 +14,6 @@ The bottom-layer implementation is changed. The result value of **getAllBundleIn
**Adaptation Guide** **Adaptation Guide**
If your application uses **getAllBundleInfo** in **@ohos.bundle.d.ts**, replace it with **getAllBundleInfo** in **@ohos.bundle.bundleManager.d.ts**. For details about how to use the new API, see [API Reference](../../../application-dev/reference/apis/js-apis-bundleManager.md#bundlemanagergetallbundleinfo). If your application uses **getAllBundleInfo** in **@ohos.bundle.d.ts**, replace it with **getAllBundleInfo** in **@ohos.bundle.bundleManager.d.ts**. For details about how to use the new API, see [API Reference](../../../application-dev/reference/apis/js-apis-bundleManager.md#bundlemanagergetallbundleinfo).
```ets ```ets
import bundleManager from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
``` ```
...@@ -34,7 +33,6 @@ The bottom-layer implementation is changed. The result value of **getAllApplicat ...@@ -34,7 +33,6 @@ The bottom-layer implementation is changed. The result value of **getAllApplicat
**Adaptation Guide** **Adaptation Guide**
If your application uses **getAllApplicationInfo** in **@ohos.bundle.d.ts**, replace it with **getAllApplicationInfo** in **@ohos.bundle.bundleManager.d.ts**. For details about how to use the new API, see [API Reference](../../../application-dev/reference/apis/js-apis-bundleManager.md#bundlemanagergetallapplicationinfo). If your application uses **getAllApplicationInfo** in **@ohos.bundle.d.ts**, replace it with **getAllApplicationInfo** in **@ohos.bundle.bundleManager.d.ts**. For details about how to use the new API, see [API Reference](../../../application-dev/reference/apis/js-apis-bundleManager.md#bundlemanagergetallapplicationinfo).
```ets ```ets
import bundleManager from '@ohos.bundle.bundleManager'; import bundleManager from '@ohos.bundle.bundleManager';
``` ```
...@@ -113,13 +111,13 @@ To use **getAdditionalInfo**, import the **bundleManager** module. ...@@ -113,13 +111,13 @@ To use **getAdditionalInfo**, import the **bundleManager** module.
import bundleManager form '@ohos.bundle.bundleManager' import bundleManager form '@ohos.bundle.bundleManager'
``` ```
## cl.bundlemanager.7 proxyDatas under Schema Renamed proxyData ## cl.bundlemanager.7 proxyDatas Renamed proxyData in the module.json5 File
**proxyDatas** is renamed **proxyData**. **proxyDatas** is renamed **proxyData**.
**Change Impact** **Change Impact**
After an update to the new image version, **proxyDatas** is renamed **proxyData**. Currently **proxyDatas** can still be used, but it will be deprecated soon. You are advised to replace **proxyDatas** with **proxyData** as soon as possible. After an update to the new SDK version, **proxyDatas** is **renamed proxyData**. If your application is not adapted, the build will fail.
**Key API/Component Changes** **Key API/Component Changes**
...@@ -127,4 +125,5 @@ After an update to the new image version, **proxyDatas** is renamed **proxyData* ...@@ -127,4 +125,5 @@ After an update to the new image version, **proxyDatas** is renamed **proxyData*
**Adaptation Guide** **Adaptation Guide**
Replace **proxyDatas** with **proxyData**. Replace **proxyDatas** with **proxyData**. The content of **proxyDatas** does not need to be changed.
\ No newline at end of file
# Bundle Management Subsystem Changelog
## cl.bundlemanager.1 schema in the module.json File Changed
In the **module.json** file, the **name** attributes of the **module**, **ability**, and **extensionAbility** fields must start with a letter and contain only letters, digits, underscores (_), and dots (.).
**Change Impact**
After an update to the new SDK version, the build fails if the **name** attributes of these fields do not meet the preceding requirements.
**Key API/Component Changes**
In the **module.json** file, the **name** attributes of the **module**, **ability**, and **extensionAbility** fields must start with a letter and contain only letters, digits, underscores (_), and dots (.).
**Adaptation Guide**
Modify the **name** attributes for these fields accordingly to the new requirements.
\ No newline at end of file
# Media Subsystem ChangeLog
## cl.media.1 Playback APIs Changed
The APIs related to audio track switching are deleted.
**Change Impact**
These APIs are unavailable.
**Key API/Component Changes**
The deleted APIs are as follows:
| Class | API |
| -------------- | ------------------------------------------------------------ |
| Media.Core | MD_KEY_LANGUAGE |
| Media.AVPlayer | selectTrack(index: number): void |
| Media.AVPlayer | deselectTrack(index: number): void |
| Media.AVPlayer | getCurrentTrack(trackType: MediaType, callback: AsyncCallback\<number>): void |
| Media.AVPlayer | getCurrentTrack(trackType: MediaType): Promise\<number> |
| Media.AVPlayer | on(type: 'trackChange', callback: (index: number, isSelect: boolean) => void): void; |
| Media.AVPlayer | off(type: 'trackChange'): void |
# Multimedia Subsystem Changelog
## cl.multimedia.1 Deleted content from getAudioEffectInfoArray
The input parameter **content** is deleted from **getAudioEffectInfoArray**.
**Change Impact**
Applications that use the involved APIs may have compatibility issues.
**Key API/Component Changes**
Before change:
```js
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage, callback: AsyncCallback<AudioEffectInfoArray>): void;
getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise<AudioEffectInfoArray>;
```
After change:
```js
getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback<AudioEffectInfoArray>): void;
getAudioEffectInfoArray(usage: StreamUsage): Promise<AudioEffectInfoArray>;
```
**Adaptation Guide**
When calling this API, pass in only the input parameter **usage**. If **getAudioEffectInfoArray** is used in your application code, delete the **content** parameter.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册