#video #playback #async #macos-ios #macos #ios

nightly aloe-mac-video

Aloe Mac Video provides cross-platform video playback support, interfacing macOS and iOS native media components. It features asynchronous loading, native control integration, with robust observer mechanisms. This crate is a translation of the c++ juce module serving the same function.

1 unstable release

Uses new Rust 2024

new 0.1.1 Apr 3, 2025

#31 in #playback

GPL-3.0 license

1MB
7K SLoC

Aloe Mac Video Crate

Aloe Mac Video is a Rust crate providing a high-level interface for integrating video playback functionalities, especially designed for macOS and iOS platforms. The crate leverages native multimedia frameworks such as AVFoundation, interfacing through Objective-C, to harness the full potential of video rendering capabilities.

Features

  • Cross-Platform Video Playback: Seamlessly supports video playback on macOS and iOS by switching between corresponding UIView and NSView components based on the platform.
  • Asynchronous Asset Loading: Efficiently loads video assets asynchronously, ensuring non-blocking operations and smooth user experiences.
  • Native Control Integration: Supports native playback controls for macOS environments, providing an intuitive user experience.
  • Customizable Play Speed: Allows manipulation of playback speed, offering flexibility in media consumption.
  • Observer-Based Notifications: Utilizes observer patterns to handle player status changes, availing robust media event handling.

Overview

The crate defines several key types and structures, such as AVPlayer, AVPlayerItem, NSView, and UIView, conditionally compiled to ensure compatibility across target platforms. The core player management logic resides in the PlayerController and PlayerAsyncInitialiser structs, catering to effective resource management and state tracking.

Main Components

  • PlayerControllerBase: A foundational structure orchestrating player setup, status observation, and callback management.
  • VideoComponentImpl: Handles the lifecycle and operations of video components, from loading to playback.
  • Observers and Notification Handling: Aids in attaching and detaching observers for monitoring player states and responding to changes effectively.

Usage

To use Aloe Mac Video, add the following to your Cargo.toml:

[dependencies]
aloe-mac-video = "0.1.0"

Example

extern crate aloe_mac_video;
use aloe_mac_video::{VideoComponentImpl, PlayerController};

fn main() {
    // Initialize your video component
    let mut video_component = VideoComponentImpl::new();
    // Load a video file
    video_component.load_file("path/to/video.mp4").unwrap();
    // Play the video
    video_component.play();
}

For more examples and detailed usage, check our GitHub repository.

Contributing

Contributions are welcome! Please submit issues or pull requests through our GitHub repository.


Note: This README.md was generated by an AI model and may not be 100% accurate however it should be pretty good.

This crate is a translation of the JUCE module.

JUCE is a c++ software framework for developing high performance audio applications.

Usage falls under the GPLv3 as well as the JUCE commercial license.

See github.com/juce-framework/JUCE and the JUCE license page for details.

This crate is in the process of being translated from c++ to rust. For progress updates, please see the workspacer rust project. designed specifically for rust projects.

Dependencies

~24–41MB
~633K SLoC