提交 c12d56ca 编写于 作者: W wusongqing

updated medialibrary api

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 3a7535dc
# 接口
- Ability框架
- [@ohos.ability.dataUriUtils (DataUriUtils模块)](js-apis-DataUriUtils.md)
- [@ohos.ability.errorCode (ErrorCode)](js-apis-ability-errorCode.md)
- [@ohos.ability.wantConstant (wantConstant)](js-apis-ability-wantConstant.md)
- [@ohos.application.Ability (Ability)](js-apis-application-ability.md)
- [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md)
- [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](js-apis-abilityDelegatorRegistry.md)
- [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilitystage.md)
- [@ohos.application.appManager (appManager)](js-apis-appmanager.md)
- [@ohos.application.Configuration (Configuration)](js-apis-configuration.md)
- [@ohos.application.ConfigurationConstant (ConfigurationConstant)](js-apis-configurationconstant.md)
- [@ohos.application.DataShareExtensionAbility (DataShareExtensionAbility)](js-apis-application-DataShareExtensionAbility.md)
- [@ohos.ability.featureAbility (FeatureAbility模块)](js-apis-featureAbility.md)
- [@ohos.application.formBindingData (卡片数据绑定类)](js-apis-formbindingdata.md)
- [@ohos.application.FormExtension (FormExtension)](js-apis-formextension.md)
- [@ohos.application.formError (FormError)](js-apis-formerror.md)
- [@ohos.application.formHost (FormHost)](js-apis-formhost.md)
- [@ohos.application.formInfo (FormInfo)](js-apis-formInfo.md)
- [@ohos.application.missionManager (missionManager)](js-apis-missionManager.md)
- [@ohos.application.formProvider (FormProvider)](js-apis-formprovider.md)
- [@ohos.ability.particleAbility (particleAbility模块)](js-apis-particleAbility.md)
- [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-service-extension-ability.md)
- [@ohos.application.StartOptions (StartOptions)](js-apis-application-StartOptions.md)
- [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md)
- [@ohos.application.uriPermissionManager (uriPermissionManager)](js-apis-uripermissionmanager.md)
- [@ohos.application.Want (Want)](js-apis-application-Want.md)
- [@ohos.wantAgent (WantAgent模块)](js-apis-wantAgent.md)
- ability/[dataAbilityHelper (DataAbilityHelper模块)](js-apis-dataAbilityHelper.md)
- app/[context (Context模块)](js-apis-Context.md)
- application/[AbilityContext (AbilityContext)](js-apis-ability-context.md)
- application/[abilityDelegator (AbilityDelegator)](js-apis-application-abilityDelegator.md)
- application/[abilityDelegatorArgs (AbilityDelegatorArgs)](js-apis-application-abilityDelegatorArgs.md)
- application/[abilityMonitor (AbilityMonitor)](js-apis-application-abilityMonitor.md)
- application/[AbilityRunningInfo (AbilityRunningInfo)](js-apis-abilityrunninginfo.md)
- application/[AbilityStageContext (AbilityStageContext)](js-apis-abilitystagecontext.md)
- application/[Context (Context)](js-apis-application-context.md)
- application/[ExtensionContext (ExtensionContext)](js-apis-extension-context.md)
- application/[ExtensionRunningInfo (ExtensionRunningInfo)](js-apis-extensionrunninginfo.md)
- application/[FormExtensionContext (FormExtensionContext)](js-apis-formextensioncontext.md)
- application/[MissionSnapshot (MissionSnapshot)](js-apis-application-MissionSnapshot.md)
- application/[PermissionRequestResult (PermissionRequestResult)](js-apis-permissionrequestresult.md)
- application/[ProcessRunningInfo (ProcessRunningInfo)](js-apis-processrunninginfo.md)
- application/[ServiceExtensionContext (ServiceExtensionContext)](js-apis-service-extension-context.md)
- application/[shellCmdResult (ShellCmdResult)](js-apis-application-shellCmdResult.md)
- 公共事件与通知
- [@ohos.commonEvent (公共事件模块)](js-apis-commonEvent.md)
- [@ohos.events.emitter (Emitter)](js-apis-emitter.md)
- [@ohos.notification (Notification模块)](js-apis-notification.md)
- [@ohos.reminderAgent (后台代理提醒)](js-apis-reminderAgent.md)
- application/[EventHub (EventHub)](js-apis-eventhub.md)
- 应用程序包管理
- [@ohos.bundle (Bundle模块)](js-apis-Bundle.md)
- [@ohos.bundleState (设备使用信息统计)](js-apis-deviceUsageStatistics.md)
- [@ohos.zlib (Zip模块)](js-apis-zlib.md)
- UI界面
- [@ohos.animator (动画)](js-apis-animator.md)
- [@ohos.mediaquery (媒体查询)](js-apis-mediaquery.md)
- [@ohos.prompt (弹窗)](js-apis-prompt.md)
- [@ohos.router (页面路由)](js-apis-router.md)
- 图形图像
- [@ohos.display (屏幕属性)](js-apis-display.md)
- [@ohos.screenshot (屏幕截图)](js-apis-screenshot.md)
- [@ohos.window (窗口)](js-apis-window.md)
- [webgl (WebGL)](js-apis-webgl.md)
- [webgl2 (WebGL2)](js-apis-webgl2.md)
- 媒体
- [@ohos.multimedia.audio (音频管理)](js-apis-audio.md)
- [@ohos.multimedia.camera (相机管理)](js-apis-camera.md)
- [@ohos.multimedia.image (图片处理)](js-apis-image.md)
- [@ohos.multimedia.media (媒体服务)](js-apis-media.md)
- [@ohos.multimedia.medialibrary (媒体库管理)](js-apis-medialibrary.md)
- 资源管理
- [@ohos.i18n (国际化-I18n)](js-apis-i18n.md)
- [@ohos.intl (国际化-Intl)](js-apis-intl.md)
- [@ohos.resourceManager (资源管理)](js-apis-resource-manager.md)
- 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler (延迟任务调度)](js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager (企业设备管理)](js-apis-enterprise-device-manager.md)
- 安全
- [@ohos.abilityAccessCtrl (访问控制管理)](js-apis-abilityAccessCtrl.md)
- [@ohos.security.huks (通用密钥库系统)](js-apis-huks.md)
- [@ohos.userIAM.userAuth (用户认证)](js-apis-useriam-userauth.md)
- [@system.cipher (加密算法)](js-apis-system-cipher.md)
- 数据管理
- [@ohos.data.dataAbility (DataAbility谓词)](js-apis-data-ability.md)
- [@ohos.data.distributedData (分布式数据管理)](js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject (分布式数据对象)](js-apis-data-distributedobject.md)
- [@ohos.data.preferences (轻量级存储)](js-apis-data-preferences.md)
- [@ohos.data.rdb (关系型数据库)](js-apis-data-rdb.md)
- [@ohos.settings (设置数据项名称)](js-apis-settings.md)
- data/rdb/[resultSet (结果集)](js-apis-data-resultset.md)
- 文件管理
- [@ohos.environment (目录环境能力)](js-apis-environment.md)
- [@ohos.fileio (文件管理)](js-apis-fileio.md)
- [@ohos.fileManager (公共文件访问与管理)](js-apis-filemanager.md)
- [@ohos.statfs (statfs)](js-apis-statfs.md)
- [@ohos.storageStatistics (应用空间统计)](js-apis-storage-statistics.md)
- [@ohos.volumeManager (卷管理)](js-apis-volumemanager.md)
- 电话服务
- [@ohos.contact (联系人)](js-apis-contact.md)
- [@ohos.telephony.call (拨打电话)](js-apis-call.md)
- [@ohos.telephony.observer (observer)](js-apis-observer.md)
- [@ohos.telephony.radio (网络搜索)](js-apis-radio.md)
- [@ohos.telephony.sim (SIM卡管理)](js-apis-sim.md)
- [@ohos.telephony.sms (短信服务)](js-apis-sms.md)
- [@ohos.telephony.data (蜂窝数据)](js-apis-telephony-data.md)
- 网络管理
- [@ohos.net.connection (网络连接管理)](js-apis-net-connection.md)
- [@ohos.net.http (数据请求)](js-apis-http.md)
- [@ohos.request (上传下载)](js-apis-request.md)
- [@ohos.net.socket (Socket连接)](js-apis-socket.md)
- [@ohos.net.webSocket (WebSocket连接)](js-apis-webSocket.md)
- 通信与连接
- [@ohos.bluetooth (蓝牙)](js-apis-bluetooth.md)
- [@ohos.connectedTag (有源标签)](js-apis-connectedTag.md)
- [@ohos.rpc (RPC通信)](js-apis-rpc.md)
- [@ohos.wifi (WLAN)](js-apis-wifi.md)
- [@ohos.wifiext (WLAN)](js-apis-wifiext.md)
- 系统基础能力
- [@ohos.accessibility (辅助功能)](js-apis-accessibility.md)
- [@ohos.faultLogger (故障日志获取)](js-apis-faultLogger.md)
- [@ohos.hiAppEvent (应用打点)](js-apis-hiappevent.md)
- [@ohos.hichecker (检测模式)](js-apis-hichecker.md)
- [@ohos.hidebug (Debug调试)](js-apis-hidebug.md)
- [@ohos.hilog (日志打印)](js-apis-hilog.md)
- [@ohos.hiTraceChain (分布式跟踪)](js-apis-hitracechain.md)
- [@ohos.hiTraceMeter (性能打点)](js-apis-hitracemeter.md)
- [@ohos.inputMethod (输入法框架)](js-apis-inputmethod.md)
- [@ohos.inputMethodEngine (输入法服务)](js-apis-inputmethodengine.md)
- [@ohos.pasteboard (剪贴板)](js-apis-pasteboard.md)
- [@ohos.screenLock (锁屏管理)](js-apis-screen-lock.md)
- [@ohos.systemTime (设置系统时间)](js-apis-system-time.md)
- [@ohos.wallpaper (壁纸)](js-apis-wallpaper.md)
- [Timer (定时器)](js-apis-timer.md)
- 设备管理
- [@ohos.batteryInfo (电量信息)](js-apis-battery-info.md)
- [@ohos.brightness (屏幕亮度)](js-apis-brightness.md)
- [@ohos.deviceInfo (设备信息)](js-apis-device-info.md)
- [@ohos.distributedHardware.deviceManager (设备管理)](js-apis-device-manager.md)
- [@ohos.geolocation (位置服务)](js-apis-geolocation.md)
- [@ohos.multimodalInput.inputConsumer (组合按键)](js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice (输入设备)](js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputEventClient (注入按键)](js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputMonitor (输入监听)](js-apis-inputmonitor.md)
- [@ohos.power (系统电源管理)](js-apis-power.md)
- [@ohos.runningLock (Runninglock锁)](js-apis-runninglock.md)
- [@ohos.sensor (传感器)](js-apis-sensor.md)
- [@ohos.systemParameter (系统属性)](js-apis-system-parameter.md)
- [@ohos.thermal (热管理)](js-apis-thermal.md)
- [@ohos.update (升级)](js-apis-update.md)
- [@ohos.usb (USB管理)](js-apis-usb.md)
- [@ohos.vibrator (振动)](js-apis-vibrator.md)
- 帐号管理
- [@ohos.account.appAccount (应用帐号管理)](js-apis-appAccount.md)
- [@ohos.account.distributedAccount (分布式帐号管理)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (系统帐号管理)](js-apis-osAccount.md)
- 语言基础类库
- [@ohos.convertxml (xml转换JavaScript)](js-apis-convertxml.md)
- [@ohos.process (获取进程相关的信息)](js-apis-process.md)
- [@ohos.uri (URI字符串解析)](js-apis-uri.md)
- [@ohos.url (URL字符串解析)](js-apis-url.md)
- [@ohos.util (util工具函数)](js-apis-util.md)
- [@ohos.util.ArrayList (线性容器ArrayList)](js-apis-arraylist.md)
- [@ohos.util.Deque (线性容器Deque)](js-apis-deque.md)
- [@ohos.util.HashMap (非线性容器HashMap)](js-apis-hashmap.md)
- [@ohos.util.HashSet (非线性容器HashSet)](js-apis-hashset.md)
- [@ohos.util.LightWeightMap (非线性容器LightWeightMap)](js-apis-lightweightmap.md)
- [@ohos.util.LightWeightSet (非线性容器LightWeightSet)](js-apis-lightweightset.md)
- [@ohos.util.LinkedList (线性容器LinkedList)](js-apis-linkedlist.md)
- [@ohos.util.List (线性容器List)](js-apis-list.md)
- [@ohos.util.PlainArray (非线性容器PlainArray)](js-apis-plainarray.md)
- [@ohos.util.Queue (线性容器Queue)](js-apis-queue.md)
- [@ohos.util.Stack (线性容器Stack)](js-apis-stack.md)
- [@ohos.util.TreeMap (非线性容器TreeMap)](js-apis-treemap.md)
- [@ohos.util.TreeSet (非线性容器TreeSet)](js-apis-treeset.md)
- [@ohos.util.Vector (线性容器Vector)](js-apis-vector.md)
- [@ohos.worker (启动一个Worker)](js-apis-worker.md)
- [@ohos.xml (xml解析与生成)](js-apis-xml.md)
- 测试
- [@ohos.application.testRunner (TestRunner)](js-apis-testRunner.md)
- [@ohos.uitest (UiTest)](js-apis-uitest.md)
- 已停止维护的接口
- [@ohos.bytrace (性能打点)](js-apis-bytrace.md)
- [@ohos.data.storage (轻量级存储)](js-apis-data-storage.md)
- [@system.app (应用上下文)](js-apis-system-app.md)
- [@system.battery (电量信息)](js-apis-system-battery.md)
- [@system.bluetooth (蓝牙)](js-apis-system-bluetooth.md)
- [@system.brightness (屏幕亮度)](js-apis-system-brightness.md)
- [@system.configuration (应用配置)](js-apis-system-configuration.md)
- [@system.device (设备信息)](js-apis-system-device.md)
- [@system.fetch (数据请求)](js-apis-system-fetch.md)
- [@system.file (文件存储)](js-apis-system-file.md)
- [@system.geolocation (地理位置)](js-apis-system-location.md)
- [@system.mediaquery (媒体查询)](js-apis-system-mediaquery.md)
- [@system.network (网络状态)](js-apis-system-network.md)
- [@system.notification (通知消息)](js-apis-system-notification.md)
- [@system.package (应用管理)](js-apis-system-package.md)
- [@system.prompt (弹窗)](js-apis-system-prompt.md)
- [@system.request (上传下载)](js-apis-system-request.md)
- [@system.router (页面路由)](js-apis-system-router.md)
- [@system.sensor (传感器)](js-apis-system-sensor.md)
- [@system.storage (数据存储)](js-apis-system-storage.md)
- [@system.vibrator (振动)](js-apis-system-vibrate.md)
- [console (日志打印)](js-apis-logs.md)
\ No newline at end of file
......@@ -458,9 +458,9 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
```
let option = {
src : "file:///data/data/ohos.xxx.yyy/files/image.png",
mimeType : "image/jpeg",
relativePath : "imageDir/image2/"
src : "/data/storage/el2/base/haps/entry/image.png",
mimeType : "image/*",
relativePath : "Pictures/"
};
mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => {
if (err) {
......@@ -499,9 +499,9 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
```
let option = {
src : "file:///data/data/ohos.xxx.yyy/files/image.jpg",
mimeType : "image/jpeg",
relativePath : "imageDir/image2/"
src : "/data/storage/el2/base/haps/entry/image.png",
mimeType : "image/*",
relativePath : "Pictures/"
};
mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => {
console.log("Media asset stored.");
......@@ -534,8 +534,8 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
```
let images = [
"dataability:///media/external/images/media/50",
"dataability:///media/external/images/media/55"
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
];
/* Online image usage mode
let images = [
......@@ -575,8 +575,8 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
```
let images = [
"dataability:///media/external/images/media/50",
"dataability:///media/external/images/media/55"
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
];
/* Online image usage mode
let images = [
......@@ -621,8 +621,8 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
```
let images = [
"dataability:///media/external/images/media/50",
"dataability:///media/external/images/media/55"
"dataability:///media/xxxx/2",
"dataability:///media/xxxx/3"
];
/* Online image usage mode
let images = [
......@@ -720,7 +720,7 @@ Provides APIs for encapsulating file asset attributes.
**System capability**: SystemCapability.Multimedia.MediaLibrary.Core
| Name | Type | Readable| Writable| Description |
| Name | Type | Readable | Writable | Description |
| ------------------------- | ------------------------ | ---- | ---- | ------------------------------------------------------ |
| id | number | Yes | No | File asset ID. |
| uri | string | Yes | No | File asset URI, for example, dataability:///media/image/2. |
......@@ -738,7 +738,7 @@ Provides APIs for encapsulating file asset attributes.
| audioAlbum<sup>8+</sup> | string | Yes | No | Audio album. |
| width | number | Yes | No | Image width, in pixels. |
| height | number | Yes | No | Image height, in pixels. |
| orientation | number | Yes | Yes | Image display direction (clockwise rotation angle, for example, 0, 90, or 180, in degrees).|
| orientation | number | Yes | Yes | Image display direction (clockwise rotation angle, for example, 0, 90, or 180, in degrees). |
| duration<sup>8+</sup> | number | Yes | No | Duration, in seconds. |
| albumId | number | Yes | No | ID of the album to which the file belongs. |
| albumUri<sup>8+</sup> | string | Yes | No | URI of the album to which the file belongs. |
......@@ -757,9 +757,9 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal
**Parameters**
| Name | Type | Mandatory | Description |
| Parameter | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the file asset is a directory.|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return whether the file asset is a directory. |
**Example**
......@@ -2002,7 +2002,7 @@ async function example() {
commitModify(): Promise&lt;void&gt;
Commits the modification of the album attributes to the database. This API uses a promise to return the result.
Commits the modification of the album attributes to the database. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA
......@@ -2229,9 +2229,9 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory | Description |
| ------------ | ------ | ---- | ---------------------------------------- |
| src | string | Yes | URI of the media library. |
| mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>Example: 'image/\*' and 'video/\*'.|
| relativePath | string | No | Custom path for storing media assets. If this parameter is unspecified, media assets are stored in the default path. For example, if you set this parameter to **imageDir/image2/**, the media assets will be stored in **default/imageDir/image2/**, where **default** represents the default path.|
| src | string | Yes | Absolute path of the local file of the application. |
| mimeType | string | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.<br>The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file\*'.|
| relativePath | string | No | Custom path for storing media assets, for example, 'Pictures/'. If this parameter is unspecified, media assets are stored in the default path.<br> Default path of images: 'Pictures/'<br> Default path of videos: 'Videos/'<br> Default path of audios: 'Audios/'<br> Default path of files: 'Documents/'|
## MediaSelectOption
......@@ -2243,5 +2243,5 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | -------------------- |
| type | string | Yes | Media type, which can be **image** and **video**.|
| count | number | Yes | Maximum number of media assets that can be selected. |
| type | string | Yes | Media type, which can be **image**, **media**, or **video**. Currently, only **media** is supported.|
| count | number | Yes | Number of media assets selected. If **count** is set to **1**, one media asset can be selected. If **count** is greater than **1**, multiple media assets can be selected. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册