media_source 0.1.0-alpha.1 copy "media_source: ^0.1.0-alpha.1" to clipboard
media_source: ^0.1.0-alpha.1 copied to clipboard

A new Dart package project.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.1.0-alpha.1 - 2025-11-03 #

Added #

  • Initial release of the media_source package
  • Core MediaSource abstraction for handling different media sources
  • FileMediaSource implementation for local file system access
    • Support for file operations (delete, exists, size)
    • Automatic MIME type detection
    • Media metadata extraction
  • MemoryMediaSource implementation for in-memory media data
    • Support for Uint8List byte arrays
    • MIME type detection from byte headers
  • NetworkMediaSource implementation for remote URL media
    • URL validation and parsing
    • Automatic media type detection from URLs
  • MediaType classification system with subtypes:
    • ImageType - for image files
    • AudioType - for audio files with duration support
    • VideoType - for video files with duration support
    • DocumentType - for PDF documents
    • UrlType - for URL references
    • OtherType - for unclassified files
  • Media type detection from:
    • File paths using MIME type lookup
    • MIME type strings
    • Byte data headers
  • File utilities (file_util.dart):
    • getMimeTypeFromPath() - detect MIME from file path
    • getMimeTypeFromBytes() - detect MIME from byte data
    • getFileMetadata() - extract duration and MIME from media files
    • getFileMetadataFromBytes() - extract metadata from byte arrays
  • MIME groups utility (mime_groups.dart):
    • Extension to MediaType mapping derived from mime package
    • Grouped extension sets by media type
    • Pre-built sets: imageExtensions, audioExtensions, videoExtensions, documentExtensions, otherExtensions
    • Helper functions:
      • mediaTypeForExtension() - get MediaType from file extension
      • isExtensionOfType() - check if extension matches a MediaType
    • Runtime classification of all extensions from the mime package's default extension map
  • Cross-platform support:
    • Platform-specific utilities for web and native (IO)
    • Conditional imports for Flutter web compatibility
  • File extensions on XFile:
    • delete() - delete file with existence check
    • size() - get file size
    • exists() - check file existence
    • mediaType - get MediaType from file
    • name - get file name from path
  • Comprehensive test suite:
    • MediaType tests for classification and type detection
    • MemoryMediaSource tests
    • NetworkMediaSource tests with URL validation
    • Test fixtures and sample files

Features #

  • ๐ŸŽฏ Type-safe media source abstraction
  • ๐Ÿ“ Support for file, memory, and network media sources
  • ๐Ÿ” Automatic media type detection from paths, MIME types, and bytes
  • โฑ๏ธ Duration metadata extraction for audio/video files
  • ๐ŸŒ Cross-platform support (Flutter mobile, web, desktop)
  • ๐Ÿ“Š Comprehensive MIME type to media type mapping
  • ๐Ÿงฉ Extension-based media type lookup utilities
  • ๐Ÿงช Test coverage for core functionality
  • ๐Ÿ”— Built on cross_file for cross-platform file handling
  • โšก Lightweight with minimal dependencies
6
likes
0
points
87
downloads

Publisher

unverified uploader

Weekly Downloads

A new Dart package project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cross_file, equatable, flutter, flutter_media_metadata, mime, path, path_provider, sized_file, uuid, web

More

Packages that depend on media_source