harmony 鸿蒙media_asset_manager_capi.h
media_asset_manager_capi.h
Overview
The media_asset_manager_capi.h file declares the APIs of the media asset manager. You can use the functions to request media assets in the media library.
Library: libmedia_asset_manager.so
File to include:
System capability: SystemCapability.FileManagement.PhotoAccessHelper.Core
Since: 12
Related module: MediaAssetManager
Summary
Functions
|Name|Description| |–|–| |OH_MediaAssetManager* OH_MediaAssetManager_Create(void)|Creates an OH_MediaAssetManager instance.| |MediaLibrary_RequestId OH_MediaAssetManager_RequestImageForPath(OH_MediaAssetManager* manager, const char* uri,MediaLibrary_RequestOptions requestOptions, const char* destPath, OH_MediaLibrary_OnDataPrepared callback)|Requests an image in the specified directory.| |MediaLibrary_RequestId OH_MediaAssetManager_RequestVideoForPath(OH_MediaAssetManager* manager, const char* uri,MediaLibrary_RequestOptions requestOptions, const char* destPath, OH_MediaLibrary_OnDataPrepared callback)|Requests a video in the specified directory.| |bool OH_MediaAssetManager_CancelRequest(OH_MediaAssetManager* manager, const MediaLibrary_RequestId requestId)|Cancels a request based on the request ID.| |MediaLibrary_ErrorCode OH_MediaAssetManager_RequestMovingPhoto(OH_MediaAssetManager* manager,OH_MediaAsset* mediaAsset, MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId,OH_MediaLibrary_OnMovingPhotoDataPrepared callback)|Requests a moving photo based on different policies.| |MediaLibrary_ErrorCode OH_MediaAssetManager_RequestImage(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset,MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId,OH_MediaLibrary_OnImageDataPrepared callback)|Requests an image based on different policies.| |MediaLibrary_ErrorCode OH_MediaAssetManager_Release(OH_MediaAssetManager* manager)|Releases an OH_MediaAssetManager instance.|
Function Description
OH_MediaAssetManager_Create()
OH_MediaAssetManager* OH_MediaAssetManager_Create(void)
Description
Creates an OH_MediaAssetManager instance.
Since: 12
Return value
|Type|Description| |–|–| |OH_MediaAssetManager*|Pointer to the OH_MediaAssetManager instance created.|
OH_MediaAssetManager_RequestImageForPath()
MediaLibrary_RequestId OH_MediaAssetManager_RequestImageForPath(OH_MediaAssetManager* manager, const char* uri,MediaLibrary_RequestOptions requestOptions, const char* destPath, OH_MediaLibrary_OnDataPrepared callback)
Description
Requests an image in the specified directory.
Required permissions: ohos.permission.READ_IMAGEVIDEO
Since: 12
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.| |const char* uri|Pointer to the URI of the requested image.| |MediaLibrary_RequestOptions requestOptions|Options related to the media asset quality and delivery mode.| |const char* destPath|Pointer to the destination directory of the requested image.| |OH_MediaLibrary_OnDataPrepared callback|Callback to be invoked when the requested image is ready.|
Return value
|Type|Description| |–|–| |MediaLibrary_RequestId|Request ID.|
OH_MediaAssetManager_RequestVideoForPath()
MediaLibrary_RequestId OH_MediaAssetManager_RequestVideoForPath(OH_MediaAssetManager* manager, const char* uri,MediaLibrary_RequestOptions requestOptions, const char* destPath, OH_MediaLibrary_OnDataPrepared callback)
Description
Requests a video in the specified directory.
Required permissions: ohos.permission.READ_IMAGEVIDEO
Since: 12
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.| |const char* uri|Pointer to the URI of the requested video.| |MediaLibrary_RequestOptions requestOptions|Options related to the media asset quality and delivery mode.| |const char* destPath|Pointer to the destination directory of the requested video.| |OH_MediaLibrary_OnDataPrepared callback|Callback to be invoked when the requested video is ready.|
Return value
|Type|Description| |–|–| |MediaLibrary_RequestId|Request ID.|
OH_MediaAssetManager_CancelRequest()
bool OH_MediaAssetManager_CancelRequest(OH_MediaAssetManager* manager, const MediaLibrary_RequestId requestId)
Description
Cancels a request based on the request ID.
Required permissions: ohos.permission.READ_IMAGEVIDEO
Since: 12
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.| |const MediaLibrary_RequestId requestId|ID of the request to cancel.|
Return value
|Type|Description| |–|–| |bool|Operation result. The value true is returned if the request is successfully canceled, and false is returned otherwise.|
OH_MediaAssetManager_RequestMovingPhoto()
MediaLibrary_ErrorCode OH_MediaAssetManager_RequestMovingPhoto(OH_MediaAssetManager* manager,OH_MediaAsset* mediaAsset, MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId,OH_MediaLibrary_OnMovingPhotoDataPrepared callback)
Description
Requests a moving photo based on different policies.
Required permissions: ohos.permission.READ_IMAGEVIDEO
Since: 13
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.| |OH_MediaAsset* mediaAsset|Pointer to the OH_MediaAsset instance to be requested.| |MediaLibrary_RequestOptions requestOptions|Options related to the media asset quality and delivery mode. The options are specified by MediaLibrary_RequestOptions.| |MediaLibrary_RequestId* requestId|Request ID, which is specified by MediaLibrary_RequestId.| |OH_MediaLibrary_OnMovingPhotoDataPrepared callback|Callback to be invoked when the requested moving photo is ready. The callback is specified by OH_MediaLibrary_OnMovingPhotoDataPrepared.|
Return value
|Type|Description|
|–|–|
|MediaLibrary_ErrorCode|MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.|
OH_MediaAssetManager_RequestImage()
MediaLibrary_ErrorCode OH_MediaAssetManager_RequestImage(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset,MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId,OH_MediaLibrary_OnImageDataPrepared callback)
Description
Requests an image based on different policies.
Required permissions: ohos.permission.READ_IMAGEVIDEO
Since: 12
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.| |OH_MediaAsset* mediaAsset|Pointer to the OH_MediaAsset instance to be requested.| |MediaLibrary_RequestOptions requestOptions|Options related to the media asset quality and delivery mode. The options are specified by MediaLibrary_RequestOptions.| |MediaLibrary_RequestId* requestId|Request ID, which is specified by MediaLibrary_RequestId.| |OH_MediaLibrary_OnImageDataPrepared callback|Callback to be invoked when the requested image is ready. The callback is specified by OH_MediaLibrary_OnImageDataPrepared.|
Return value
|Type|Description|
|–|–|
|MediaLibrary_ErrorCode|MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.
MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED: unsupported operation.
MEDIA_LIBRARY_PERMISSION_DENIED: no access permission.
MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR: internal system error.|
OH_MediaAssetManager_Release()
MediaLibrary_ErrorCode OH_MediaAssetManager_Release(OH_MediaAssetManager* manager)
Description
Releases an OH_MediaAssetManager instance.
Since: 13
Parameters
|Parameter|Description| |–|–| |OH_MediaAssetManager* manager|Pointer to the OH_MediaAssetManager instance.|
Return value
|Type|Description|
|–|–|
|MediaLibrary_ErrorCode|MEDIA_LIBRARY_OK: operation success.
MEDIA_LIBRARY_PARAMETER_ERROR: incorrect parameters. Possible causes:
1. A mandatory parameter is not specified.
2. A parameter type is incorrect.
3. Parameter verification fails.|
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Media Library Kit (Media File Management Service)
harmony 鸿蒙media_access_helper_capi.h
harmony 鸿蒙media_asset_base_capi.h
harmony 鸿蒙media_asset_change_request_capi.h
harmony 鸿蒙MediaLibrary_RequestId
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦