未验证 提交 3eda306a 编写于 作者: 潘强标 提交者: Gitee

add media instance

Signed-off-by: Npanqiangbiao <panqiangbiao@huawei.com>
上级 3ca4bb29
...@@ -93,7 +93,7 @@ let imagesfetchOp = { ...@@ -93,7 +93,7 @@ let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
mediaLibrary.getFileAssets(imagesfetchOp, (error, fetchFileResult) => { media.getFileAssets(imagesfetchOp, (error, fetchFileResult) => {
if (fetchFileResult != undefined) { if (fetchFileResult != undefined) {
console.info('mediaLibraryTest : ASSET_CALLBACK fetchFileResult success'); console.info('mediaLibraryTest : ASSET_CALLBACK fetchFileResult success');
fetchFileResult.getAllObject((err, fileAssetList) => { fetchFileResult.getAllObject((err, fileAssetList) => {
...@@ -135,7 +135,7 @@ let imagesfetchOp = { ...@@ -135,7 +135,7 @@ let imagesfetchOp = {
selections: fileKeyObj.MEDIA_TYPE + '= ?', selections: fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: [imageType.toString()], selectionArgs: [imageType.toString()],
}; };
mediaLibrary.getFileAssets(imagesfetchOp).then(function(fetchFileResult){ media.getFileAssets(imagesfetchOp).then(function(fetchFileResult){
console.info("getFileAssets successfully:"+ JSON.stringify(dir)); console.info("getFileAssets successfully:"+ JSON.stringify(dir));
}).catch(function(err){ }).catch(function(err){
console.info("getFileAssets failed with error:"+ err); console.info("getFileAssets failed with error:"+ err);
...@@ -182,7 +182,7 @@ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange' ...@@ -182,7 +182,7 @@ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'
**示例:** **示例:**
``` ```
mediaLibrary.off('imageChange', () => { media.off('imageChange', () => {
// stop listening success // stop listening success
}) })
``` ```
...@@ -350,7 +350,7 @@ let AlbumNoArgsfetchOp = { ...@@ -350,7 +350,7 @@ let AlbumNoArgsfetchOp = {
selections: '', selections: '',
selectionArgs: [], selectionArgs: [],
}; };
mediaLibrary.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { media.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => {
if (albumList != undefined) { if (albumList != undefined) {
const album = albumList[0]; const album = albumList[0];
console.info('album.albumName = ' + album.albumName); console.info('album.albumName = ' + album.albumName);
...@@ -390,7 +390,7 @@ let AlbumNoArgsfetchOp = { ...@@ -390,7 +390,7 @@ let AlbumNoArgsfetchOp = {
selections: '', selections: '',
selectionArgs: [], selectionArgs: [],
}; };
mediaLibrary.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){ media.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){
console.info("getAlbums successfully:"+ JSON.stringify(albumList)); console.info("getAlbums successfully:"+ JSON.stringify(albumList));
}).catch(function(err){ }).catch(function(err){
console.info("getAlbums failed with error:"+ err); console.info("getAlbums failed with error:"+ err);
...@@ -439,7 +439,6 @@ release(): Promise&lt;void&gt; ...@@ -439,7 +439,6 @@ release(): Promise&lt;void&gt;
**示例:** **示例:**
``` ```
var media = mediaLibrary.getMediaLibrary(context);
media.release() media.release()
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册