A Tauri plugin to parse MP4 files: extract metadata, tracks, frames, and subtitles. Async API for getting info from local files or HTTP streams.
This project is organized as a Cargo workspace with the following structure:
tauri-plugin-media-parser/
├── crates/
│ └── media-parser/ # Rust MP4 parser library
│ ├── src/
│ │ ├── errors.rs
│ │ ├── lib.rs
│ │ ├── stream.rs
│ │ └── types.rs
│ └── Cargo.toml
├── src/ # Tauri plugin implementation
│ ├── commands.rs # Plugin commands
│ ├── error.rs # Error types
│ └── lib.rs # Main plugin code
├── guest-js/ # JavaScript/TypeScript bindings
│ ├── index.ts
│ └── tsconfig.json
├── permissions/ # Permission definitions (mostly generated)
├── dist-js/ # Compiled JS (generated)
├── Cargo.toml # Workspace configuration
├── package.json # NPM package configuration
└── build.rs # Build script
A Rust module with no dependencies on Tauri or its plugin architecture. It provides an async API for parsing MP4 media files, extracting metadata, tracks, subtitles, and frames from local files or HTTP streams. It's designed to be published as a standalone crate in the future with minimal changes.
See crates/media-parser/README.md
for more details.
The main plugin provides a Tauri integration layer that exposes media parsing
functionality to Tauri applications. It uses the media-parser module internally.
-
Install NPM dependencies:
npm install
-
Build the TypeScript bindings:
npm run build
-
Build the Rust plugin:
cargo build
Run Rust tests:
cargo testnpm run standardsAdd the plugin to your Tauri application's Cargo.toml:
[dependencies]
tauri-plugin-media-parser = { path = "../path/to/tauri-plugin-media-parser" }Add the plugin permission to your capabilities file
src-tauri/capabilities/default.json
{
"permissions": [
"core:default",
"media-parser:default"
]
}Initialize the plugin in your Tauri app:
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_media_parser::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}Install the JavaScript package in your frontend:
npm install @silvermine/tauri-plugin-media-parserUse the plugin from JavaScript/TypeScript:
import { hello } from '@silvermine/tauri-plugin-media-parser';
// Call the hello command
const greeting = await hello('World');
console.log(greeting); // "Hello, World! This is the Media Parser plugin."This project follows the Silvermine standardization guidelines. Key standards include:
- EditorConfig: Consistent editor settings across the team
- Markdownlint: Markdown linting for documentation
- Commitlint: Conventional commit message format
- Code Style: 3-space indentation, LF line endings
npm run standardsMIT
Contributions are welcome! Please follow the established coding standards and commit message conventions.