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

!3725 补齐3.1 Release中缺失的几个英文文档

Merge pull request !3725 from wusongqing/E0506V3
......@@ -3,13 +3,16 @@
- Audio
- [Audio Overview](audio-overview.md)
- [Audio Playback Development](audio-playback.md)
- [Audio Playback Development](audio-playback.md)
- [Audio Recording Development](audio-recorder.md)
- [Audio Rendering Development](audio-renderer.md)
- [Audio Rendering Development](audio-renderer.md)
- [Audio Capture Development](audio-capturer)
- Video
- [Video Playback Development](video-playback.md)
- [Video Recording Development](video-recorder.md)
- Image
- [Image Development](image.md)
# Video Recording Development
## When to Use
During video recording, audio and video signals are captured, encoded, and saved to files. You can specify parameters such as the encoding format, encapsulation format, and file path for video recording.
**Figure 1** Video recording state transition
![en-us_image_video_recorder_state_machine](figures/en-us_image_video_recorder_state_machine.png)
**Figure 2** Layer 0 diagram of video recording
![en-us_image_video_recorder_zero](figures/en-us_image_video_recorder_zero.png)
## How to Develop
For details about the APIs used for video recording, see [VideoRecorder in the Media API](../reference/apis/js-apis-media.md).
### Full-Process Scenario
The full video recording process includes creating an instance, setting recording parameters, recording video, pausing, resuming, and stopping recording, and releasing resources.
```js
import media from '@ohos.multimedia.media'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
let testFdNumber;
// pathName indicates the passed recording file name, for example, 01.mp4. The generated file address is /storage/media/100/local/files/Movies/01.mp4.
// To use the media library, declare the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA.
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
let fileAsset = await fetchFileResult.getAllObject();
let fdNumber = await fileAsset[0].open('Rw');
fdNumber = "fd://" + fdNumber.toString();
testFdNumber = fdNumber;
}
}
await getFd('01.mp4');
let videoProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : 'audio/mp4a-latm',
audioSampleRate : 48000,
fileFormat : 'mp4',
videoBitrate : 48000,
videoCodec : 'video/mp4v-es',
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let videoConfig = {
audioSourceType : 1,
videoSourceType : 0,
profile : videoProfile,
url: testFdNumber, // testFdNumber is generated by getFd.
orientationHint : 0,
location : { latitude : 30, longitude : 130 },
}
// Error callback triggered in the case of an error
function failureCallback(error) {
console.info('error happened, error name is ' + error.name);
console.info('error happened, error code is ' + error.code);
console.info('error happened, error message is ' + error.message);
}
// Error callback triggered in the case of an exception
function catchCallback(error) {
console.info('catch error happened, error name is ' + error.name);
console.info('catch error happened, error code is ' + error.code);
console.info('catch error happened, error message is ' + error.message);
}
let videoRecorder = null; // videoRecorder is an empty object and assigned with a value after createVideoRecorder is successfully called.
let surfaceID = null; // Used to save the surface ID returned by getInputSurface.
// Create a VideoRecorder object.
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
console.info('createVideoRecorder success');
} else {
console.info('createVideoRecorder failed');
}
}, failureCallback).catch(catchCallback);
// Obtain the surface ID, save it, and pass it to camera-related interfaces.
await videoRecorder.getInputSurface().then((surface) => {
console.info('getInputSurface success');
surfaceID = surface;
}, failureCallback).catch(catchCallback);
// Video recording depends on camera-related interfaces. The following operations can be performed only after the video output start interface is invoked.
// Start video recording.
await videoRecorder.start().then(() => {
console.info('start success');
}, failureCallback).catch(catchCallback);
// Pause video playback before the video output stop interface is invoked.
await videoRecorder.pause().then(() => {
console.info('pause success');
}, failureCallback).catch(catchCallback);
// Resume video playback after the video output start interface is invoked.
await videoRecorder.resume().then(() => {
console.info('resume success');
}, failureCallback).catch(catchCallback);
// Stop video recording after the video output stop interface is invoked.
await videoRecorder.stop().then(() => {
console.info('stop success');
}, failureCallback).catch(catchCallback);
// Reset the recording configuration.
await videoRecorder.reset().then(() => {
console.info('reset success');
}, failureCallback).catch(catchCallback);
// Release the video recording resources and camera object resources.
await videoRecorder.release().then(() => {
console.info('release success');
}, failureCallback).catch(catchCallback);
// Set the related object to null.
videoRecorder = null;
surfaceID = null;
```
# DataShareExtensionAbility
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> The APIs of this module are supported since API version 9. The APIs of API version 9 is of the Canary version and are for trial use only. The API call may be unstable.
Provides the Extension ability for data sharing.
## Modules to Import
```
import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility';
```
## Attributes
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
| Name| Readable| Writable| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- |
| context | Yes| No| ExtensionContext | No| Context of the Data Share Extension ability.|
## DataShareExtensionAbility.onCreate
onCreate?(want: Want): void;
Called when the Data Share Extension ability is initialized.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | Want | Yes| Connection information about the Data Share Extension ability.|
**Example**
```js
class myAbility extends DataShareExtensionAbility {
onCreate(want) {
console.log('onCreate, want:' + want.abilityName);
}
}
```
## DataShareExtensionAbility.getFileTypes
getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array\<string>>): void
Obtains the supported MIME types of a specified file. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------------------ | ---- | ---------------------------------- |
| uri | string | Yes | URI of the file. |
| mimeTypeFilter | string | Yes | MIME type of the file. |
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return the supported MIME types.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.getFileTypes(
"dataability:///com.example.DataAbility",
"image/*",
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.insert
insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback\<number>): void
Inserts a single data record into the database. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | ---------------------- | ---- | ------------------------------------------------------ |
| uri | string | Yes | URI of the data to insert. |
| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.|
| callback | AsyncCallback\<number> | Yes | Callback used to return the index of the inserted data record. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
const valueBucket = {
"name": "rose",
"age": 22,
"salary": 200.5,
"blobType": u8,
}
DAHelper.insert(
"dataability:///com.example.DataAbility",
valueBucket,
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.update
update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\<number>): void
Updates one or more data records in the database. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
| uri | string | Yes | URI of the data to update. |
| valuesBucket | rdb.ValuesBucket | Yes | New data. |
| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
| callback | AsyncCallback\<number> | Yes | Callback used to return the number of updated data records. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
const va = {
"name": "roe1",
"age": 21,
"salary": 20.5,
"blobType": u8,
}
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.update(
"dataability:///com.example.DataAbility",
va,
da,
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.delete
delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\<number>): void
Deletes one or more data records from the database. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
| uri | string | Yes | URI of the data to delete. |
| valuesBucket | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
| callback | AsyncCallback\<number> | Yes | Callback used to return the number of deleted data records. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.delete(
"dataability:///com.example.DataAbility",
da,
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.query
query?(uri: string, columns: Array\<string>, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\<ResultSet>): void
Queries data in the database. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | --------------------------------- | ---- | ------------------------------------------------ |
| uri | string | Yes | URI of the data to query. |
| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. |
| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
| callback | AsyncCallback\<ResultSet> | Yes | Callback used to return the query result. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
import ohos_data_ability from '@ohos.data.dataability'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars=new Array("value1", "value2", "value3", "value4");
let da = new ohos_data_ability.DataAbilityPredicates()
DAHelper.query(
"dataability:///com.example.DataAbility",
cars,
da,
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.getType
getType?(uri: string, callback: AsyncCallback\<string>): void
Obtains the MIME type of the data specified by a given URI. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | --------------------------------------------- |
| uri | string | Yes | URI of the data. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the MIME type.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.getType(
"dataability:///com.example.DataAbility",
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.batchInsert
batchInsert?(uri: string, valueBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback\<number>): void
Inserts multiple data records into the database. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| ------------ | ----------------------- | ---- | -------------------------------- |
| uri | string | Yes | URI of the data to insert. |
| valuesBucket | Array<rdb.ValuesBucket> | Yes | Data record to insert. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the number of inserted data records.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe12", "age": 21, "salary": 20.5, "blobType": u8,},
{"name": "roe13", "age": 21, "salary": 20.5, "blobType": u8,})
DAHelper.batchInsert(
"dataability:///com.example.DataAbility",
cars,
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.normalizeUri
normalizeUri?(uri: string, callback: AsyncCallback\<string>): void
Converts the URI that refers to the Data ability into a normalized URI. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| uri | string | Yes | URI object to normalize. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.normalizeUri(
"dataability:///com.example.DataAbility",
(err, data) => {
console.info("==========================>Called=======================>");
});
```
## DataShareExtensionAbility.denormalizeUri
denormalizeUri?(uri: string, callback: AsyncCallback\<string>): void
Converts a normalized URI generated by **normalizeUri** to a denormalized one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | --------------------------------------------------- |
| uri | string | Yes | URI object to denormalize. |
| callback | AsyncCallback\<string> | Yes | Callback used to return the denormalized URI object.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.denormalizeUri(
"dataability:///com.example.DataAbility",
(err, data) => {
console.info("==========================>Called=======================>");
});
```
# StartOptions
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> The initial APIs of this module are supported since API version 9. The APIs of API version 9 is of the Canary version and are for trial use only. The API call may be unstable.
**StartOptions** is the basic communication component of the system.
## Modules to Import
```
import StartOptions from '@ohos.application.StartOptions';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Readable| Writable| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- |
| windowMode | Yes| No| number | No| Window mode.|
| displayId | Yes| No| number | No| Display ID.|
此差异已折叠。
# JS API Differences
This document describes the changes of APIs in OpenHarmony 2.2 Beta2 over OpenHarmony 2.0 Canary.
## Standard System API Changes
| Module | API | Change Type | Change Description |
| -------- | -------- | -------- | -------- |
| Time, date, and digit module - Locale | constructor(locale: string, options?:options) | Added | - |
| Time, date, and digit module - Locale | toString(): string | Added | - |
| Time, date, and digit module - Locale | maximize(): Locale | Added | - |
| Time, date, and digit module - Locale | minimize(): Locale | Added | - |
| Time, date, and digit module - Locale | calendar | Added | - |
| Time, date, and digit module - Locale | caseFirst | Added | - |
| Time, date, and digit module - Locale | collation | Added | - |
| Time, date, and digit module - Locale | hourCycle | Added | - |
| Time, date, and digit module - Locale | numberingSystem | Added | - |
| Time, date, and digit module - Locale | numeric | Added | - |
| Time, date, and digit module - Locale | language | Added | - |
| Time, date, and digit module - Locale | script | Added | - |
| Time, date, and digit module - Locale | region | Added | - |
| Time, date, and digit module - Locale | baseName | Added | - |
| Time, date, and digit module - DateTimeFormat | constructor(locale: string, options?:options) | Added | - |
| Time, date, and digit module - DateTimeFormat | constructor(locale: string[], options?:options) | Added | - |
| Time, date, and digit module - DateTimeFormat | resolvedOptions(): DateTimeOptions | Added | - |
| Time, date, and digit module - DateTimeFormat | format(date: Date): string; | Added | - |
| Time, date, and digit module - DateTimeFormat | formatRange(fromDate: Date, toDate: Date): string; | Added | - |
| Time, date, and digit module - NumberFormat | constructor(locale: string, options?:options) | Added | - |
| Time, date, and digit module - NumberFormat | constructor(locale: string[], options?:options) | Added | - |
| Time, date, and digit module - NumberFormat | resolvedOptions(): NumberOptions | Added | - |
| Time, date, and digit module - NumberFormat | format(number: number): string; | Added | - |
| Time, date, and digit module - DateTimeOptions | locale | Added | - |
| Time, date, and digit module - DateTimeOptions | dateStyle | Added | - |
| Time, date, and digit module - DateTimeOptions | timeStyle | Added | - |
| Time, date, and digit module - DateTimeOptions | calendar | Added | - |
| Time, date, and digit module - DateTimeOptions | dayPeriod | Added | - |
| Time, date, and digit module - DateTimeOptions | numberingSystem | Added | - |
| Time, date, and digit module - DateTimeOptions | localeMatcher | Added | - |
| Time, date, and digit module - DateTimeOptions | timeZone | Added | - |
| Time, date, and digit module - DateTimeOptions | hour12 | Added | - |
| Time, date, and digit module - DateTimeOptions | hourCycle | Added | - |
| Time, date, and digit module - DateTimeOptions | formatMatcher | Added | - |
| Time, date, and digit module - DateTimeOptions | weekday | Added | - |
| Time, date, and digit module - DateTimeOptions | era | Added | - |
| Time, date, and digit module - DateTimeOptions | year | Added | - |
| Time, date, and digit module - DateTimeOptions | month | Added | - |
| Time, date, and digit module - DateTimeOptions | day | Added | - |
| Time, date, and digit module - DateTimeOptions | hour | Added | - |
| Time, date, and digit module - DateTimeOptions | minute | Added | - |
| Time, date, and digit module - DateTimeOptions | second | Added | - |
| Time, date, and digit module - DateTimeOptions | timeZoneName | Added | - |
| Time, date, and digit module - NumberOptions | locale | Added | - |
| Time, date, and digit module - NumberOptions | compactDisplay | Added | - |
| Time, date, and digit module - NumberOptions | currency | Added | - |
| Time, date, and digit module - NumberOptions | currencyDisplay | Added | - |
| Time, date, and digit module - NumberOptions | currencySign | Added | - |
| Time, date, and digit module - NumberOptions | localeMatcher | Added | - |
| Time, date, and digit module - NumberOptions | notation | Added | - |
| Time, date, and digit module - NumberOptions | numberingSystem | Added | - |
| Time, date, and digit module - NumberOptions | signDisplay | Added | - |
| Time, date, and digit module - NumberOptions | style | Added | - |
| Time, date, and digit module - NumberOptions | unit | Added | - |
| Time, date, and digit module - NumberOptions | unitDisplay | Added | - |
| Time, date, and digit module - NumberOptions | useGrouping | Added | - |
| Time, date, and digit module - NumberOptions | minimumIntegerDigits | Added | - |
| Time, date, and digit module - NumberOptions | minimumFractionDigits | Added | - |
| Time, date, and digit module - NumberOptions | maximumFractionDigits | Added | - |
| Time, date, and digit module - NumberOptions | minimumSignificantDigits | Added | - |
| Time, date, and digit module - NumberOptions | maximumSignificantDigits | Added | - |
|File storage - system.file|mkdir|Added|-|
|File storage - system.file|rmdir|Added|-|
|File storage - system.file|get|Added|-|
|File storage - system.file|list|Added|-|
|File storage - system.file|copy|Added|-|
|File storage - system.file|move|Added|-|
|File storage - system.file|delete|Added|-|
|File storage - system.file|access|Added|-|
|File storage - system.file|writeText|Added|-|
|File storage - system.file|writeArrayBuffer|Added|-|
|File storage - system.file|readText|Added|-|
|File storage - system.file|readArrayBuffer|Added|-|
|File storage - fileio|Dir.readSync|Added|-|
|File storage - fileio|Dir.closeSync|Added|-|
|File storage - fileio|dirent.name|Added|-|
|File storage - fileio|dirent.isBlockDevice()|Added|-|
|File storage - fileio|dirent.isCharacterDevice()|Added|-|
|File storage - fileio|dirent.isDirectory()|Added|-|
|File storage - fileio|dirent.isFIFO()|Added|-|
|File storage - fileio|dirent.isFile()|Added|-|
|File storage - fileio|dirent.isSocket()|Added|-|
|File storage - fileio|dirent.isSymbolicLink()|Added|-|
|File storage - fileio|stat.dev|Added|-|
|File storage - fileio|stat.ino|Added|-|
|File storage - fileio|stat.mode|Added|-|
|File storage - fileio|stat.nlink|Added|-|
|File storage - fileio|stat.uid|Added|-|
|File storage - fileio|stat.gid|Added|-|
|File storage - fileio|stat.rdev|Added|-|
|File storage - fileio|stat.size|Added|-|
|File storage - fileio|stat.blocks|Added|-|
|File storage - fileio|stat.atime|Added|-|
|File storage - fileio|stat.mtime|Added|-|
|File storage - fileio|stat.ctime|Added|-|
|File storage - fileio|stat.isBlockDevice()|Added|-|
|File storage - fileio|stat.isCharacterDevice()|Added|-|
|File storage - fileio|stat.isDirectory()|Added|-|
|File storage - fileio|stat.isFIFO()|Added|-|
|File storage - fileio|stat.isFile()|Added|-|
|File storage - fileio|stat.isSocket()|Added|-|
|File storage - fileio|stat.isSymbolicLink()|Added|-|
|File storage - fileio|Stream.flushSync()|Added|-|
|File storage - fileio|Stream.writeSync()|Added|-|
|File storage - fileio|Stream.readSync()|Added|-|
|File storage - fileio|Stream.closeSync()|Added|-|
|File storage - fileio|fileio.accessSync()|Added|-|
|File storage - fileio|fileio.chmodSync()|Added|-|
|File storage - fileio|fileio.chownSync()|Added|-|
|File storage - fileio|fileio.closeSync()|Added|-|
|File storage - fileio|fileio.copyFileSync()|Added|-|
|File storage - fileio|fileio.createStreamSync()|Added|-|
|File storage - fileio|fileio.fchmodSync()|Added|-|
|File storage - fileio|fileio.fchownSync()|Added|-|
|File storage - fileio|fileio.fdopenStreamSync()|Added|-|
|File storage - fileio|fileio.fstatSync()|Added|-|
|File storage - fileio|fileio.fsyncSync()|Added|-|
|File storage - fileio|fileio.ftruncateSync()|Added|-|
|File storage - fileio|fileio.mkdirSync()|Added|-|
|File storage - fileio|fileio.openSync()|Added|-|
|File storage - fileio|fileio.opendirSync()|Added|-|
|File storage - fileio|fileio.readSync()|Added|-|
|File storage - fileio|fileio.renameSync()|Added|-|
|File storage - fileio|fileio.rmdirSync()|Added|-|
|File storage - fileio|fileio.statSync()|Added|-|
|File storage - fileio|fileio.truncateSync()|Added|-|
|File storage - fileio|fileio.unlinkSync()|Added|-|
|File storage - fileio|fileio.writeSync()|Added|-|
|Device management - DeviceManager|DeviceInfo|Added|-|
|Device management - DeviceManager|DeviceType|Added|-|
|Device management - DeviceManager|DeviceStateChangeAction|Added|-|
|Device management - DeviceManager|SubscribeInfo|Added|-|
|Device management - DeviceManager|DiscoverMode|Added|-|
|Device management - DeviceManager|ExchangeMedium|Added|-|
|Device management - DeviceManager|ExchangeFreq|Added|-|
|Device management - DeviceManager|SubscribeCap|Added|-|
|Device management - DeviceManager|createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void|Added|-|
|Device management - DeviceManager|release(): void|Added|-|
|Device management - DeviceManager|getTrustedDeviceListSync(): Array<DeviceInfo>|Added|-|
|Device management - DeviceManager|startDeviceDiscovery(subscribeInfo: SubscribeInfo): void|Added|-|
|Device management - DeviceManager|stopDeviceDiscovery(subscribeId: number): void|Added|-|
|Device management - DeviceManager|authenticateDevice(deviceInfo: DeviceInfo): void|Added|-|
|Device management - DeviceManager|on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void|Added|-|
|Device management - DeviceManager|off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void|Added|-|
|Device management - DeviceManager|on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void|Added|-|
|Device management - DeviceManager|off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void|Added|-|
|Device management - DeviceManager|on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void|Added|-|
|Device management - DeviceManager|off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void|Added|-|
|Device management - DeviceManager|on(type: 'authResult', callback: Callback<{ deviceId: string, status: number, reason: number }>): void|Added|-|
|Device management - DeviceManager|off(type: 'authResult', callback?: Callback<{ deviceId: string, status: number, reason: number }>): void|Added|-|
|Device management - DeviceManager|on(type: 'serviceDie', callback: () => void): void|Added|-|
|Device management - DeviceManager|off(type: 'serviceDie', callback?: () => void): void|Added|-|
|Playback and recording|createAudioPlayer(): AudioPlayer|Added|-|
|Playback and recording|AudioState|Added|-|
|Playback and recording|play(): void|Added|-|
|Playback and recording|pause(): void|Added|-|
|Playback and recording|stop(): void|Added|-|
|Playback and recording|seek(timeMs: number): void|Added|-|
|Playback and recording|setVolume(vol: number): void|Added|-|
|Playback and recording|reset(): void|Added|-|
|Playback and recording|release(): void|Added|-|
|Playback and recording|src: string|Added|-|
|Playback and recording|loop: boolean|Added|-|
|Playback and recording|readonly currentTime: number|Added|-|
|Playback and recording|readonly duration: number|Added|-|
|Playback and recording|readonly state: AudioState|Added|-|
|Playback and recording|on(type: 'play' / 'pause' / 'stop' / 'reset' / 'dataLoad' / 'finish' / 'volumeChange', callback: () => void): void|Added|-|
|Playback and recording|on(type: 'timeUpdate', callback: Callback<number>): void|Added|-|
|Playback and recording|on(type: 'error', callback: ErrorCallback): void|Added|-|
|Audio management|getAudioManager(): AudioManager|Added|-|
|Audio management|AudioVolumeType|Added|-|
|Audio management|MEDIA|Added|-|
|Audio management|RINGTONE|Added|-|
|Audio management|DeviceFlag|Added|-|
|Audio management|OUTPUT_DEVICES_FLAG|Added|-|
|Audio management|INPUT_DEVICES_FLAG |Added|-|
|Audio management|ALL_DEVICES_FLAG |Added|-|
|Audio management|DeviceRole |Added|-|
|Audio management|INPUT_DEVICE |Added|-|
|Audio management|OUTPUT_DEVICE |Added|-|
|Audio management|DeviceType |Added|-|
|Audio management|INVALID |Added|-|
|Audio management|SPEAKER |Added|-|
|Audio management|WIRED_HEADSET |Added|-|
|Audio management|BLUETOOTH_SCO |Added|-|
|Audio management|BLUETOOTH_A2DP |Added|-|
|Audio management|MIC|Added|-|
|Audio management|AudioRingMode |Added|-|
|Audio management|RINGER_MODE_NORMAL |Added|-|
|Audio management|RINGER_MODE_SILENT|Added|-|
|Audio management|RINGER_MODE_VIBRATE |Added|-|
|Audio management|setVolume(audioType: AudioVolumeType, volume: number,callback: AsyncCallback<void>): void|Added|-|
|Audio management|setVolume(audioType: AudioVolumeType, volume: number): Promise<void>|Added|-|
|Audio management|getVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void|Added|-|
|Audio management|getVolume(audioType: AudioVolumeType): Promise<number>|Added|-|
|Audio management|getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void|Added|-|
|Audio management|getMinVolume(audioType: AudioVolumeType): Promise<number>|Added|-|
|Audio management|getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback<number>): void|Added|-|
|Audio management|getMaxVolume(audioType: AudioVolumeType): Promise<number>|Added|-|
|Audio management|getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback<AudioDeviceDescriptors>): void|Added|-|
|Audio management|getDevices(deviceFlag: DeviceFlag): Promise<AudioDeviceDescriptors>|Added|-|
|Audio management|getRingerMode(callback: AsyncCallback<AudioRingMode>): void|Added|-|
|Audio management|getRingerMode(): Promise<AudioRingMode>|Added|-|
|Audio management|setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void|Added|-|
|Audio management|setRingerMode(mode: AudioRingMode): Promise<void>|Added|-|
|Audio management|isMute(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void|Added|-|
|Audio management|isMute(volumeType: AudioVolumeType): Promise<boolean>|Added|-|
|Audio management|isActive(volumeType: AudioVolumeType, callback: AsyncCallback<boolean>): void|Added|-|
|Audio management|isActive(volumeType: AudioVolumeType): Promise<boolean>|Added|-|
|Audio management|isMicrophoneMute(callback: AsyncCallback<boolean>): void|Added|-|
|Audio management|isMicrophoneMute(): Promise<boolean>|Added|-|
|Audio management|mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void>) : void|Added|-|
|Audio management|mute(volumeType: AudioVolumeType, mute: boolean): Promise<void>|Added|-|
|Audio management|setMicrophoneMute(mute: boolean, callback: AsyncCallback<void>): void|Added|-|
|Audio management|setMicrophoneMute(mute: boolean): Promise<void>|Added|-|
|Audio management|isDeviceActive(deviceType: DeviceType, callback: AsyncCallback<boolean>): void|Added|-|
|Audio management|isDeviceActive(deviceType: DeviceType): Promise<boolean>|Added|-|
|Audio management|setDeviceActive(deviceType: DeviceType, active: boolean, callback: AsyncCallback<boolean>): void|Added|-|
|Audio management|setDeviceActive(deviceType: DeviceType, active: boolean): Promise<boolean>|Added|-|
|Audio management|getAudioParameter(key: string, callback: AsyncCallback<string>): void|Added|-|
|Audio management|getAudioParameter(key: string): Promise<string>|Added|-|
|Audio management|setAudioParameter(key: string, value: string, callback: AsyncCallback<void>): void|Added|-|
|Audio management|setAudioParameter(key: string, value: string): Promise<void>|Added|-|
|Audio management|AudioDeviceDescriptor|Added|-|
|Audio management|readonly deviceRole: DeviceRole|Added|-|
|Audio management|readonly deviceType: DeviceType|Added|-|
|Audio management|AudioDeviceDescriptors |Added|-|
# Native API Differences
This document describes the changes of APIs in OpenHarmony 2.2 Beta2 over OpenHarmony 2.0 Canary.
## Mini System API Changes
| Module | API | Change Type | Change Type |
| -------- | -------- | -------- | -------- |
| global_i18n_lite | static LocaleInfo LocaleInfo ::ForLanguageTag(const char *languageTag, I18nStatus &status); | Added | API added. |
| global_i18n_lite | const char LocaleInfo ::*GetExtension(const char *key); | Added | API added. |
| global_i18n_lite | WeekInfo::WeekInfo(const LocaleInfo &localeInfo, I18nStatus &status); | Added | API added. |
| global_i18n_lite | uint8_t WeekInfo::GetFirstDayOfWeek(); | Added | API added. |
| global_i18n_lite | uint8_t WeekInfo::GetMinimalDaysInFirstWeek(); | Added | API added. |
| global_i18n_lite | uint8_t WeekInfo::GetFirstDayOfWeekend(); | Added | API added. |
| global_i18n_lite | uint8_t WeekInfo::GetLastDayOfWeekend(); | Added | API added. |
| global_i18n_lite | int PluralFormat::GetPluralRuleIndex(double number, I18nStatus status); | Added | API added. |
| powermgr_powermgr_lite | const RunningLock *CreateRunningLock(const char *name, RunningLockType type, RunningLockFlag flag); | Added | API added. |
| powermgr_powermgr_lite | void DestroyRunningLock(const RunningLock *lock); | Added | API added. |
| powermgr_powermgr_lite | BOOL AcquireRunningLock(const RunningLock *lock); | Added | API added. |
| powermgr_powermgr_lite | BOOL ReleaseRunningLock(const RunningLock *lock); | Added | API added. |
| powermgr_powermgr_lite | BOOL IsRunningLockHolding(const RunningLock *lock); | Added | API added. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册