Skip to main content

MediaRuntime

Trait MediaRuntime 

Source
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§

Source

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:

  • uri is 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).
  • Implementations should create parent directories for dest_path if needed and write the file content so that dest_path exists on success.
Source

fn get_image_info(&self, uri: &str) -> Result<ImageInfo, PlatformError>

Source

fn compress_image( &self, request: &CompressImageRequest, ) -> Result<PathBuf, PlatformError>

Source

fn compress_video( &self, request: &CompressVideoRequest, ) -> Result<CompressedVideo, PlatformError>

Source

fn get_video_info(&self, uri: &str) -> Result<VideoInfo, PlatformError>

Source

fn extract_video_thumbnail( &self, request: &ExtractVideoThumbnailRequest, ) -> Result<VideoThumbnail, PlatformError>

Implementors§