1e41f4b71Sopenharmony_ci# MediaAssetManager
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciProvides APIs for requesting media library assets.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Since**: 12
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Summary
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci### Files
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci| Name| Description|
17e41f4b71Sopenharmony_ci| -------- | -------- |
18e41f4b71Sopenharmony_ci| [media_access_helper_capi.h](media__access__helper__capi_8h.md) | Defines the APIs for album management.|
19e41f4b71Sopenharmony_ci| [media_asset_base_capi.h](media__asset__base__capi_8h.md) | Defines the structs and enums of the media asset manager.|
20e41f4b71Sopenharmony_ci| [media_asset_capi.h](media__asset__capi_8h.md) | Defines the APIs related to media assets. |
21e41f4b71Sopenharmony_ci| [media_asset_change_request_capi.h](media__asset__change__request__capi_8h.md) | Defines the APIs related to media asset change requests. |
22e41f4b71Sopenharmony_ci| [media_asset_manager_capi.h](media__asset__manager__capi_8h.md) | Defines the functions of the media asset manager.|
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci### Structs
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci| Name| Description|
28e41f4b71Sopenharmony_ci| -------- | -------- |
29e41f4b71Sopenharmony_ci| struct  [MediaLibrary_RequestId](_media_library___request_id.md) | Defines a request ID.|
30e41f4b71Sopenharmony_ci| struct  [MediaLibrary_RequestOptions](_media_library___request_options.md) | Defines the options related to the media asset quality and delivery mode to set.|
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci### Types
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci| Name| Description|
36e41f4b71Sopenharmony_ci| -------- | -------- |
37e41f4b71Sopenharmony_ci| typedef struct [OH_MediaAssetManager](#oh_mediaassetmanager) [OH_MediaAssetManager](#oh_mediaassetmanager) | Defines a struct for the media asset manager.|
38e41f4b71Sopenharmony_ci| typedef struct [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) | Defines a struct for a media asset change request.|
39e41f4b71Sopenharmony_ci| typedef struct [OH_MediaAsset](#oh_mediaasset) [OH_MediaAsset](#oh_mediaasset) | Defines a struct for a media asset.|
40e41f4b71Sopenharmony_ci| typedef struct [MediaLibrary_RequestId](_media_library___request_id.md) [MediaLibrary_RequestId](#medialibrary_requestid) | Defines a struct for a request ID. |
41e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_ErrorCode](#medialibrary_errorcode-1) [MediaLibrary_ErrorCode](#medialibrary_errorcode) | Defines an enum for error codes.|
42e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_DeliveryMode](#medialibrary_deliverymode-1) [MediaLibrary_DeliveryMode](#medialibrary_deliverymode) | Defines an enum for delivery modes of the requested media asset.|
43e41f4b71Sopenharmony_ci| typedef struct [MediaLibrary_RequestOptions](_media_library___request_options.md) [MediaLibrary_RequestOptions](#medialibrary_requestoptions) | Defines an enum for options related to the media asset quality and delivery mode to set.|
44e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_MediaType](#medialibrary_mediatype-1) [MediaLibrary_MediaType](#medialibrary_mediatype) | Defines an enum for media types.|
45e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_MediaSubType](#medialibrary_mediasubtype-1) [MediaLibrary_MediaSubType](#medialibrary_mediasubtype) | Defines an enum for media subtypes.|
46e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_ResourceType](#medialibrary_resourcetype-1) [MediaLibrary_ResourceType](#medialibrary_resourcetype) | Defines an enum for media library resource types.|
47e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_ImageFileType](#medialibrary_imagefiletype-1) [MediaLibrary_ImageFileType](#medialibrary_imagefiletype) | Defines an enum for image file types.|
48e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_MediaQuality](#medialibrary_mediaquality-1) [MediaLibrary_MediaQuality](#medialibrary_mediaquality) | Defines an enum for media resource quality.|
49e41f4b71Sopenharmony_ci| typedef enum [MediaLibrary_MediaContentType](#medialibrary_mediacontenttype-1) [MediaLibrary_MediaContentType](#medialibrary_mediacontenttype) | Defines an enum for media content types.|
50e41f4b71Sopenharmony_ci| typedef void(\* [OH_MediaLibrary_OnDataPrepared](#oh_medialibrary_ondataprepared)) (int32_t result, [MediaLibrary_RequestId](_media_library___request_id.md) requestId) | Defines a function pointer to the callback to be invoked when the requested media asset is ready. |
51e41f4b71Sopenharmony_ci| typedef void(\* [OH_MediaLibrary_OnImageDataPrepared](#oh_medialibrary_onimagedataprepared)) ([MediaLibrary_ErrorCode](#medialibrary_errorcode) result, [MediaLibrary_RequestId](_media_library___request_id.md) requestId, [MediaLibrary_MediaQuality](#medialibrary_mediaquality) mediaQuality, [MediaLibrary_MediaContentType](#medialibrary_mediacontenttype) type, OH_ImageSourceNative \*imageSourceNative) | Defines a function pointer to the callback to be invoked when the requested image is ready.|
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci### Enums
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci| Name| Description|
57e41f4b71Sopenharmony_ci| -------- | -------- |
58e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode-1) {<br>MEDIA_LIBRARY_OK = 0,<br>MEDIA_LIBRARY_PERMISSION_DENIED = 201,<br>MEDIA_LIBRARY_PARAMETER_ERROR = 401,<br>MEDIA_LIBRARY_NO_SUCH_FILE = 23800101,<br>MEDIA_LIBRARY_INVALID_DISPLAY_NAME = 23800102,<br>MEDIA_LIBRARY_INVALID_ASSET_URI = 23800103,<br>MEDIA_LIBRARY_INVALID_PHOTO_KEY = 23800104,<br>MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED = 23800201,<br>MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR = 23800301<br>} | Enumerates the error codes.|
59e41f4b71Sopenharmony_ci| [MediaLibrary_DeliveryMode](#medialibrary_deliverymode-1) {<br>MEDIA_LIBRARY_FAST_MODE = 0,<br>MEDIA_LIBRARY_HIGH_QUALITY_MODE = 1,<br>MEDIA_LIBRARY_BALANCED_MODE = 2 } | Enumerates the delivery modes of the requested media asset.|
60e41f4b71Sopenharmony_ci| [MediaLibrary_MediaType](#medialibrary_mediatype-1) {<br>MEDIA_LIBRARY_IMAGE = 1,<br>MEDIA_LIBRARY_VIDEO = 2 } | Enumerates the media types.|
61e41f4b71Sopenharmony_ci| [MediaLibrary_MediaSubType](#medialibrary_mediasubtype-1) {<br>MEDIA_LIBRARY_DEFAULT = 0,<br>MEDIA_LIBRARY_MOVING_PHOTO = 3,<br>MEDIA_LIBRARY_BURST = 4 } | Enumerates the media subtypes.|
62e41f4b71Sopenharmony_ci| [MediaLibrary_ResourceType](#medialibrary_resourcetype-1) {<br>MEDIA_LIBRARY_IMAGE_RESOURCE = 1,<br>MEDIA_LIBRARY_VIDEO_RESOURCE = 2 } | Enumerates the media library resource types.|
63e41f4b71Sopenharmony_ci| [MediaLibrary_ImageFileType](#medialibrary_imagefiletype-1) {<br>MEDIA_LIBRARY_IMAGE_JPEG = 1 } | Enumerates the image file types.|
64e41f4b71Sopenharmony_ci| [MediaLibrary_MediaQuality](#medialibrary_mediaquality-1) {<br>MEDIA_LIBRARY_QUALITY_FAST = 1,<br>MEDIA_LIBRARY_QUALITY_FULL = 2 } | Enumerates the media resource quality.|
65e41f4b71Sopenharmony_ci| [MediaLibrary_MediaContentType](#medialibrary_mediacontenttype-1) {<br>MEDIA_LIBRARY_COMPRESSED = 1,<br>MEDIA_LIBRARY_PICTURE_OBJECT = 2 } | Enumerates the media content types.|
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci### Functions
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci| Name| Description|
71e41f4b71Sopenharmony_ci| -------- | -------- |
72e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAccessHelper_ApplyChanges](#oh_mediaaccesshelper_applychanges) ([OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \*changeRequest) | Applies changes to an asset or album.|
73e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetUri](#oh_mediaasset_geturi) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, const char \*\*uri) | Obtains the URI of a media asset.|
74e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetDisplayName](#oh_mediaasset_getdisplayname) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, const char \*\*displayName) | Obtains the displayed name of a media asset.|
75e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetSize](#oh_mediaasset_getsize) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, uint32_t \*size) | Obtains the size of a media asset file.|
76e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetDateModifiedMs](#oh_mediaasset_getdatemodifiedms) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, uint32_t \*dateModifiedMs) | Obtains the media asset modification time, in ms.|
77e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetWidth](#oh_mediaasset_getwidth) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, uint32_t \*width) | Obtains the image width (in pixels) of a media asset.|
78e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetHeight](#oh_mediaasset_getheight) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, uint32_t \*height) | Obtains the image height (in pixels) of a media asset.|
79e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_GetOrientation](#oh_mediaasset_getorientation) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset, uint32_t \*orientation) | Obtains the orientation of a media asset, in degrees.|
80e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAsset_Release](#oh_mediaasset_release) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset) | Releases a media asset.|
81e41f4b71Sopenharmony_ci| [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \* [OH_MediaAssetChangeRequest_Create](#oh_mediaassetchangerequest_create) ([OH_MediaAsset](#oh_mediaasset) \*mediaAsset) | Creates an [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.|
82e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAssetChangeRequest_AddResourceWithBuffer](#oh_mediaassetchangerequest_addresourcewithbuffer) ([OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \*changeRequest, [MediaLibrary_ResourceType](#medialibrary_resourcetype) resourceType, uint8_t \*buffer, uint32_t length) | Adds a resource using **ArrayBuffer** data.|
83e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAssetChangeRequest_SaveCameraPhoto](#oh_mediaassetchangerequest_savecameraphoto) ([OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \*changeRequest, [MediaLibrary_ImageFileType](#medialibrary_imagefiletype) imageFileType) | Saves the photo taken by the camera.|
84e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAssetChangeRequest_DiscardCameraPhoto](#oh_mediaassetchangerequest_discardcameraphoto) ([OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \*changeRequest) | Discards the photo taken by the camera.|
85e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAssetChangeRequest_Release](#oh_mediaassetchangerequest_release) ([OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) \*changeRequest) | Releases an [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.|
86e41f4b71Sopenharmony_ci| [OH_MediaAssetManager](#oh_mediaassetmanager) \* [OH_MediaAssetManager_Create](#oh_mediaassetmanager_create) (void) | Creates a **MediaAssetManager** instance.|
87e41f4b71Sopenharmony_ci| [MediaLibrary_RequestId](_media_library___request_id.md) [OH_MediaAssetManager_RequestImageForPath](#oh_mediaassetmanager_requestimageforpath) ([OH_MediaAssetManager](#oh_mediaassetmanager) \*manager, const char \*uri, [MediaLibrary_RequestOptions](_media_library___request_options.md) requestOptions, const char \*destPath, [OH_MediaLibrary_OnDataPrepared](#oh_medialibrary_ondataprepared) callback) | Requests an image in the specified directory.|
88e41f4b71Sopenharmony_ci| [MediaLibrary_RequestId](_media_library___request_id.md) [OH_MediaAssetManager_RequestVideoForPath](#oh_mediaassetmanager_requestvideoforpath) ([OH_MediaAssetManager](#oh_mediaassetmanager) \*manager, const char \*uri, [MediaLibrary_RequestOptions](_media_library___request_options.md) requestOptions, const char \*destPath, [OH_MediaLibrary_OnDataPrepared](#oh_medialibrary_ondataprepared) callback) | Requests a video in the specified directory.|
89e41f4b71Sopenharmony_ci| bool [OH_MediaAssetManager_CancelRequest](#oh_mediaassetmanager_cancelrequest) ([OH_MediaAssetManager](#oh_mediaassetmanager) \*manager, const [MediaLibrary_RequestId](_media_library___request_id.md) requestId) | Cancels a request based on the request ID.|
90e41f4b71Sopenharmony_ci| [MediaLibrary_ErrorCode](#medialibrary_errorcode) [OH_MediaAssetManager_RequestImage](#oh_mediaassetmanager_requestimage) ([OH_MediaAssetManager](#oh_mediaassetmanager) \*manager, [OH_MediaAsset](#oh_mediaasset) \*mediaAsset, [MediaLibrary_RequestOptions](_media_library___request_options.md) requestOptions, [MediaLibrary_RequestId](_media_library___request_id.md) \*requestId, [OH_MediaLibrary_OnImageDataPrepared](#oh_medialibrary_onimagedataprepared) callback) | Requests an image.|
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci## Type Description
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci### MediaLibrary_DeliveryMode
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci```
99e41f4b71Sopenharmony_citypedef enum MediaLibrary_DeliveryMode MediaLibrary_DeliveryMode
100e41f4b71Sopenharmony_ci```
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci**Description**
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ciDefines an enum for delivery modes of the requested media asset.
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ciThe delivery modes include the following:
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_FAST_MODE**: deliver the media asset available without considering its quality.
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_HIGH_QUALITY_MODE**: deliver a media asset with high quality. If there is no high-quality asset available, trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_BALANCED_MODE**: return the high-quality asset if there is any. Otherwise, return a low-quality asset first and trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci**Since**: 12
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci### MediaLibrary_ErrorCode
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci```
120e41f4b71Sopenharmony_citypedef enum MediaLibrary_ErrorCode MediaLibrary_ErrorCode
121e41f4b71Sopenharmony_ci```
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ci**Description**
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ciDefines an enum for error codes.
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci**Since**: 12
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci### MediaLibrary_ImageFileType
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci```
133e41f4b71Sopenharmony_citypedef enum MediaLibrary_ImageFileType MediaLibrary_ImageFileType
134e41f4b71Sopenharmony_ci```
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci**Description**
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ciDefines an enum for image file types.
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci**Since**: 12
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci### MediaLibrary_MediaContentType
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci```
146e41f4b71Sopenharmony_citypedef enum MediaLibrary_MediaContentType MediaLibrary_MediaContentType
147e41f4b71Sopenharmony_ci```
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci**Description**
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ciDefines an enum for media content types.
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci**Since**: 12
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci### MediaLibrary_MediaQuality
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci```
159e41f4b71Sopenharmony_citypedef enum MediaLibrary_MediaQuality MediaLibrary_MediaQuality
160e41f4b71Sopenharmony_ci```
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**Description**
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ciDefines an enum for media resource quality, which
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_civaries with the specified delivery mode for the requested media asset.
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_FAST_MODE**: deliver the media asset available without considering its quality.
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_HIGH_QUALITY_MODE**: deliver a media asset with high quality. If there is no high-quality asset available, trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_BALANCED_MODE**: return the high-quality asset if there is any. Otherwise, return a low-quality asset first and trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci**Since**: 12
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci### MediaLibrary_MediaSubType
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci```
180e41f4b71Sopenharmony_citypedef enum MediaLibrary_MediaSubType MediaLibrary_MediaSubType
181e41f4b71Sopenharmony_ci```
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ci**Description**
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ciDefine an enum for media subtypes.
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ci**Since**: 12
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci
190e41f4b71Sopenharmony_ci### MediaLibrary_MediaType
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci```
193e41f4b71Sopenharmony_citypedef enum MediaLibrary_MediaType MediaLibrary_MediaType
194e41f4b71Sopenharmony_ci```
195e41f4b71Sopenharmony_ci
196e41f4b71Sopenharmony_ci**Description**
197e41f4b71Sopenharmony_ci
198e41f4b71Sopenharmony_ciDefine an enum for media types.
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ci**Since**: 12
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci### MediaLibrary_RequestId
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ci```
206e41f4b71Sopenharmony_citypedef struct MediaLibrary_RequestId MediaLibrary_RequestId
207e41f4b71Sopenharmony_ci```
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci**Description**
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ciDefines a request ID.
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ciA value of this type is returned when a media asset is requested. The request ID can be used to cancel a request. If a request fails, an all-zero value, for example, **00000000-0000-0000-0000-000000000000** is returned.
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci**Since**: 12
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci
218e41f4b71Sopenharmony_ci### MediaLibrary_RequestOptions
219e41f4b71Sopenharmony_ci
220e41f4b71Sopenharmony_ci```
221e41f4b71Sopenharmony_citypedef struct MediaLibrary_RequestOptions MediaLibrary_RequestOptions
222e41f4b71Sopenharmony_ci```
223e41f4b71Sopenharmony_ci
224e41f4b71Sopenharmony_ci**Description**
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ciDefines how media assets are requested and processed.
227e41f4b71Sopenharmony_ci
228e41f4b71Sopenharmony_ciYou can use this struct to set options related to the media asset quality, delivery mode, and more.
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ci**Since**: 12
231e41f4b71Sopenharmony_ci
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci### MediaLibrary_ResourceType
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci```
236e41f4b71Sopenharmony_citypedef enum MediaLibrary_ResourceType MediaLibrary_ResourceType
237e41f4b71Sopenharmony_ci```
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci**Description**
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ciDefine an enum for media library resource types.
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**Since**: 12
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ci### OH_MediaAsset
247e41f4b71Sopenharmony_ci
248e41f4b71Sopenharmony_ci```
249e41f4b71Sopenharmony_citypedef struct OH_MediaAsset OH_MediaAsset
250e41f4b71Sopenharmony_ci```
251e41f4b71Sopenharmony_ci
252e41f4b71Sopenharmony_ci**Description**
253e41f4b71Sopenharmony_ci
254e41f4b71Sopenharmony_ciDefines a struct for a media asset.
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ciThis struct provides the capability of encapsulating media file attributes.
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci**Since**: 12
259e41f4b71Sopenharmony_ci
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci```
264e41f4b71Sopenharmony_citypedef struct OH_MediaAssetChangeRequest OH_MediaAssetChangeRequest
265e41f4b71Sopenharmony_ci```
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci**Description**
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_ciDefines a struct for a media asset change request.
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ciThis struct provides the capability of handling media asset change requests.
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**Since**: 12
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_ci### OH_MediaAssetManager
277e41f4b71Sopenharmony_ci
278e41f4b71Sopenharmony_ci```
279e41f4b71Sopenharmony_citypedef struct OH_MediaAssetManager OH_MediaAssetManager
280e41f4b71Sopenharmony_ci```
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci**Description**
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ciDefines a struct for the media asset manager.
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ciYou can use this struct to create a media asset manager instance. If the creation fails, a null pointer is returned.
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci**Since**: 12
289e41f4b71Sopenharmony_ci
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ci### OH_MediaLibrary_OnDataPrepared
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ci```
294e41f4b71Sopenharmony_citypedef void (*OH_MediaLibrary_OnDataPrepared)(int32_t result, MediaLibrary_RequestId requestId)
295e41f4b71Sopenharmony_ci```
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci**Description**
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ciDefines a function pointer to the callback to be invoked when the requested media asset is ready.
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci**Since**: 12
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci**Parameters**
304e41f4b71Sopenharmony_ci
305e41f4b71Sopenharmony_ci| Name| Description|
306e41f4b71Sopenharmony_ci| -------- | -------- |
307e41f4b71Sopenharmony_ci| result | Processing result of the requested asset.|
308e41f4b71Sopenharmony_ci| requestId | Request ID.|
309e41f4b71Sopenharmony_ci
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ci### OH_MediaLibrary_OnImageDataPrepared
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci```
314e41f4b71Sopenharmony_citypedef void (*OH_MediaLibrary_OnImageDataPrepared)(MediaLibrary_ErrorCode result, MediaLibrary_RequestId requestId, MediaLibrary_MediaQuality mediaQuality, MediaLibrary_MediaContentType type, OH_ImageSourceNative* imageSourceNative)
315e41f4b71Sopenharmony_ci```
316e41f4b71Sopenharmony_ci
317e41f4b71Sopenharmony_ci**Description**
318e41f4b71Sopenharmony_ci
319e41f4b71Sopenharmony_ciDefines a function pointer to the callback to be invoked when the requested image is ready.
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_ciThis callback is called when the requested image source is ready.
322e41f4b71Sopenharmony_ci
323e41f4b71Sopenharmony_ci**Since**: 12
324e41f4b71Sopenharmony_ci
325e41f4b71Sopenharmony_ci**Parameters**
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_ci| Name| Description|
328e41f4b71Sopenharmony_ci| -------- | -------- |
329e41f4b71Sopenharmony_ci| result | [MediaLibrary_ErrorCode](#medialibrary_errorcode-1).|
330e41f4b71Sopenharmony_ci| requestId | [MediaLibrary_RequestId](_media_library___request_id.md).|
331e41f4b71Sopenharmony_ci| mediaQuality | [MediaLibrary_MediaQuality](#medialibrary_mediaquality-1).|
332e41f4b71Sopenharmony_ci| type | [MediaLibrary_MediaContentType](#medialibrary_mediacontenttype-1).|
333e41f4b71Sopenharmony_ci| imageSourceNative | [OH_ImageSourceNative](../apis-image-kit/_image___native_module.md#oh_imagesourcenative) obtained when the requested image source is ready.|
334e41f4b71Sopenharmony_ci
335e41f4b71Sopenharmony_ci
336e41f4b71Sopenharmony_ci## Enum Description
337e41f4b71Sopenharmony_ci
338e41f4b71Sopenharmony_ci
339e41f4b71Sopenharmony_ci### MediaLibrary_DeliveryMode
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci```
342e41f4b71Sopenharmony_cienum MediaLibrary_DeliveryMode
343e41f4b71Sopenharmony_ci```
344e41f4b71Sopenharmony_ci
345e41f4b71Sopenharmony_ci**Description**
346e41f4b71Sopenharmony_ci
347e41f4b71Sopenharmony_ciEnumerates the delivery modes of the requested media asset.
348e41f4b71Sopenharmony_ci
349e41f4b71Sopenharmony_ciThe delivery modes include the following:
350e41f4b71Sopenharmony_ci
351e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_FAST_MODE**: deliver the media asset available without considering its quality.
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_HIGH_QUALITY_MODE**: deliver a media asset with high quality. If there is no high-quality asset available, trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_BALANCED_MODE**: return the high-quality asset if there is any. Otherwise, return a low-quality asset first and trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
356e41f4b71Sopenharmony_ci
357e41f4b71Sopenharmony_ci**Since**: 12
358e41f4b71Sopenharmony_ci
359e41f4b71Sopenharmony_ci| Value| Description|
360e41f4b71Sopenharmony_ci| -------- | -------- |
361e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_FAST_MODE | Fast mode.|
362e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_HIGH_QUALITY_MODE | High-quality mode.|
363e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_BALANCED_MODE | Balance mode.|
364e41f4b71Sopenharmony_ci
365e41f4b71Sopenharmony_ci
366e41f4b71Sopenharmony_ci### MediaLibrary_ErrorCode
367e41f4b71Sopenharmony_ci
368e41f4b71Sopenharmony_ci```
369e41f4b71Sopenharmony_cienum MediaLibrary_ErrorCode
370e41f4b71Sopenharmony_ci```
371e41f4b71Sopenharmony_ci
372e41f4b71Sopenharmony_ci**Description**
373e41f4b71Sopenharmony_ci
374e41f4b71Sopenharmony_ciEnumerates the error codes.
375e41f4b71Sopenharmony_ci
376e41f4b71Sopenharmony_ci**Since**: 12
377e41f4b71Sopenharmony_ci
378e41f4b71Sopenharmony_ci| Value| Description|
379e41f4b71Sopenharmony_ci| -------- | -------- |
380e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_OK | The operation is successful. |
381e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_PERMISSION_DENIED | The permission is denied. |
382e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_PARAMETER_ERROR | Mandatory parameter is not specified, the parameter type is incorrect, or parameter verification failed. |
383e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_NO_SUCH_FILE | The file does not exist.|
384e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_INVALID_DISPLAY_NAME | The name displayed is incorrect. |
385e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_INVALID_ASSET_URI | The asset URI is invalid. |
386e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_INVALID_PHOTO_KEY | **PhotoKey** is invalid. |
387e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED | The operation is not supported. |
388e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR | An internal system error is detected. Possible causes include the following:<br>1. Database corrupted.<br>2. File system error.<br>3. IPC request timed out. |
389e41f4b71Sopenharmony_ci
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci### MediaLibrary_ImageFileType
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_ci```
394e41f4b71Sopenharmony_cienum MediaLibrary_ImageFileType
395e41f4b71Sopenharmony_ci```
396e41f4b71Sopenharmony_ci
397e41f4b71Sopenharmony_ci**Description**
398e41f4b71Sopenharmony_ci
399e41f4b71Sopenharmony_ciEnumerates the image file types.
400e41f4b71Sopenharmony_ci
401e41f4b71Sopenharmony_ci**Since**: 12
402e41f4b71Sopenharmony_ci
403e41f4b71Sopenharmony_ci| Value| Description|
404e41f4b71Sopenharmony_ci| -------- | -------- |
405e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_IMAGE_JPEG | JPEG.|
406e41f4b71Sopenharmony_ci
407e41f4b71Sopenharmony_ci
408e41f4b71Sopenharmony_ci### MediaLibrary_MediaContentType
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ci```
411e41f4b71Sopenharmony_cienum MediaLibrary_MediaContentType
412e41f4b71Sopenharmony_ci```
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_ci**Description**
415e41f4b71Sopenharmony_ci
416e41f4b71Sopenharmony_ciEnumerates the media content types.
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ci**Since**: 12
419e41f4b71Sopenharmony_ci
420e41f4b71Sopenharmony_ci| Value| Description|
421e41f4b71Sopenharmony_ci| -------- | -------- |
422e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_COMPRESSED | Compressed media content.|
423e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_PICTURE_OBJECT | Image object.|
424e41f4b71Sopenharmony_ci
425e41f4b71Sopenharmony_ci
426e41f4b71Sopenharmony_ci### MediaLibrary_MediaQuality
427e41f4b71Sopenharmony_ci
428e41f4b71Sopenharmony_ci```
429e41f4b71Sopenharmony_cienum MediaLibrary_MediaQuality
430e41f4b71Sopenharmony_ci```
431e41f4b71Sopenharmony_ci
432e41f4b71Sopenharmony_ci**Description**
433e41f4b71Sopenharmony_ci
434e41f4b71Sopenharmony_ciEnumerates the media resource quality, which varies with the specified delivery mode for the requested media asset.
435e41f4b71Sopenharmony_ci
436e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_FAST_MODE**: deliver the media asset available without considering its quality.
437e41f4b71Sopenharmony_ci
438e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_HIGH_QUALITY_MODE**: deliver a media asset with high quality. If there is no high-quality asset available, trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
439e41f4b71Sopenharmony_ci
440e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_BALANCED_MODE**: return the high-quality asset if there is any. Otherwise, return a low-quality asset first and trigger the process for creating a high-quality asset. Then, return the high-quality asset that is successfully created.
441e41f4b71Sopenharmony_ci
442e41f4b71Sopenharmony_ci**Since**: 12
443e41f4b71Sopenharmony_ci
444e41f4b71Sopenharmony_ci| Value| Description|
445e41f4b71Sopenharmony_ci| -------- | -------- |
446e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_QUALITY_FAST | Media asset available without considering its quality.|
447e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_QUALITY_FULL | High-quality media asset.|
448e41f4b71Sopenharmony_ci
449e41f4b71Sopenharmony_ci
450e41f4b71Sopenharmony_ci### MediaLibrary_MediaSubType
451e41f4b71Sopenharmony_ci
452e41f4b71Sopenharmony_ci```
453e41f4b71Sopenharmony_cienum MediaLibrary_MediaSubType
454e41f4b71Sopenharmony_ci```
455e41f4b71Sopenharmony_ci
456e41f4b71Sopenharmony_ci**Description**
457e41f4b71Sopenharmony_ci
458e41f4b71Sopenharmony_ciEnumerates the media subtypes.
459e41f4b71Sopenharmony_ci
460e41f4b71Sopenharmony_ci**Since**: 12
461e41f4b71Sopenharmony_ci
462e41f4b71Sopenharmony_ci| Value| Description|
463e41f4b71Sopenharmony_ci| -------- | -------- |
464e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_DEFAULT | Photo (default type).|
465e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_MOVING_PHOTO | Moving photo.|
466e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_BURST | Burst photo.|
467e41f4b71Sopenharmony_ci
468e41f4b71Sopenharmony_ci
469e41f4b71Sopenharmony_ci### MediaLibrary_MediaType
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_ci```
472e41f4b71Sopenharmony_cienum MediaLibrary_MediaType
473e41f4b71Sopenharmony_ci```
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci**Description**
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ciEnumerates the media types.
478e41f4b71Sopenharmony_ci
479e41f4b71Sopenharmony_ci**Since**: 12
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci| Value| Description|
482e41f4b71Sopenharmony_ci| -------- | -------- |
483e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_IMAGE | Image.|
484e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_VIDEO | Video.|
485e41f4b71Sopenharmony_ci
486e41f4b71Sopenharmony_ci
487e41f4b71Sopenharmony_ci### MediaLibrary_ResourceType
488e41f4b71Sopenharmony_ci
489e41f4b71Sopenharmony_ci```
490e41f4b71Sopenharmony_cienum MediaLibrary_ResourceType
491e41f4b71Sopenharmony_ci```
492e41f4b71Sopenharmony_ci
493e41f4b71Sopenharmony_ci**Description**
494e41f4b71Sopenharmony_ci
495e41f4b71Sopenharmony_ciEnumerates the media library resource types.
496e41f4b71Sopenharmony_ci
497e41f4b71Sopenharmony_ci**Since**: 12
498e41f4b71Sopenharmony_ci
499e41f4b71Sopenharmony_ci| Value| Description|
500e41f4b71Sopenharmony_ci| -------- | -------- |
501e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_IMAGE_RESOURCE | Image resource.|
502e41f4b71Sopenharmony_ci| MEDIA_LIBRARY_VIDEO_RESOURCE | Video resource.|
503e41f4b71Sopenharmony_ci
504e41f4b71Sopenharmony_ci
505e41f4b71Sopenharmony_ci## Function Description
506e41f4b71Sopenharmony_ci
507e41f4b71Sopenharmony_ci
508e41f4b71Sopenharmony_ci### OH_MediaAccessHelper_ApplyChanges()
509e41f4b71Sopenharmony_ci
510e41f4b71Sopenharmony_ci```
511e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAccessHelper_ApplyChanges(OH_MediaAssetChangeRequest* changeRequest)
512e41f4b71Sopenharmony_ci```
513e41f4b71Sopenharmony_ci
514e41f4b71Sopenharmony_ci**Description**
515e41f4b71Sopenharmony_ci
516e41f4b71Sopenharmony_ciApplies changes to an asset or album.
517e41f4b71Sopenharmony_ci
518e41f4b71Sopenharmony_ci**Since**: 12
519e41f4b71Sopenharmony_ci
520e41f4b71Sopenharmony_ci**Parameters**
521e41f4b71Sopenharmony_ci
522e41f4b71Sopenharmony_ci| Name| Description|
523e41f4b71Sopenharmony_ci| -------- | -------- |
524e41f4b71Sopenharmony_ci| changeRequest | Pointer to the [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance. |
525e41f4b71Sopenharmony_ci
526e41f4b71Sopenharmony_ci**Required permissions**
527e41f4b71Sopenharmony_ci
528e41f4b71Sopenharmony_ciohos.permission.WRITE_IMAGEVIDEO
529e41f4b71Sopenharmony_ci
530e41f4b71Sopenharmony_ci**Returns**
531e41f4b71Sopenharmony_ci
532e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
533e41f4b71Sopenharmony_ci
534e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
535e41f4b71Sopenharmony_ci
536e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
537e41f4b71Sopenharmony_ci  Possible causes:
538e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
539e41f4b71Sopenharmony_ci  
540e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
541e41f4b71Sopenharmony_ci  
542e41f4b71Sopenharmony_ci  3. The parameter verification failed.
543e41f4b71Sopenharmony_ci
544e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PERMISSION_DENIED**: The permission is denied.
545e41f4b71Sopenharmony_ci
546e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
547e41f4b71Sopenharmony_ci
548e41f4b71Sopenharmony_ci
549e41f4b71Sopenharmony_ci### OH_MediaAsset_GetDateModifiedMs()
550e41f4b71Sopenharmony_ci
551e41f4b71Sopenharmony_ci```
552e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetDateModifiedMs(OH_MediaAsset* mediaAsset, uint32_t* dateModifiedMs)
553e41f4b71Sopenharmony_ci```
554e41f4b71Sopenharmony_ci
555e41f4b71Sopenharmony_ci**Description**
556e41f4b71Sopenharmony_ci
557e41f4b71Sopenharmony_ciObtains the media asset modification time, in ms.
558e41f4b71Sopenharmony_ci
559e41f4b71Sopenharmony_ci**Since**: 12
560e41f4b71Sopenharmony_ci
561e41f4b71Sopenharmony_ci**Parameters**
562e41f4b71Sopenharmony_ci
563e41f4b71Sopenharmony_ci| Name| Description|
564e41f4b71Sopenharmony_ci| -------- | -------- |
565e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
566e41f4b71Sopenharmony_ci| dateModifiedMs | Pointer to the asset modification time obtained, in ms. |
567e41f4b71Sopenharmony_ci
568e41f4b71Sopenharmony_ci**Returns**
569e41f4b71Sopenharmony_ci
570e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
571e41f4b71Sopenharmony_ci
572e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
573e41f4b71Sopenharmony_ci
574e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
575e41f4b71Sopenharmony_ci  Possible causes:
576e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
577e41f4b71Sopenharmony_ci  
578e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
579e41f4b71Sopenharmony_ci  
580e41f4b71Sopenharmony_ci  3. The parameter verification failed.
581e41f4b71Sopenharmony_ci
582e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
583e41f4b71Sopenharmony_ci
584e41f4b71Sopenharmony_ci
585e41f4b71Sopenharmony_ci### OH_MediaAsset_GetDisplayName()
586e41f4b71Sopenharmony_ci
587e41f4b71Sopenharmony_ci```
588e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetDisplayName(OH_MediaAsset* mediaAsset, const char** displayName)
589e41f4b71Sopenharmony_ci```
590e41f4b71Sopenharmony_ci
591e41f4b71Sopenharmony_ci**Description**
592e41f4b71Sopenharmony_ci
593e41f4b71Sopenharmony_ciObtains the displayed name of a media asset.
594e41f4b71Sopenharmony_ci
595e41f4b71Sopenharmony_ci**Since**: 12
596e41f4b71Sopenharmony_ci
597e41f4b71Sopenharmony_ci**Parameters**
598e41f4b71Sopenharmony_ci
599e41f4b71Sopenharmony_ci| Name| Description|
600e41f4b71Sopenharmony_ci| -------- | -------- |
601e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
602e41f4b71Sopenharmony_ci| displayName | Pointer to the displayed name obtained.|
603e41f4b71Sopenharmony_ci
604e41f4b71Sopenharmony_ci**Returns**
605e41f4b71Sopenharmony_ci
606e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
607e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
608e41f4b71Sopenharmony_ci
609e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
610e41f4b71Sopenharmony_ci  Possible causes:
611e41f4b71Sopenharmony_ci
612e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
613e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
614e41f4b71Sopenharmony_ci  3. The parameter verification failed.
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
617e41f4b71Sopenharmony_ci
618e41f4b71Sopenharmony_ci
619e41f4b71Sopenharmony_ci### OH_MediaAsset_GetHeight()
620e41f4b71Sopenharmony_ci
621e41f4b71Sopenharmony_ci```
622e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetHeight(OH_MediaAsset* mediaAsset, uint32_t* height)
623e41f4b71Sopenharmony_ci```
624e41f4b71Sopenharmony_ci
625e41f4b71Sopenharmony_ci**Description**
626e41f4b71Sopenharmony_ci
627e41f4b71Sopenharmony_ciObtains the image height (in pixels) of a media asset.
628e41f4b71Sopenharmony_ci
629e41f4b71Sopenharmony_ci**Since**: 12
630e41f4b71Sopenharmony_ci
631e41f4b71Sopenharmony_ci**Parameters**
632e41f4b71Sopenharmony_ci
633e41f4b71Sopenharmony_ci| Name| Description|
634e41f4b71Sopenharmony_ci| -------- | -------- |
635e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
636e41f4b71Sopenharmony_ci| height | Pointer to the image height of the media resource, in pixels.|
637e41f4b71Sopenharmony_ci
638e41f4b71Sopenharmony_ci**Returns**
639e41f4b71Sopenharmony_ci
640e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
641e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
642e41f4b71Sopenharmony_ci
643e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
644e41f4b71Sopenharmony_ci  Possible causes:
645e41f4b71Sopenharmony_ci
646e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
647e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
648e41f4b71Sopenharmony_ci  3. The parameter verification failed.
649e41f4b71Sopenharmony_ci
650e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
651e41f4b71Sopenharmony_ci
652e41f4b71Sopenharmony_ci
653e41f4b71Sopenharmony_ci### OH_MediaAsset_GetOrientation()
654e41f4b71Sopenharmony_ci
655e41f4b71Sopenharmony_ci```
656e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetOrientation(OH_MediaAsset* mediaAsset, uint32_t* orientation)
657e41f4b71Sopenharmony_ci```
658e41f4b71Sopenharmony_ci
659e41f4b71Sopenharmony_ci**Description**
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ciObtains the orientation of a media asset, in degrees.
662e41f4b71Sopenharmony_ci
663e41f4b71Sopenharmony_ci**Since**: 12
664e41f4b71Sopenharmony_ci
665e41f4b71Sopenharmony_ci**Parameters**
666e41f4b71Sopenharmony_ci
667e41f4b71Sopenharmony_ci| Name| Description|
668e41f4b71Sopenharmony_ci| -------- | -------- |
669e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
670e41f4b71Sopenharmony_ci| orientation | Pointer to the orientation of the image obtained, in degrees.|
671e41f4b71Sopenharmony_ci
672e41f4b71Sopenharmony_ci**Returns**
673e41f4b71Sopenharmony_ci
674e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
675e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
676e41f4b71Sopenharmony_ci
677e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
678e41f4b71Sopenharmony_ci  Possible causes:
679e41f4b71Sopenharmony_ci
680e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
681e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
682e41f4b71Sopenharmony_ci  3. The parameter verification failed.
683e41f4b71Sopenharmony_ci
684e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
685e41f4b71Sopenharmony_ci
686e41f4b71Sopenharmony_ci
687e41f4b71Sopenharmony_ci### OH_MediaAsset_GetSize()
688e41f4b71Sopenharmony_ci
689e41f4b71Sopenharmony_ci```
690e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetSize(OH_MediaAsset* mediaAsset, uint32_t* size)
691e41f4b71Sopenharmony_ci```
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_ci**Description**
694e41f4b71Sopenharmony_ci
695e41f4b71Sopenharmony_ciObtains the size of a media asset file.
696e41f4b71Sopenharmony_ci
697e41f4b71Sopenharmony_ci**Since**: 12
698e41f4b71Sopenharmony_ci
699e41f4b71Sopenharmony_ci**Parameters**
700e41f4b71Sopenharmony_ci
701e41f4b71Sopenharmony_ci| Name| Description|
702e41f4b71Sopenharmony_ci| -------- | -------- |
703e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
704e41f4b71Sopenharmony_ci| size | Pointer to the file size obtained, in bytes.|
705e41f4b71Sopenharmony_ci
706e41f4b71Sopenharmony_ci**Returns**
707e41f4b71Sopenharmony_ci
708e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
709e41f4b71Sopenharmony_ci
710e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
711e41f4b71Sopenharmony_ci
712e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
713e41f4b71Sopenharmony_ci  Possible causes:
714e41f4b71Sopenharmony_ci
715e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
716e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
717e41f4b71Sopenharmony_ci  3. The parameter verification failed.
718e41f4b71Sopenharmony_ci
719e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
720e41f4b71Sopenharmony_ci
721e41f4b71Sopenharmony_ci
722e41f4b71Sopenharmony_ci### OH_MediaAsset_GetUri()
723e41f4b71Sopenharmony_ci
724e41f4b71Sopenharmony_ci```
725e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetUri(OH_MediaAsset* mediaAsset, const char** uri)
726e41f4b71Sopenharmony_ci```
727e41f4b71Sopenharmony_ci
728e41f4b71Sopenharmony_ci**Description**
729e41f4b71Sopenharmony_ci
730e41f4b71Sopenharmony_ciObtains the URI of a media asset.
731e41f4b71Sopenharmony_ci
732e41f4b71Sopenharmony_ci**Since**: 12
733e41f4b71Sopenharmony_ci
734e41f4b71Sopenharmony_ci**Parameters**
735e41f4b71Sopenharmony_ci
736e41f4b71Sopenharmony_ci| Name| Description|
737e41f4b71Sopenharmony_ci| -------- | -------- |
738e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
739e41f4b71Sopenharmony_ci| uri | Pointer to the URI obtained.|
740e41f4b71Sopenharmony_ci
741e41f4b71Sopenharmony_ci**Returns**
742e41f4b71Sopenharmony_ci
743e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
744e41f4b71Sopenharmony_ci
745e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
746e41f4b71Sopenharmony_ci
747e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
748e41f4b71Sopenharmony_ci  Possible causes:
749e41f4b71Sopenharmony_ci
750e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
751e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
752e41f4b71Sopenharmony_ci  3. The parameter verification failed.
753e41f4b71Sopenharmony_ci
754e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
755e41f4b71Sopenharmony_ci
756e41f4b71Sopenharmony_ci
757e41f4b71Sopenharmony_ci### OH_MediaAsset_GetWidth()
758e41f4b71Sopenharmony_ci
759e41f4b71Sopenharmony_ci```
760e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_GetWidth(OH_MediaAsset* mediaAsset, uint32_t* width)
761e41f4b71Sopenharmony_ci```
762e41f4b71Sopenharmony_ci
763e41f4b71Sopenharmony_ci**Description**
764e41f4b71Sopenharmony_ci
765e41f4b71Sopenharmony_ciObtains the image width (in pixels) of a media asset.
766e41f4b71Sopenharmony_ci
767e41f4b71Sopenharmony_ci**Since**: 12
768e41f4b71Sopenharmony_ci
769e41f4b71Sopenharmony_ci**Parameters**
770e41f4b71Sopenharmony_ci
771e41f4b71Sopenharmony_ci| Name| Description|
772e41f4b71Sopenharmony_ci| -------- | -------- |
773e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
774e41f4b71Sopenharmony_ci| width | Pointer to the image width obtained, in pixels.|
775e41f4b71Sopenharmony_ci
776e41f4b71Sopenharmony_ci**Returns**
777e41f4b71Sopenharmony_ci
778e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
779e41f4b71Sopenharmony_ci
780e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
781e41f4b71Sopenharmony_ci
782e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
783e41f4b71Sopenharmony_ci  Possible causes:
784e41f4b71Sopenharmony_ci
785e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
786e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
787e41f4b71Sopenharmony_ci  3. The parameter verification failed.
788e41f4b71Sopenharmony_ci
789e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
790e41f4b71Sopenharmony_ci
791e41f4b71Sopenharmony_ci
792e41f4b71Sopenharmony_ci### OH_MediaAsset_Release()
793e41f4b71Sopenharmony_ci
794e41f4b71Sopenharmony_ci```
795e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAsset_Release(OH_MediaAsset* mediaAsset)
796e41f4b71Sopenharmony_ci```
797e41f4b71Sopenharmony_ci
798e41f4b71Sopenharmony_ci**Description**
799e41f4b71Sopenharmony_ci
800e41f4b71Sopenharmony_ciReleases a media asset.
801e41f4b71Sopenharmony_ci
802e41f4b71Sopenharmony_ci**Since**: 12
803e41f4b71Sopenharmony_ci
804e41f4b71Sopenharmony_ci**Parameters**
805e41f4b71Sopenharmony_ci
806e41f4b71Sopenharmony_ci| Name| Description|
807e41f4b71Sopenharmony_ci| -------- | -------- |
808e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance to release. |
809e41f4b71Sopenharmony_ci
810e41f4b71Sopenharmony_ci**Returns**
811e41f4b71Sopenharmony_ci
812e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
813e41f4b71Sopenharmony_ci
814e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
815e41f4b71Sopenharmony_ci
816e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
817e41f4b71Sopenharmony_ci  Possible causes:
818e41f4b71Sopenharmony_ci
819e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
820e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
821e41f4b71Sopenharmony_ci  3. The parameter verification failed.
822e41f4b71Sopenharmony_ci
823e41f4b71Sopenharmony_ci
824e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest_AddResourceWithBuffer()
825e41f4b71Sopenharmony_ci
826e41f4b71Sopenharmony_ci```
827e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithBuffer(OH_MediaAssetChangeRequest* changeRequest, MediaLibrary_ResourceType resourceType, uint8_t* buffer, uint32_t length)
828e41f4b71Sopenharmony_ci```
829e41f4b71Sopenharmony_ci
830e41f4b71Sopenharmony_ci**Description**
831e41f4b71Sopenharmony_ci
832e41f4b71Sopenharmony_ciAdds a resource using **ArrayBuffer** data.
833e41f4b71Sopenharmony_ci
834e41f4b71Sopenharmony_ci**Since**: 12
835e41f4b71Sopenharmony_ci
836e41f4b71Sopenharmony_ci**Parameters**
837e41f4b71Sopenharmony_ci
838e41f4b71Sopenharmony_ci| Name| Description|
839e41f4b71Sopenharmony_ci| -------- | -------- |
840e41f4b71Sopenharmony_ci| changeRequest | Pointer to the [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.|
841e41f4b71Sopenharmony_ci| resourceType | [MediaLibrary_ResourceType](#medialibrary_resourcetype) of the resource to add.|
842e41f4b71Sopenharmony_ci| buffer | Pointe to the data buffer.|
843e41f4b71Sopenharmony_ci| length | Length of the data buffer.|
844e41f4b71Sopenharmony_ci
845e41f4b71Sopenharmony_ci**Returns**
846e41f4b71Sopenharmony_ci
847e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
848e41f4b71Sopenharmony_ci
849e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
850e41f4b71Sopenharmony_ci
851e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
852e41f4b71Sopenharmony_ci  Possible causes:
853e41f4b71Sopenharmony_ci
854e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
855e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
856e41f4b71Sopenharmony_ci  3. The parameter verification failed.
857e41f4b71Sopenharmony_ci
858e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
859e41f4b71Sopenharmony_ci
860e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED**: This operation is not supported.
861e41f4b71Sopenharmony_ci
862e41f4b71Sopenharmony_ci
863e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest_Create()
864e41f4b71Sopenharmony_ci
865e41f4b71Sopenharmony_ci```
866e41f4b71Sopenharmony_ciOH_MediaAssetChangeRequest* OH_MediaAssetChangeRequest_Create(OH_MediaAsset* mediaAsset)
867e41f4b71Sopenharmony_ci```
868e41f4b71Sopenharmony_ci
869e41f4b71Sopenharmony_ci**Description**
870e41f4b71Sopenharmony_ci
871e41f4b71Sopenharmony_ciCreates an [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.
872e41f4b71Sopenharmony_ci
873e41f4b71Sopenharmony_ci**Since**: 12
874e41f4b71Sopenharmony_ci
875e41f4b71Sopenharmony_ci**Parameters**
876e41f4b71Sopenharmony_ci
877e41f4b71Sopenharmony_ci| Name| Description|
878e41f4b71Sopenharmony_ci| -------- | -------- |
879e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance.|
880e41f4b71Sopenharmony_ci
881e41f4b71Sopenharmony_ci**Returns**
882e41f4b71Sopenharmony_ci
883e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
884e41f4b71Sopenharmony_ci
885e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
886e41f4b71Sopenharmony_ci
887e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
888e41f4b71Sopenharmony_ci  Possible causes:
889e41f4b71Sopenharmony_ci
890e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
891e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
892e41f4b71Sopenharmony_ci  3. The parameter verification failed.
893e41f4b71Sopenharmony_ci
894e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
895e41f4b71Sopenharmony_ci
896e41f4b71Sopenharmony_ci
897e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest_DiscardCameraPhoto()
898e41f4b71Sopenharmony_ci
899e41f4b71Sopenharmony_ci```
900e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAssetChangeRequest_DiscardCameraPhoto(OH_MediaAssetChangeRequest* changeRequest)
901e41f4b71Sopenharmony_ci```
902e41f4b71Sopenharmony_ci
903e41f4b71Sopenharmony_ci**Description**
904e41f4b71Sopenharmony_ci
905e41f4b71Sopenharmony_ciDiscards the photo taken by the camera.
906e41f4b71Sopenharmony_ci
907e41f4b71Sopenharmony_ci**Since**: 12
908e41f4b71Sopenharmony_ci
909e41f4b71Sopenharmony_ci**Parameters**
910e41f4b71Sopenharmony_ci
911e41f4b71Sopenharmony_ci| Name| Description|
912e41f4b71Sopenharmony_ci| -------- | -------- |
913e41f4b71Sopenharmony_ci| changeRequest | Pointer to the [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.|
914e41f4b71Sopenharmony_ci
915e41f4b71Sopenharmony_ci**Returns**
916e41f4b71Sopenharmony_ci
917e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
918e41f4b71Sopenharmony_ci
919e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
920e41f4b71Sopenharmony_ci
921e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
922e41f4b71Sopenharmony_ci  Possible causes:
923e41f4b71Sopenharmony_ci
924e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
925e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
926e41f4b71Sopenharmony_ci  3. The parameter verification failed.
927e41f4b71Sopenharmony_ci
928e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
929e41f4b71Sopenharmony_ci
930e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED**: This operation is not supported.
931e41f4b71Sopenharmony_ci
932e41f4b71Sopenharmony_ci
933e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest_Release()
934e41f4b71Sopenharmony_ci
935e41f4b71Sopenharmony_ci```
936e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAssetChangeRequest_Release(OH_MediaAssetChangeRequest* changeRequest)
937e41f4b71Sopenharmony_ci```
938e41f4b71Sopenharmony_ci
939e41f4b71Sopenharmony_ci**Description**
940e41f4b71Sopenharmony_ci
941e41f4b71Sopenharmony_ciReleases an [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.
942e41f4b71Sopenharmony_ci
943e41f4b71Sopenharmony_ci**Since**: 12
944e41f4b71Sopenharmony_ci
945e41f4b71Sopenharmony_ci**Parameters**
946e41f4b71Sopenharmony_ci
947e41f4b71Sopenharmony_ci| Name| Description|
948e41f4b71Sopenharmony_ci| -------- | -------- |
949e41f4b71Sopenharmony_ci| changeRequest | Pointer to the [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance to release.|
950e41f4b71Sopenharmony_ci
951e41f4b71Sopenharmony_ci**Returns**
952e41f4b71Sopenharmony_ci
953e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
954e41f4b71Sopenharmony_ci
955e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
956e41f4b71Sopenharmony_ci
957e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
958e41f4b71Sopenharmony_ci  Possible causes:
959e41f4b71Sopenharmony_ci
960e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
961e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
962e41f4b71Sopenharmony_ci  3. The parameter verification failed.
963e41f4b71Sopenharmony_ci
964e41f4b71Sopenharmony_ci
965e41f4b71Sopenharmony_ci### OH_MediaAssetChangeRequest_SaveCameraPhoto()
966e41f4b71Sopenharmony_ci
967e41f4b71Sopenharmony_ci```
968e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAssetChangeRequest_SaveCameraPhoto(OH_MediaAssetChangeRequest* changeRequest, MediaLibrary_ImageFileType imageFileType)
969e41f4b71Sopenharmony_ci```
970e41f4b71Sopenharmony_ci
971e41f4b71Sopenharmony_ci**Description**
972e41f4b71Sopenharmony_ci
973e41f4b71Sopenharmony_ciSaves the photo taken by the camera.
974e41f4b71Sopenharmony_ci
975e41f4b71Sopenharmony_ci**Since**: 12
976e41f4b71Sopenharmony_ci
977e41f4b71Sopenharmony_ci**Parameters**
978e41f4b71Sopenharmony_ci
979e41f4b71Sopenharmony_ci| Name| Description|
980e41f4b71Sopenharmony_ci| -------- | -------- |
981e41f4b71Sopenharmony_ci| changeRequest | Pointer to the [OH_MediaAssetChangeRequest](#oh_mediaassetchangerequest) instance.|
982e41f4b71Sopenharmony_ci| imageFileType | [MediaLibrary_ImageFileType](#medialibrary_imagefiletype) of the photo to save.|
983e41f4b71Sopenharmony_ci
984e41f4b71Sopenharmony_ci**Returns**
985e41f4b71Sopenharmony_ci
986e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
987e41f4b71Sopenharmony_ci
988e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
989e41f4b71Sopenharmony_ci
990e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
991e41f4b71Sopenharmony_ci  Possible causes:
992e41f4b71Sopenharmony_ci
993e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
994e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
995e41f4b71Sopenharmony_ci  3. The parameter verification failed.
996e41f4b71Sopenharmony_ci
997e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
998e41f4b71Sopenharmony_ci
999e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED**: This operation is not supported.
1000e41f4b71Sopenharmony_ci
1001e41f4b71Sopenharmony_ci
1002e41f4b71Sopenharmony_ci### OH_MediaAssetManager_CancelRequest()
1003e41f4b71Sopenharmony_ci
1004e41f4b71Sopenharmony_ci```
1005e41f4b71Sopenharmony_cibool OH_MediaAssetManager_CancelRequest (OH_MediaAssetManager *manager, const MediaLibrary_RequestId requestId)
1006e41f4b71Sopenharmony_ci```
1007e41f4b71Sopenharmony_ci
1008e41f4b71Sopenharmony_ci**Description**
1009e41f4b71Sopenharmony_ci
1010e41f4b71Sopenharmony_ciCancels a request based on the request ID.
1011e41f4b71Sopenharmony_ci
1012e41f4b71Sopenharmony_ci**Since**: 12
1013e41f4b71Sopenharmony_ci
1014e41f4b71Sopenharmony_ci**Parameters**
1015e41f4b71Sopenharmony_ci
1016e41f4b71Sopenharmony_ci| Name| Description|
1017e41f4b71Sopenharmony_ci| -------- | -------- |
1018e41f4b71Sopenharmony_ci| manager | Pointer to the **OH_MediaAssetManager** instance.|
1019e41f4b71Sopenharmony_ci| requestId | ID of the request to cancel.|
1020e41f4b71Sopenharmony_ci
1021e41f4b71Sopenharmony_ci**Required permissions**
1022e41f4b71Sopenharmony_ci
1023e41f4b71Sopenharmony_ciohos.permission.READ_IMAGEVIDEO
1024e41f4b71Sopenharmony_ci
1025e41f4b71Sopenharmony_ci**Returns**
1026e41f4b71Sopenharmony_ci
1027e41f4b71Sopenharmony_ciReturns **true** if the request is successfully canceled; returns **false** otherwise.
1028e41f4b71Sopenharmony_ci
1029e41f4b71Sopenharmony_ci
1030e41f4b71Sopenharmony_ci### OH_MediaAssetManager_Create()
1031e41f4b71Sopenharmony_ci
1032e41f4b71Sopenharmony_ci```
1033e41f4b71Sopenharmony_ciOH_MediaAssetManager* OH_MediaAssetManager_Create (void )
1034e41f4b71Sopenharmony_ci```
1035e41f4b71Sopenharmony_ci
1036e41f4b71Sopenharmony_ci**Description**
1037e41f4b71Sopenharmony_ci
1038e41f4b71Sopenharmony_ciCreates a **MediaAssetManager** instance.
1039e41f4b71Sopenharmony_ci
1040e41f4b71Sopenharmony_ci**Since**: 12
1041e41f4b71Sopenharmony_ci
1042e41f4b71Sopenharmony_ci**Returns**
1043e41f4b71Sopenharmony_ci
1044e41f4b71Sopenharmony_ciReturns the pointer to the **MediaAssetManager** instance created.
1045e41f4b71Sopenharmony_ci
1046e41f4b71Sopenharmony_ci
1047e41f4b71Sopenharmony_ci### OH_MediaAssetManager_RequestImage()
1048e41f4b71Sopenharmony_ci
1049e41f4b71Sopenharmony_ci```
1050e41f4b71Sopenharmony_ciMediaLibrary_ErrorCode OH_MediaAssetManager_RequestImage(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset, MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId,  OH_MediaLibrary_OnImageDataPrepared callback)
1051e41f4b71Sopenharmony_ci```
1052e41f4b71Sopenharmony_ci
1053e41f4b71Sopenharmony_ci**Description**
1054e41f4b71Sopenharmony_ci
1055e41f4b71Sopenharmony_ciRequests an image.
1056e41f4b71Sopenharmony_ci
1057e41f4b71Sopenharmony_ci**Since**: 12
1058e41f4b71Sopenharmony_ci
1059e41f4b71Sopenharmony_ci**Parameters**
1060e41f4b71Sopenharmony_ci
1061e41f4b71Sopenharmony_ci| Name| Description|
1062e41f4b71Sopenharmony_ci| -------- | -------- |
1063e41f4b71Sopenharmony_ci| manager | Pointer to the [OH_MediaAssetManager](#oh_mediaassetmanager) instance.|
1064e41f4b71Sopenharmony_ci| mediaAsset | Pointer to the [OH_MediaAsset](#oh_mediaasset) instance to be requested.|
1065e41f4b71Sopenharmony_ci| requestOptions | [MediaLibrary_RequestOptions](_media_library___request_options.md).|
1066e41f4b71Sopenharmony_ci| requestId | Pointe to the [MediaLibrary_RequestId](_media_library___request_id.md) obtained.|
1067e41f4b71Sopenharmony_ci| callback | Callback [OH_MediaLibrary_OnImageDataPrepared](#oh_medialibrary_onimagedataprepared) to be invoked when the requested image source is ready.|
1068e41f4b71Sopenharmony_ci
1069e41f4b71Sopenharmony_ci**Required permissions**
1070e41f4b71Sopenharmony_ci
1071e41f4b71Sopenharmony_ciohos.permission.READ_IMAGEVIDEO
1072e41f4b71Sopenharmony_ci
1073e41f4b71Sopenharmony_ci**Returns**
1074e41f4b71Sopenharmony_ci
1075e41f4b71Sopenharmony_ci[MediaLibrary_ErrorCode](#medialibrary_errorcode-1):
1076e41f4b71Sopenharmony_ci
1077e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OK**: The operation is successful.
1078e41f4b71Sopenharmony_ci
1079e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PARAMETER_ERROR**: Incorrect parameters.
1080e41f4b71Sopenharmony_ci  Possible causes:
1081e41f4b71Sopenharmony_ci
1082e41f4b71Sopenharmony_ci  1. There is mandatory parameter that is not specified.
1083e41f4b71Sopenharmony_ci  2. The parameter type is incorrect.
1084e41f4b71Sopenharmony_ci  3. The parameter verification failed.
1085e41f4b71Sopenharmony_ci
1086e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED**: This operation is not supported.
1087e41f4b71Sopenharmony_ci
1088e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_PERMISSION_DENIED**: The permission is denied.
1089e41f4b71Sopenharmony_ci
1090e41f4b71Sopenharmony_ci- **MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR**: An internal system error occurred.
1091e41f4b71Sopenharmony_ci
1092e41f4b71Sopenharmony_ci
1093e41f4b71Sopenharmony_ci### OH_MediaAssetManager_RequestImageForPath()
1094e41f4b71Sopenharmony_ci
1095e41f4b71Sopenharmony_ci```
1096e41f4b71Sopenharmony_ciMediaLibrary_RequestId OH_MediaAssetManager_RequestImageForPath (OH_MediaAssetManager *manager, const char *uri, MediaLibrary_RequestOptions requestOptions, const char *destPath, OH_MediaLibrary_OnDataPrepared callback)
1097e41f4b71Sopenharmony_ci```
1098e41f4b71Sopenharmony_ci
1099e41f4b71Sopenharmony_ci**Description**
1100e41f4b71Sopenharmony_ci
1101e41f4b71Sopenharmony_ciRequests an image in the specified directory.
1102e41f4b71Sopenharmony_ci
1103e41f4b71Sopenharmony_ci**Since**: 12
1104e41f4b71Sopenharmony_ci
1105e41f4b71Sopenharmony_ci**Parameters**
1106e41f4b71Sopenharmony_ci
1107e41f4b71Sopenharmony_ci| Name| Description|
1108e41f4b71Sopenharmony_ci| -------- | -------- |
1109e41f4b71Sopenharmony_ci| manager | Pointer to the **OH_MediaAssetManager** instance.|
1110e41f4b71Sopenharmony_ci| uri | Pointer to the URI of the requested image asset.|
1111e41f4b71Sopenharmony_ci| requestOptions | Options related to the image asset quality and delivery mode.|
1112e41f4b71Sopenharmony_ci| destPath | Pointer to the destination directory of the requested image asset.|
1113e41f4b71Sopenharmony_ci| callback | Callback to be invoked when the requested image asset is ready.|
1114e41f4b71Sopenharmony_ci
1115e41f4b71Sopenharmony_ci**Required permissions**
1116e41f4b71Sopenharmony_ci
1117e41f4b71Sopenharmony_ciohos.permission.READ_IMAGEVIDEO
1118e41f4b71Sopenharmony_ci
1119e41f4b71Sopenharmony_ci**Returns**
1120e41f4b71Sopenharmony_ci
1121e41f4b71Sopenharmony_ciRequest ID.
1122e41f4b71Sopenharmony_ci
1123e41f4b71Sopenharmony_ci
1124e41f4b71Sopenharmony_ci### OH_MediaAssetManager_RequestVideoForPath()
1125e41f4b71Sopenharmony_ci
1126e41f4b71Sopenharmony_ci```
1127e41f4b71Sopenharmony_ciMediaLibrary_RequestId OH_MediaAssetManager_RequestVideoForPath (OH_MediaAssetManager *manager, const char *uri, MediaLibrary_RequestOptions requestOptions, const char *destPath, OH_MediaLibrary_OnDataPrepared callback)
1128e41f4b71Sopenharmony_ci```
1129e41f4b71Sopenharmony_ci
1130e41f4b71Sopenharmony_ci**Description**
1131e41f4b71Sopenharmony_ci
1132e41f4b71Sopenharmony_ciRequests a video asset in the specified directory.
1133e41f4b71Sopenharmony_ci
1134e41f4b71Sopenharmony_ci**Since**: 12
1135e41f4b71Sopenharmony_ci
1136e41f4b71Sopenharmony_ci**Parameters**
1137e41f4b71Sopenharmony_ci
1138e41f4b71Sopenharmony_ci| Name| Description|
1139e41f4b71Sopenharmony_ci| -------- | -------- |
1140e41f4b71Sopenharmony_ci| manager | Pointer to the **OH_MediaAssetManager** instance.|
1141e41f4b71Sopenharmony_ci| uri | Pointer to the URI of the requested video asset.|
1142e41f4b71Sopenharmony_ci| requestOptions | Options related to the video asset quality and delivery mode.|
1143e41f4b71Sopenharmony_ci| destPath | Pointer to the destination directory of the requested video asset.|
1144e41f4b71Sopenharmony_ci| callback | Callback to be invoked when the requested video asset is ready.|
1145e41f4b71Sopenharmony_ci
1146e41f4b71Sopenharmony_ci**Required permissions**
1147e41f4b71Sopenharmony_ci
1148e41f4b71Sopenharmony_ciohos.permission.READ_IMAGEVIDEO
1149e41f4b71Sopenharmony_ci
1150e41f4b71Sopenharmony_ci**Returns**
1151e41f4b71Sopenharmony_ci
1152e41f4b71Sopenharmony_ciRequest ID.
1153