Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
75a7fca3
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
75a7fca3
编写于
2月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!14240 mediaLibrary and userFileManager log abarbeitung
Merge pull request !14240 from 胡伟奇/vod_fix
上级
ab654d23
94ca2a31
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
119 addition
and
120 deletion
+119
-120
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
+57
-58
zh-cn/application-dev/reference/apis/js-apis-userFileManager.md
...application-dev/reference/apis/js-apis-userFileManager.md
+62
-62
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-medialibrary.md
浏览文件 @
75a7fca3
...
...
@@ -118,14 +118,14 @@ media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => {
console
.
error
(
'
Failed to get first object:
'
+
err
);
return
;
}
console
.
log
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
for
(
let
i
=
1
;
i
<
count
;
i
++
)
{
fetchFileResult
.
getNextObject
((
err
,
fileAsset
)
=>
{
if
(
fileAsset
==
undefined
)
{
console
.
error
(
'
Failed to get next object:
'
+
err
);
return
;
}
console
.
log
(
'
fileAsset.displayName
'
+
i
+
'
:
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName
'
+
i
+
'
:
'
+
fileAsset
.
displayName
);
})
}
});
...
...
@@ -174,10 +174,10 @@ media.getFileAssets(imagesFetchOp).then(function(fetchFileResult) {
}
console
.
info
(
'
Get fetchFileResult success, count:
'
+
count
);
fetchFileResult
.
getFirstObject
().
then
(
function
(
fileAsset
)
{
console
.
log
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
for
(
let
i
=
1
;
i
<
count
;
i
++
)
{
fetchFileResult
.
getNextObject
().
then
(
function
(
fileAsset
)
{
console
.
log
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName
'
+
'
:
'
+
fileAsset
.
displayName
);
}).
catch
(
function
(
err
)
{
console
.
error
(
'
Failed to get next object:
'
+
err
);
})
...
...
@@ -264,9 +264,9 @@ async function example() {
const
path
=
await
media
.
getPublicDirectory
(
DIR_IMAGE
);
media
.
createAsset
(
mediaType
,
'
imageCallBack.jpg
'
,
path
+
'
myPicture/
'
,
(
err
,
fileAsset
)
=>
{
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
'
createAsset successfully, message
=
'
+
err
);
console
.
info
(
'
createAsset successfully, message
'
);
}
else
{
console
.
info
(
'
createAsset failed, message =
'
+
err
);
console
.
error
(
'
createAsset failed, message =
'
+
err
);
}
});
}
...
...
@@ -307,7 +307,7 @@ async function example() {
media
.
createAsset
(
mediaType
,
'
imagePromise.jpg
'
,
path
+
'
myPicture/
'
).
then
((
fileAsset
)
=>
{
console
.
info
(
'
createAsset successfully, message =
'
+
JSON
.
stringify
(
fileAsset
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
createAsset failed, message =
'
+
err
);
console
.
error
(
'
createAsset failed, message =
'
+
err
);
});
}
```
...
...
@@ -354,7 +354,7 @@ async function example() {
media
.
deleteAsset
(
asset
.
uri
).
then
(()
=>
{
console
.
info
(
"
deleteAsset successfully
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
deleteAsset failed with error:
"
+
err
);
console
.
error
(
"
deleteAsset failed with error:
"
+
err
);
});
}
```
...
...
@@ -397,7 +397,7 @@ async function example() {
if
(
err
!=
undefined
)
{
console
.
info
(
"
deleteAsset successfully
"
);
}
else
{
console
.
info
(
"
deleteAsset failed with error:
"
+
err
);
console
.
error
(
"
deleteAsset failed with error:
"
+
err
);
}
});
}
...
...
@@ -426,7 +426,7 @@ media.getPublicDirectory(DIR_CAMERA, (err, dicResult) => {
if
(
dicResult
==
'
Camera/
'
)
{
console
.
info
(
'
mediaLibraryTest : getPublicDirectory passed
'
);
}
else
{
console
.
info
(
'
mediaLibraryTest : getPublicDirectory failed
'
);
console
.
error
(
'
mediaLibraryTest : getPublicDirectory failed
'
);
}
});
```
...
...
@@ -460,7 +460,7 @@ async function example() {
if
(
dicResult
==
'
Camera/
'
)
{
console
.
info
(
'
MediaLibraryTest : getPublicDirectory
'
);
}
else
{
console
.
info
(
'
MediaLibraryTest : getPublicDirectory failed
'
);
console
.
error
(
'
MediaLibraryTest : getPublicDirectory failed
'
);
}
}
```
...
...
@@ -495,7 +495,7 @@ media.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => {
console
.
info
(
'
album.albumName =
'
+
album
.
albumName
);
console
.
info
(
'
album.count =
'
+
album
.
count
);
}
else
{
console
.
info
(
'
getAlbum fail, message =
'
+
err
);
console
.
error
(
'
getAlbum fail, message =
'
+
err
);
}
})
```
...
...
@@ -532,7 +532,7 @@ let AlbumNoArgsfetchOp = {
media
.
getAlbums
(
AlbumNoArgsfetchOp
).
then
(
function
(
albumList
){
console
.
info
(
"
getAlbums successfully:
"
+
JSON
.
stringify
(
albumList
));
}).
catch
(
function
(
err
){
console
.
info
(
"
getAlbums failed with error:
"
+
err
);
console
.
error
(
"
getAlbums failed with error:
"
+
err
);
});
```
...
...
@@ -607,10 +607,10 @@ let option = {
};
mediaLibrary
.
getMediaLibrary
().
storeMediaAsset
(
option
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
log
(
"
An error occurred when storing media resources.
"
);
console
.
error
(
"
An error occurred when storing media resources.
"
);
return
;
}
console
.
log
(
"
Media resources stored.
"
);
console
.
info
(
"
Media resources stored.
"
);
// Obtain the URI that stores media resources.
});
```
...
...
@@ -647,10 +647,10 @@ let option = {
relativePath
:
"
Pictures/
"
};
mediaLibrary
.
getMediaLibrary
().
storeMediaAsset
(
option
).
then
((
value
)
=>
{
console
.
log
(
"
Media resources stored.
"
);
console
.
info
(
"
Media resources stored.
"
);
// Obtain the URI that stores media resources.
}).
catch
((
err
)
=>
{
console
.
log
(
"
An error occurred when storing media resources.
"
);
console
.
error
(
"
An error occurred when storing media resources.
"
);
});
```
...
...
@@ -689,10 +689,10 @@ let images = [
let
index
=
1
;
mediaLibrary
.
getMediaLibrary
().
startImagePreview
(
images
,
index
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
"
An error occurred when previewing the images.
"
);
console
.
error
(
"
An error occurred when previewing the images.
"
);
return
;
}
console
.
log
(
"
Succeeded in previewing the images.
"
);
console
.
info
(
"
Succeeded in previewing the images.
"
);
});
```
...
...
@@ -729,10 +729,10 @@ let images = [
*/
mediaLibrary
.
getMediaLibrary
().
startImagePreview
(
images
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
"
An error occurred when previewing the images.
"
);
console
.
error
(
"
An error occurred when previewing the images.
"
);
return
;
}
console
.
log
(
"
Succeeded in previewing the images.
"
);
console
.
info
(
"
Succeeded in previewing the images.
"
);
});
```
...
...
@@ -775,9 +775,9 @@ let images = [
*/
let
index
=
1
;
mediaLibrary
.
getMediaLibrary
().
startImagePreview
(
images
,
index
).
then
(()
=>
{
console
.
log
(
"
Succeeded in previewing the images.
"
);
console
.
info
(
"
Succeeded in previewing the images.
"
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
An error occurred when previewing the images.
"
);
console
.
error
(
"
An error occurred when previewing the images.
"
);
});
```
...
...
@@ -808,10 +808,10 @@ let option : mediaLibrary.MediaSelectOption = {
};
mediaLibrary
.
getMediaLibrary
().
startMediaSelect
(
option
,
(
err
,
value
)
=>
{
if
(
err
)
{
console
.
log
(
"
An error occurred when selecting media resources.
"
);
console
.
error
(
"
An error occurred when selecting media resources.
"
);
return
;
}
console
.
log
(
"
Media resources selected.
"
);
console
.
info
(
"
Media resources selected.
"
);
// Obtain the media selection value.
});
```
...
...
@@ -847,10 +847,10 @@ let option : mediaLibrary.MediaSelectOption = {
count
:
2
};
mediaLibrary
.
getMediaLibrary
().
startMediaSelect
(
option
).
then
((
value
)
=>
{
console
.
log
(
"
Media resources selected.
"
);
console
.
info
(
"
Media resources selected.
"
);
// Obtain the media selection value.
}).
catch
((
err
)
=>
{
console
.
log
(
"
An error occurred when selecting media resources.
"
);
console
.
error
(
"
An error occurred when selecting media resources.
"
);
});
```
...
...
@@ -885,7 +885,7 @@ async function example() {
console
.
info
(
'
get distributed info is undefined!
'
)
}
}).
catch
((
err
)
=>
{
console
.
info
(
"
get distributed info failed with error:
"
+
err
);
console
.
error
(
"
get distributed info failed with error:
"
+
err
);
});
}
```
...
...
@@ -918,7 +918,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
get distributed fail, message =
'
+
err
)
console
.
error
(
'
get distributed fail, message =
'
+
err
)
}
})
}
...
...
@@ -956,7 +956,7 @@ async function example() {
console
.
info
(
'
get distributed info is undefined!
'
)
}
}).
catch
((
err
)
=>
{
console
.
info
(
"
get distributed info failed with error:
"
+
err
);
console
.
error
(
"
get distributed info failed with error:
"
+
err
);
});
}
```
...
...
@@ -989,7 +989,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
get distributed fail, message =
'
+
err
)
console
.
error
(
'
get distributed fail, message =
'
+
err
)
}
})
}
...
...
@@ -1019,7 +1019,7 @@ async function example() {
| parent
<sup>
8+
</sup>
| number | 是 | 否 | 父目录id |
| size | number | 是 | 否 | 文件大小(单位:字节) |
| dateAdded | number | 是 | 否 | 添加日期(添加文件时间到1970年1月1日的秒数值) |
| dateModified | number | 是 | 否 | 修改日期(修改文件时间到1970年1月1日的秒数值
)
|
| dateModified | number | 是 | 否 | 修改日期(修改文件时间到1970年1月1日的秒数值
,修改文件名不会改变此值,当文件内容发生修改时才会更新)
|
| dateTaken | number | 是 | 否 | 拍摄日期(文件拍照时间到1970年1月1日的秒数值) |
| artist
<sup>
8+
</sup>
| string | 是 | 否 | 作者 |
| audioAlbum
<sup>
8+
</sup>
| string | 是 | 否 | 专辑 |
...
...
@@ -1101,7 +1101,7 @@ async function example() {
asset
.
isDirectory
().
then
(
function
(
isDirectory
){
console
.
info
(
"
isDirectory result:
"
+
isDirectory
);
}).
catch
(
function
(
err
){
console
.
info
(
"
isDirectory failed with error:
"
+
err
);
console
.
error
(
"
isDirectory failed with error:
"
+
err
);
});
}
```
...
...
@@ -1209,7 +1209,7 @@ async function example() {
if
(
fd
>
0
){
asset
.
close
(
fd
);
}
else
{
console
.
info
(
'
File Open Failed!
'
+
openError
);
console
.
error
(
'
File Open Failed!
'
+
openError
);
}
});
}
...
...
@@ -1252,7 +1252,7 @@ async function example() {
console
.
info
(
'
File fd!
'
+
fd
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
File err!
'
+
err
);
console
.
error
(
'
File err!
'
+
err
);
});
}
```
...
...
@@ -1292,15 +1292,15 @@ async function example() {
console
.
info
(
'
File fd!
'
+
fd
);
asset
.
close
(
fd
,
(
closeErr
)
=>
{
if
(
closeErr
!=
undefined
)
{
console
.
info
(
'
mediaLibraryTest : close : FAIL
'
+
closeErr
);
console
.
info
(
'
mediaLibraryTest : ASSET_CALLBACK : FAIL
'
);
console
.
error
(
'
mediaLibraryTest : close : FAIL
'
+
closeErr
);
console
.
error
(
'
mediaLibraryTest : ASSET_CALLBACK : FAIL
'
);
}
else
{
console
.
info
(
"
=======asset.close success====>
"
);
}
});
})
.
catch
((
err
)
=>
{
console
.
info
(
'
File err!
'
+
err
);
console
.
error
(
'
File err!
'
+
err
);
});
}
```
...
...
@@ -1345,8 +1345,8 @@ async function example() {
console
.
info
(
'
File fd!
'
+
fd
);
asset
.
close
(
fd
).
then
((
closeErr
)
=>
{
if
(
closeErr
!=
undefined
)
{
console
.
info
(
'
mediaLibraryTest : close : FAIL
'
+
closeErr
);
console
.
info
(
'
mediaLibraryTest : ASSET_CALLBACK : FAIL
'
);
console
.
error
(
'
mediaLibraryTest : close : FAIL
'
+
closeErr
);
console
.
error
(
'
mediaLibraryTest : ASSET_CALLBACK : FAIL
'
);
}
else
{
console
.
info
(
"
=======asset.close success====>
"
);
...
...
@@ -1354,7 +1354,7 @@ async function example() {
});
})
.
catch
((
err
)
=>
{
console
.
info
(
'
File err!
'
+
err
);
console
.
error
(
'
File err!
'
+
err
);
});
}
```
...
...
@@ -1475,7 +1475,7 @@ async function example() {
console
.
info
(
'
mediaLibraryTest : getThumbnail Successful
'
+
pixelmap
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'
mediaLibraryTest : getThumbnail fail
'
+
err
);
console
.
error
(
'
mediaLibraryTest : getThumbnail fail, err:
'
+
err
);
});
}
```
...
...
@@ -1556,7 +1556,7 @@ async function example() {
asset
.
favorite
(
true
).
then
(
function
()
{
console
.
info
(
"
favorite successfully
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
favorite failed with error:
"
+
err
);
console
.
error
(
"
favorite failed with error:
"
+
err
);
});
}
```
...
...
@@ -1634,7 +1634,7 @@ async function example() {
asset
.
isFavorite
().
then
(
function
(
isFavorite
){
console
.
info
(
"
isFavorite result:
"
+
isFavorite
);
}).
catch
(
function
(
err
){
console
.
info
(
"
isFavorite failed with error:
"
+
err
);
console
.
error
(
"
isFavorite failed with error:
"
+
err
);
});
}
```
...
...
@@ -1720,7 +1720,7 @@ async function example() {
asset
.
trash
(
true
).
then
(
function
()
{
console
.
info
(
"
trash successfully
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
trash failed with error:
"
+
err
);
console
.
error
(
"
trash failed with error:
"
+
err
);
});
}
```
...
...
@@ -1875,7 +1875,6 @@ async function example() {
console
.
info
(
'
mediaLibraryTest : isAfterLast:
'
+
result
);
console
.
info
(
'
mediaLibraryTest : isAfterLast end
'
);
fetchFileResult
.
close
();
}
}
}
...
...
@@ -1938,7 +1937,7 @@ async function example() {
console
.
error
(
'
Failed
'
);
return
;
}
console
.
log
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
})
}
```
...
...
@@ -1973,7 +1972,7 @@ async function example() {
fetchFileResult
.
getFirstObject
().
then
(
function
(
fileAsset
){
console
.
info
(
"
getFirstObject successfully:
"
+
JSON
.
stringify
(
fileAsset
));
}).
catch
(
function
(
err
){
console
.
info
(
"
getFirstObject failed with error:
"
+
err
);
console
.
error
(
"
getFirstObject failed with error:
"
+
err
);
});
}
```
...
...
@@ -2080,7 +2079,7 @@ async function example() {
console
.
error
(
'
Failed
'
);
return
;
}
console
.
log
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
})
}
```
...
...
@@ -2149,7 +2148,7 @@ async function example() {
console
.
error
(
'
Failed
'
);
return
;
}
console
.
log
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
})
}
```
...
...
@@ -2188,9 +2187,9 @@ async function example() {
};
let
fetchFileResult
=
await
media
.
getFileAssets
(
getImageOp
);
fetchFileResult
.
getPositionObject
(
1
)
.
then
(
function
(
fileAsset
){
console
.
log
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
console
.
info
(
'
fileAsset.displayName :
'
+
fileAsset
.
displayName
);
}).
catch
(
function
(
err
)
{
console
.
info
(
"
getFileAssets failed with error:
"
+
err
);
console
.
error
(
"
getFileAssets failed with error:
"
+
err
);
});
}
```
...
...
@@ -2228,7 +2227,7 @@ async function example() {
return
;
}
for
(
let
i
=
0
;
i
<
fetchFileResult
.
getCount
();
i
++
)
{
console
.
log
(
'
fileAsset.displayName :
'
+
fileAsset
[
i
].
displayName
);
console
.
info
(
'
fileAsset.displayName :
'
+
fileAsset
[
i
].
displayName
);
}
})
}
...
...
@@ -2315,7 +2314,7 @@ async function example() {
console
.
error
(
'
Failed
'
);
return
;
}
console
.
log
(
'
Modify successful.
'
);
console
.
info
(
'
Modify successful.
'
);
})
}
```
...
...
@@ -2350,7 +2349,7 @@ async function example() {
album
.
commitModify
().
then
(
function
()
{
console
.
info
(
"
commitModify successfully
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
commitModify failed with error:
"
+
err
);
console
.
error
(
"
commitModify failed with error:
"
+
err
);
});
}
```
...
...
@@ -2430,9 +2429,9 @@ async function example() {
const
albumList
=
await
media
.
getAlbums
(
AlbumNoArgsfetchOp
);
const
album
=
albumList
[
0
];
album
.
getFileAssets
(
fileNoArgsfetchOp
).
then
(
function
(
albumFetchFileResult
){
console
.
info
(
"
getFileAssets successfully:
"
+
JSON
.
stringify
(
albumFetchFileResult
));
console
.
info
(
"
getFileAssets successfully:
"
+
JSON
.
stringify
(
albumFetchFileResult
));
}).
catch
(
function
(
err
){
console
.
info
(
"
getFileAssets failed with error:
"
+
err
);
console
.
error
(
"
getFileAssets failed with error:
"
+
err
);
});
}
```
...
...
@@ -2486,7 +2485,7 @@ async function example() {
| MEDIA_TYPE | "media_type" | 媒体类型 |
| SIZE | "size" | 文件大小(单位:字节) |
| DATE_ADDED | "date_added" | 添加日期(添加文件时间到1970年1月1日的秒数值) |
| DATE_MODIFIED | "date_modified" | 修改日期(修改文件时间到1970年1月1日的秒数值
)
|
| DATE_MODIFIED | "date_modified" | 修改日期(修改文件时间到1970年1月1日的秒数值
,修改文件名不会改变此值,当文件内容发生修改时才会更新)
|
| DATE_TAKEN | "date_taken" | 拍摄日期(文件拍照时间到1970年1月1日的秒数值) |
| TITLE | "title" | 文件标题 |
| ARTIST | "artist" | 作者 |
...
...
zh-cn/application-dev/reference/apis/js-apis-userFileManager.md
浏览文件 @
75a7fca3
...
...
@@ -82,10 +82,10 @@ async function example() {
console
.
info
(
'
fetchResult success
'
);
let
fileAsset
=
await
fetchResult
.
getFirstObject
();
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
"
fileAsset.displayName :
"
+
fileAsset
.
displayName
);
console
.
info
(
"
fileAsset.displayName :
"
+
fileAsset
.
displayName
);
}
}
else
{
console
.
info
(
'
fetchResult fail
'
+
err
);
console
.
error
(
'
fetchResult fail
'
+
err
);
}
});
}
...
...
@@ -136,7 +136,7 @@ async function example() {
}
}
}
catch
(
err
)
{
console
.
info
(
'
getPhotoAssets failed, message =
'
,
err
);
console
.
error
(
'
getPhotoAssets failed, message =
'
,
err
);
}
}
```
...
...
@@ -177,7 +177,7 @@ async function example() {
console
.
info
(
'
createPhotoAsset file displayName
'
+
fileAsset
.
displayName
);
console
.
info
(
'
createPhotoAsset successfully
'
);
}
else
{
console
.
info
(
'
createPhotoAsset failed, message =
'
,
err
);
console
.
error
(
'
createPhotoAsset failed, message =
'
,
err
);
}
});
}
...
...
@@ -211,7 +211,7 @@ async function example() {
console
.
info
(
'
createPhotoAsset file displayName
'
+
fileAsset
.
displayName
);
console
.
info
(
'
createPhotoAsset successfully
'
);
}
else
{
console
.
info
(
'
createPhotoAsset failed, message =
'
,
err
);
console
.
error
(
'
createPhotoAsset failed, message =
'
,
err
);
}
});
}
...
...
@@ -251,7 +251,7 @@ async function example() {
console
.
info
(
'
createPhotoAsset file displayName
'
+
fileAsset
.
displayName
);
console
.
info
(
'
createPhotoAsset successfully
'
);
}
catch
(
err
)
{
console
.
info
(
'
createPhotoAsset failed, message =
'
,
err
);
console
.
error
(
'
createPhotoAsset failed, message =
'
,
err
);
}
}
```
...
...
@@ -293,11 +293,11 @@ async function example() {
if
(
album
!=
undefined
)
{
console
.
info
(
'
first album.albumName =
'
+
album
.
albumName
);
}
else
{
console
.
info
(
'
album is undefined, err =
'
,
err
);
console
.
error
(
'
album is undefined, err =
'
,
err
);
}
});
}
else
{
console
.
info
(
'
getPhotoAlbums fail, message =
'
,
err
);
console
.
error
(
'
getPhotoAlbums fail, message =
'
,
err
);
}
});
}
...
...
@@ -342,7 +342,7 @@ async function example() {
const
album
=
await
fetchResult
.
getFirstObject
();
console
.
info
(
'
first album.albumName =
'
+
album
.
albumName
);
}
catch
(
err
)
{
console
.
info
(
'
getPhotoAlbums fail, message =
'
+
err
);
console
.
error
(
'
getPhotoAlbums fail, message =
'
+
err
);
}
}
```
...
...
@@ -375,7 +375,7 @@ async function example() {
let
trashAlbum
=
await
fetchResult
.
getFirstObject
();
console
.
info
(
'
first album.albumName =
'
+
trashAlbum
.
albumName
);
}
else
{
console
.
info
(
'
getPrivateAlbum failed. message =
'
,
err
);
console
.
error
(
'
getPrivateAlbum failed. message =
'
,
err
);
}
});
}
...
...
@@ -414,7 +414,7 @@ async function example() {
let
trashAlbum
=
await
fetchResult
.
getFirstObject
();
console
.
info
(
'
first album.albumName =
'
+
trashAlbum
.
albumName
);
}
catch
(
err
)
{
console
.
info
(
'
getPrivateAlbum failed. message =
'
,
err
);
console
.
error
(
'
getPrivateAlbum failed. message =
'
,
err
);
}
}
```
...
...
@@ -458,7 +458,7 @@ async function example() {
console
.
info
(
"
fileAsset.displayName :
"
+
fileAsset
.
displayName
);
}
}
else
{
console
.
info
(
'
fetchFileResult fail
'
+
err
);
console
.
error
(
'
fetchFileResult fail
'
+
err
);
}
});
}
...
...
@@ -502,7 +502,7 @@ async function example() {
try
{
var
fetchResult
=
await
mgr
.
getAudioAssets
(
fetchOptions
);
}
catch
(
err
)
{
console
.
info
(
'
getAudioAssets failed, message =
'
,
err
);
console
.
error
(
'
getAudioAssets failed, message =
'
,
err
);
}
if
(
fetchResult
!=
undefined
)
{
...
...
@@ -558,7 +558,7 @@ async function example() {
if
(
err
==
undefined
)
{
console
.
info
(
"
delete successfully
"
);
}
else
{
console
.
info
(
"
delete failed with error:
"
+
err
);
console
.
error
(
"
delete failed with error:
"
+
err
);
}
});
}
...
...
@@ -612,7 +612,7 @@ async function example() {
await
mgr
.
delete
(
asset
.
uri
);
console
.
info
(
"
delete successfully
"
);
}
catch
(
err
)
{
console
.
info
(
"
delete failed with error:
"
+
err
);
console
.
error
(
"
delete failed with error:
"
+
err
);
}
}
```
...
...
@@ -648,13 +648,13 @@ async function example() {
console
.
info
(
'
createPhotoAsset file displayName
'
+
fileAsset
.
displayName
);
console
.
info
(
'
createPhotoAsset successfully
'
);
}
catch
(
err
)
{
console
.
info
(
'
createPhotoAsset failed, message =
'
+
err
);
console
.
error
(
'
createPhotoAsset failed, message =
'
+
err
);
}
//sleep 1s
if
(
count
>
0
)
{
console
.
info
(
"
onDemo success
"
);
}
else
{
console
.
info
(
"
onDemo fail
"
);
console
.
error
(
"
onDemo fail
"
);
}
mgr
.
off
(
'
imageChange
'
,
()
=>
{
// stop listening success
...
...
@@ -698,13 +698,13 @@ async function example() {
console
.
info
(
'
createPhotoAsset file displayName
'
+
fileAsset
.
displayName
);
console
.
info
(
'
createPhotoAsset successfully
'
);
}
catch
(
err
)
{
console
.
info
(
'
createPhotoAsset failed, message =
'
+
err
);
console
.
error
(
'
createPhotoAsset failed, message =
'
+
err
);
}
//sleep 1s
if
(
count
==
0
)
{
console
.
info
(
"
offDemo success
"
);
}
else
{
console
.
info
(
"
offDemo fail
"
);
console
.
error
(
"
offDemo fail
"
);
}
}
```
...
...
@@ -735,7 +735,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
getActivePeers failed. message =
'
,
err
);
console
.
error
(
'
getActivePeers failed. message =
'
,
err
);
}
});
}
...
...
@@ -763,7 +763,7 @@ async function example() {
try
{
var
devicesInfo
=
await
mgr
.
getActivePeers
();
}
catch
(
err
)
{
console
.
info
(
'
getActivePeers failed. message =
'
,
err
);
console
.
error
(
'
getActivePeers failed. message =
'
,
err
);
}
if
(
devicesInfo
!=
undefined
)
{
console
.
log
(
'
getActivePeers succeed.
'
);
...
...
@@ -771,7 +771,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
get distributed fail
'
);
console
.
error
(
'
get distributed fail
'
);
}
}
```
...
...
@@ -802,7 +802,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
getAllPeers failed. message =
'
,
err
);
console
.
error
(
'
getAllPeers failed. message =
'
,
err
);
}
});
}
...
...
@@ -830,7 +830,7 @@ async function example() {
try
{
var
devicesInfo
=
await
mgr
.
getAllPeers
();
}
catch
(
err
)
{
console
.
info
(
'
getAllPeers failed. message =
'
,
err
);
console
.
error
(
'
getAllPeers failed. message =
'
,
err
);
}
if
(
devicesInfo
!=
undefined
)
{
console
.
log
(
'
getAllPeers succeed.
'
);
...
...
@@ -838,7 +838,7 @@ async function example() {
console
.
info
(
'
get distributed info
'
+
devicesInfo
[
i
].
deviceName
+
devicesInfo
[
i
].
networkId
);
}
}
else
{
console
.
info
(
'
get distributed fail
'
);
console
.
error
(
'
get distributed fail
'
);
}
}
```
...
...
@@ -865,7 +865,7 @@ async function example() {
console
.
info
(
'
releaseDemo
'
);
mgr
.
release
((
err
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
'
release failed. message =
'
,
err
);
console
.
error
(
'
release failed. message =
'
,
err
);
}
else
{
console
.
info
(
'
release ok.
'
);
}
...
...
@@ -897,7 +897,7 @@ async function example() {
await
mgr
.
release
();
console
.
info
(
'
release ok.
'
);
}
catch
(
err
)
{
console
.
info
(
'
release failed. message =
'
,
err
);
console
.
error
(
'
release failed. message =
'
,
err
);
}
}
```
...
...
@@ -950,7 +950,7 @@ async function example() {
let
fileAssetTitle
=
fileAsset
.
get
(
title
.
toString
());
console
.
info
(
'
fileAsset Get fileAssetTitle =
'
,
fileAssetTitle
);
}
catch
(
err
)
{
console
.
info
(
'
release failed. message =
'
,
err
);
console
.
error
(
'
release failed. message =
'
,
err
);
}
}
```
...
...
@@ -988,7 +988,7 @@ async function example() {
let
title
=
userFileManager
.
ImageVideoKey
.
TITLE
;
fileAsset
.
set
(
title
.
toString
(),
"
newTitle
"
);
}
catch
(
err
)
{
console
.
info
(
'
release failed. message =
'
,
err
);
console
.
error
(
'
release failed. message =
'
,
err
);
}
}
```
...
...
@@ -1032,7 +1032,7 @@ async function example() {
let
newFileAssetTitle
=
fileAsset
.
get
(
title
.
toString
());
console
.
info
(
'
fileAsset Get newFileAssetTitle =
'
,
newFileAssetTitle
);
}
else
{
console
.
info
(
'
commitModify failed, message =
'
,
err
);
console
.
error
(
'
commitModify failed, message =
'
,
err
);
}
});
}
...
...
@@ -1077,7 +1077,7 @@ async function example() {
let
newFileAssetTitle
=
fileAsset
.
get
(
title
.
toString
());
console
.
info
(
'
fileAsset Get newFileAssetTitle =
'
,
newFileAssetTitle
);
}
catch
(
err
)
{
console
.
info
(
'
release failed. message =
'
,
err
);
console
.
error
(
'
release failed. message =
'
,
err
);
}
}
```
...
...
@@ -1114,7 +1114,7 @@ async function example() {
console
.
info
(
'
File fd
'
+
fd
);
fileAsset
.
close
(
fd
);
}
else
{
console
.
info
(
'
File err
'
+
err
);
console
.
error
(
'
File err
'
+
err
);
}
});
}
...
...
@@ -1157,10 +1157,10 @@ async function example() {
console
.
info
(
'
File fd
'
+
fd
);
fileAsset
.
close
(
fd
);
}
else
{
console
.
info
(
'
open File fail
'
);
console
.
error
(
'
open File fail
'
);
}
}
catch
(
err
)
{
console
.
info
(
'
open Demo err
'
+
err
);
console
.
error
(
'
open Demo err
'
+
err
);
}
}
```
...
...
@@ -1201,11 +1201,11 @@ async function example() {
if
(
err
==
undefined
)
{
console
.
info
(
'
asset close succeed.
'
);
}
else
{
console
.
info
(
'
close failed, message =
'
+
err
);
console
.
error
(
'
close failed, message =
'
+
err
);
}
});
}
catch
(
err
)
{
console
.
info
(
'
close failed, message =
'
+
err
);
console
.
error
(
'
close failed, message =
'
+
err
);
}
}
```
...
...
@@ -1250,7 +1250,7 @@ async function example() {
await
asset
.
close
(
fd
);
console
.
info
(
'
asset close succeed.
'
);
}
catch
(
err
)
{
console
.
info
(
'
close failed, message =
'
+
err
);
console
.
error
(
'
close failed, message =
'
+
err
);
}
}
```
...
...
@@ -1290,7 +1290,7 @@ async function example() {
if
(
err
==
undefined
)
{
console
.
info
(
'
getThumbnail successful
'
+
pixelMap
);
}
else
{
console
.
info
(
'
getThumbnail fail
'
,
err
);
console
.
error
(
'
getThumbnail fail
'
,
err
);
}
});
}
...
...
@@ -1333,7 +1333,7 @@ async function example() {
if
(
err
==
undefined
)
{
console
.
info
(
'
getThumbnail successful
'
+
pixelMap
);
}
else
{
console
.
info
(
'
getThumbnail fail
'
,
err
);
console
.
error
(
'
getThumbnail fail
'
,
err
);
}
});
}
...
...
@@ -1380,7 +1380,7 @@ async function example() {
asset
.
getThumbnail
(
size
).
then
((
pixelMap
)
=>
{
console
.
info
(
'
getThumbnail successful
'
+
pixelMap
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
getThumbnail fail
'
+
err
);
console
.
error
(
'
getThumbnail fail
'
+
err
);
});
}
```
...
...
@@ -1420,7 +1420,7 @@ async function example() {
if
(
err
==
undefined
)
{
console
.
info
(
"
favorite successfully
"
);
}
else
{
console
.
info
(
"
favorite failed with error:
"
+
err
);
console
.
error
(
"
favorite failed with error:
"
+
err
);
}
});
}
...
...
@@ -1465,7 +1465,7 @@ async function example() {
asset
.
favorite
(
true
).
then
(
function
()
{
console
.
info
(
"
favorite successfully
"
);
}).
catch
(
function
(
err
)
{
console
.
info
(
"
favorite failed with error:
"
+
err
);
console
.
error
(
"
favorite failed with error:
"
+
err
);
});
}
```
...
...
@@ -1568,7 +1568,7 @@ async function example() {
await
fetchResult
.
close
();
console
.
info
(
'
close succeed.
'
);
}
catch
(
err
)
{
console
.
info
(
'
close fail. message =
'
+
err
);
console
.
error
(
'
close fail. message =
'
+
err
);
}
}
```
...
...
@@ -1604,7 +1604,7 @@ async function example() {
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
'
fileAsset displayName:
'
,
fileAsset
.
displayName
);
}
else
{
console
.
info
(
"
fileAsset failed with err:
"
+
err
);
console
.
error
(
"
fileAsset failed with err:
"
+
err
);
}
});
}
...
...
@@ -1675,7 +1675,7 @@ async function example() {
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
'
fileAsset displayName:
'
,
fileAsset
.
displayName
);
}
else
{
console
.
info
(
"
fileAsset failed with err:
"
+
err
);
console
.
error
(
"
fileAsset failed with err:
"
+
err
);
}
});
}
...
...
@@ -1748,7 +1748,7 @@ async function example() {
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
'
fileAsset displayName:
'
,
fileAsset
.
displayName
);
}
else
{
console
.
info
(
"
fileAsset failed with err:
"
+
err
);
console
.
error
(
"
fileAsset failed with err:
"
+
err
);
}
});
}
...
...
@@ -1818,7 +1818,7 @@ async function example() {
if
(
fileAsset
!=
undefined
)
{
console
.
info
(
'
fileAsset displayName:
'
,
fileAsset
.
displayName
);
}
else
{
console
.
info
(
"
fileAsset failed with err:
"
+
err
);
console
.
error
(
"
fileAsset failed with err:
"
+
err
);
}
});
}
...
...
@@ -1915,9 +1915,9 @@ async function example() {
const
album
=
await
albumList
.
getFirstObject
();
album
.
getPhotoAssets
(
fetchOption
,
(
err
,
albumFetchResult
)
=>
{
if
(
albumFetchResult
!=
undefined
)
{
console
.
info
(
"
album getPhotoAssets successfully, getCount:
"
+
albumFetchResult
.
getCount
());
console
.
info
(
"
album getPhotoAssets successfully, getCount:
"
+
albumFetchResult
.
getCount
());
}
else
{
console
.
info
(
"
album getPhotoAssets failed with error:
"
+
err
);
console
.
error
(
"
album getPhotoAssets failed with error:
"
+
err
);
}
});
}
...
...
@@ -1958,9 +1958,9 @@ async function example() {
const
albumList
=
await
mgr
.
getPhotoAlbums
(
albumFetchOptions
);
const
album
=
await
albumList
.
getFirstObject
();
album
.
getPhotoAssets
(
fetchOption
).
then
((
albumFetchResult
)
=>
{
console
.
info
(
"
album getFileAssets successfully, getCount:
"
+
albumFetchResult
.
getCount
());
console
.
info
(
"
album getFileAssets successfully, getCount:
"
+
albumFetchResult
.
getCount
());
}).
catch
((
err
)
=>
{
console
.
info
(
"
album getFileAssets failed with error:
"
+
err
);
console
.
error
(
"
album getFileAssets failed with error:
"
+
err
);
});
}
```
...
...
@@ -1997,7 +1997,7 @@ async function example() {
album
.
albumName
=
'
hello
'
;
album
.
commitModify
((
err
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
"
commitModify failed with error:
"
+
err
);
console
.
error
(
"
commitModify failed with error:
"
+
err
);
}
else
{
console
.
info
(
"
commitModify successfully
"
);
}
...
...
@@ -2035,14 +2035,14 @@ async function example() {
try
{
var
albumList
=
await
mgr
.
getPhotoAlbums
(
albumFetchOptions
);
}
catch
(
err
)
{
console
.
info
(
'
getPhotoAlbums failed. message =
'
,
err
);
console
.
error
(
'
getPhotoAlbums failed. message =
'
,
err
);
}
const
album
=
await
albumList
.
getFirstObject
();
album
.
albumName
=
'
hello
'
;
album
.
commitModify
().
then
(()
=>
{
console
.
info
(
"
commitModify successfully
"
);
}).
catch
((
err
)
=>
{
console
.
info
(
"
commitModify failed with error:
"
+
err
);
console
.
error
(
"
commitModify failed with error:
"
+
err
);
});
}
```
...
...
@@ -2099,7 +2099,7 @@ async function example() {
let
count
=
fetchResult
.
getCount
();
console
.
info
(
'
fetchResult.count =
'
,
count
);
}
else
{
console
.
info
(
'
getFileAssets failed, message =
'
,
err
);
console
.
error
(
'
getFileAssets failed, message =
'
,
err
);
}
});
}
...
...
@@ -2182,7 +2182,7 @@ async function example() {
let
deleteFileUri
=
fileAsset
.
uri
;
trashAlbum
.
delete
(
deleteFileUri
,
(
err
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
'
trashAlbum.delete failed, message =
'
,
err
);
console
.
error
(
'
trashAlbum.delete failed, message =
'
,
err
);
}
else
{
console
.
info
(
'
trashAlbum.delete successfully
'
);
}
...
...
@@ -2231,7 +2231,7 @@ async function example() {
trashAlbum
.
delete
(
deleteFileUri
).
then
(()
=>
{
console
.
info
(
'
trashAlbum.delete successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
trashAlbum.delete failed, message =
'
,
err
);
console
.
error
(
'
trashAlbum.delete failed, message =
'
,
err
);
});
}
```
...
...
@@ -2272,7 +2272,7 @@ async function example() {
let
recoverFileUri
=
fileAsset
.
uri
;
trashAlbum
.
recover
(
recoverFileUri
,
(
err
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
'
trashAlbum.recover failed, message =
'
,
err
);
console
.
error
(
'
trashAlbum.recover failed, message =
'
,
err
);
}
else
{
console
.
info
(
'
trashAlbum.recover successfully
'
);
}
...
...
@@ -2321,7 +2321,7 @@ async function example() {
trashAlbum
.
recover
(
recoverFileUri
).
then
(()
=>
{
console
.
info
(
'
trashAlbum.recover successfully
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
trashAlbum.recover failed, message =
'
,
err
);
console
.
error
(
'
trashAlbum.recover failed, message =
'
,
err
);
});
}
```
...
...
@@ -2402,7 +2402,7 @@ async function example() {
| URI | uri | 文件uri |
| DISPLAY_NAME | display_name | 显示名字 |
| DATE_ADDED | date_added | 添加日期(添加文件时间到1970年1月1日的秒数值) |
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
)
|
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
,修改文件名不会改变此值,当文件内容发生修改时才会更新)
|
| TITLE | title | 文件标题 |
| ARTIST | artist | 作者 |
| AUDIOALBUM | audio_album | 专辑 |
...
...
@@ -2421,7 +2421,7 @@ async function example() {
| FILE_TYPE | file_type | 媒体文件类型 |
| DISPLAY_NAME | display_name | 显示名字 |
| DATE_ADDED | date_added | 添加日期(添加文件时间到1970年1月1日的秒数值) |
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
)
|
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
,修改文件名不会改变此值,当文件内容发生修改时才会更新)
|
| TITLE | title | 文件标题 |
| DURATION | duration | 持续时间(单位:毫秒) |
| WIDTH | width | 图片宽度(单位:像素) |
...
...
@@ -2442,7 +2442,7 @@ async function example() {
| FILE_TYPE | file_type | 媒体文件类型 |
| ALBUM_NAME | album_name | 相册名字 |
| DATE_ADDED | date_added | 添加日期(添加文件时间到1970年1月1日的秒数值) |
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
)
|
| DATE_MODIFIED | date_modified | 修改日期(修改文件时间到1970年1月1日的秒数值
,修改文件名不会改变此值,当文件内容发生修改时才会更新)
|
## FetchOptions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录