pub trait MediaRuntime:
Send
+ Sync
+ 'static {
// Required methods
fn copy_album_media_to_file(
&self,
uri: &str,
dest_path: &Path,
kind: MediaKind,
) -> Result<(), PlatformError>;
fn get_image_info(&self, uri: &str) -> Result<ImageInfo, PlatformError>;
fn compress_image(
&self,
request: &CompressImageRequest,
) -> Result<PathBuf, PlatformError>;
fn compress_video(
&self,
request: &CompressVideoRequest,
) -> Result<CompressedVideo, PlatformError>;
fn get_video_info(&self, uri: &str) -> Result<VideoInfo, PlatformError>;
fn extract_video_thumbnail(
&self,
request: &ExtractVideoThumbnailRequest,
) -> Result<VideoThumbnail, PlatformError>;
}Required Methods§
Sourcefn copy_album_media_to_file(
&self,
uri: &str,
dest_path: &Path,
kind: MediaKind,
) -> Result<(), PlatformError>
fn copy_album_media_to_file( &self, uri: &str, dest_path: &Path, kind: MediaKind, ) -> Result<(), PlatformError>
Copy a picked/album media asset identified by uri into a local file at dest_path.
Notes:
uriis an opaque platform media reference coming from platform pickers and may not be a directly readable filesystem path.- Implementations should support platform-specific schemes as applicable, for example:
- Android:
content://... - iOS:
ph://...(or other Photos identifiers) - Harmony: picker URIs such as
file://media/... - Some platforms may also provide
file:///absolute/path(or an absolute path string).
- Android:
- Implementations should create parent directories for
dest_pathif needed and write the file content so thatdest_pathexists on success.