Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
bb673af4
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bb673af4
编写于
7月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!21108 媒体库接口一致性和示例代码修改
Merge pull request !21108 from 胡伟奇/demo_update
上级
ac1b3ee3
4a91ab20
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
254 addition
and
49 deletion
+254
-49
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
+237
-32
zh-cn/application-dev/reference/apis/js-apis-photoAccessHelper.md
...plication-dev/reference/apis/js-apis-photoAccessHelper.md
+17
-17
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
浏览文件 @
bb673af4
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-photoAccessHelper.md
浏览文件 @
bb673af4
...
...
@@ -401,9 +401,9 @@ async function example() {
let
options
=
{
title
:
'
testPhoto
'
}
phAccessHelper
.
createAsset
(
photoType
,
extension
,
options
,
(
err
,
photoAsset
)
=>
{
if
(
photoAsset
!=
undefined
)
{
console
.
info
(
'
createAsset
file displayName
'
+
photoAsset
.
displayName
);
phAccessHelper
.
createAsset
(
photoType
,
extension
,
options
,
(
err
,
uri
)
=>
{
if
(
uri
!=
undefined
)
{
console
.
info
(
'
createAsset
uri
'
+
uri
);
console
.
info
(
'
createAsset successfully
'
);
}
else
{
console
.
error
(
'
createAsset failed, message =
'
,
err
);
...
...
@@ -445,9 +445,9 @@ async function example() {
console
.
info
(
'
createAssetDemo
'
);
let
photoType
=
photoAccessHelper
.
PhotoType
.
IMAGE
;
let
extension
=
'
jpg
'
;
phAccessHelper
.
createAsset
(
photoType
,
extension
,
(
err
,
photoAsset
)
=>
{
phAccessHelper
.
createAsset
(
photoType
,
extension
,
(
err
,
uri
)
=>
{
if
(
photoAsset
!=
undefined
)
{
console
.
info
(
'
createAsset
file displayName
'
+
photoAsset
.
displayName
);
console
.
info
(
'
createAsset
uri
'
+
uri
);
console
.
info
(
'
createAsset successfully
'
);
}
else
{
console
.
error
(
'
createAsset failed, message =
'
,
err
);
...
...
@@ -499,8 +499,8 @@ async function example() {
let
options
=
{
title
:
'
testPhoto
'
}
let
photoAsset
=
await
phAccessHelper
.
createAsset
(
photoType
,
extension
,
options
);
console
.
info
(
'
createAsset
file displayName
'
+
photoAsset
.
displayName
);
let
uri
=
await
phAccessHelper
.
createAsset
(
photoType
,
extension
,
options
);
console
.
info
(
'
createAsset
uri
'
+
uri
);
console
.
info
(
'
createAsset successfully
'
);
}
catch
(
err
)
{
console
.
error
(
'
createAsset failed, message =
'
,
err
);
...
...
@@ -1081,11 +1081,11 @@ async function example() {
// 注册onCallback2监听
phAccessHelper
.
registerChange
(
photoAsset
.
uri
,
false
,
onCallback2
);
photoAsset
.
f
avorite
(
true
,
(
err
)
=>
{
photoAsset
.
setF
avorite
(
true
,
(
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
info
(
'
f
avorite successfully
'
);
console
.
info
(
'
setF
avorite successfully
'
);
}
else
{
console
.
error
(
'
f
avorite failed with error:
'
+
err
);
console
.
error
(
'
setF
avorite failed with error:
'
+
err
);
}
});
}
...
...
@@ -1145,11 +1145,11 @@ async function example() {
phAccessHelper
.
registerChange
(
photoAsset
.
uri
,
false
,
onCallback2
);
// 关闭onCallback1监听,onCallback2 继续监听
phAccessHelper
.
unRegisterChange
(
photoAsset
.
uri
,
onCallback1
);
photoAsset
.
f
avorite
(
true
,
(
err
)
=>
{
photoAsset
.
setF
avorite
(
true
,
(
err
)
=>
{
if
(
err
==
undefined
)
{
console
.
info
(
'
f
avorite successfully
'
);
console
.
info
(
'
setF
avorite successfully
'
);
}
else
{
console
.
error
(
'
f
avorite failed with error:
'
+
err
);
console
.
error
(
'
setF
avorite failed with error:
'
+
err
);
}
});
}
...
...
@@ -2866,7 +2866,7 @@ async function example() {
fetchColumns
:
[],
predicates
:
predicates
};
const
albumList
=
await
phAccessHelper
.
getAlbums
(
albumFetchOptions
);
const
albumList
=
await
phAccessHelper
.
getAlbums
(
photoAccessHelper
.
AlbumType
.
USER
,
photoAccessHelper
.
AlbumSubtype
.
USER_GENERIC
,
albumFetchOptions
);
const
album
=
await
albumList
.
getFirstObject
();
album
.
getAssets
(
fetchOption
,
(
err
,
albumFetchResult
)
=>
{
if
(
albumFetchResult
!=
undefined
)
{
...
...
@@ -2924,7 +2924,7 @@ async function example() {
fetchColumns
:
[],
predicates
:
predicates
};
const
albumList
=
await
phAccessHelper
.
getAlbums
(
albumFetchOptions
);
const
albumList
=
await
phAccessHelper
.
getAlbums
(
photoAccessHelper
.
AlbumType
.
USER
,
photoAccessHelper
.
AlbumSubtype
.
USER_GENERIC
,
albumFetchOptions
);
const
album
=
await
albumList
.
getFirstObject
();
album
.
getAssets
(
fetchOption
).
then
((
albumFetchResult
)
=>
{
console
.
info
(
'
album getPhotoAssets successfully, getCount:
'
+
albumFetchResult
.
getCount
());
...
...
@@ -2969,7 +2969,7 @@ async function example() {
let
albumFetchOptions
=
{
predicates
:
predicates
};
const
albumList
=
await
phAccessHelper
.
getAlbums
(
albumFetchOptions
);
const
albumList
=
await
phAccessHelper
.
getAlbums
(
photoAccessHelper
.
AlbumType
.
USER
,
photoAccessHelper
.
AlbumSubtype
.
USER_GENERIC
,
albumFetchOptions
);
const
album
=
await
albumList
.
getFirstObject
();
album
.
albumName
=
'
hello
'
;
album
.
commitModify
((
err
)
=>
{
...
...
@@ -3017,7 +3017,7 @@ async function example() {
let
albumFetchOptions
=
{
predicates
:
predicates
};
const
albumList
=
await
phAccessHelper
.
getAlbums
(
albumFetchOptions
);
const
albumList
=
await
phAccessHelper
.
getAlbums
(
photoAccessHelper
.
AlbumType
.
USER
,
photoAccessHelper
.
AlbumSubtype
.
USER_GENERIC
,
albumFetchOptions
);
const
album
=
await
albumList
.
getFirstObject
();
album
.
albumName
=
'
hello
'
;
album
.
commitModify
().
then
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录