| Crates.io | tauri-plugin-videoplayer |
| lib.rs | tauri-plugin-videoplayer |
| version | 0.1.6 |
| created_at | 2025-10-12 18:57:44.761173+00 |
| updated_at | 2025-10-17 00:13:18.411877+00 |
| description | Fullscreen native video player for tauri |
| homepage | |
| repository | https://github.com/YeonV/tauri-plugin-videoplayer |
| max_upload_size | |
| id | 1879523 |
| size | 160,949 |
A Tauri v2 plugin that provides a native video player, launched from your webview. Ideal for playing fullscreen video streams (like M3U8) on mobile devices without the overhead or limitations of a web-based player.
Web-based video players are fantastic, but they can struggle on mobile, especially with certain stream formats or when dealing with performance-intensive tasks. This plugin solves that by handing off the video playback to the operating system's native player.
On Android, this means launching a new, fullscreen Activity powered by androidx.media3 (the successor to ExoPlayer), the same powerful media engine used by apps like YouTube and Netflix.
The core benefit is performance and stability. It also ensures a clean separation of concerns and robust lifecycle managementβthe stream is guaranteed to terminate when the user switches apps, a critical feature for single-stream services.
Activity with androidx.media3 (ExoPlayer).playVideo(url) function to launch the player.This plugin is currently in its early stages and supports:
| Platform | Supported |
|---|---|
| Android | β |
| iOS | β |
| Windows | β |
| macOS | β |
| Linux | β |
This plugin is only compatible with Tauri v2.
Integrating the plugin into your Tauri v2 application involves four steps:
1. Install the JavaScript Package:
# Using npm
npm install tauri-plugin-videoplayer-api
# Using yarn
yarn add tauri-plugin-videoplayer-api
2. Add the Rust Crate:
Add the crate to your app's src-tauri/Cargo.toml dependencies:
[dependencies]
# ... other dependencies
tauri-plugin-videoplayer = "0.1.0"
3. Register the Plugin:
In your app's src-tauri/src/lib.rs (or main.rs), register the plugin with the Tauri builder:
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_videoplayer::init()) // <-- Add this line
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
4. Configure Permissions:
The plugin requires permission to be called from the frontend. Add "videoplayer:default" to your app's capabilities file at src-tauri/capabilities/default.json:
{
// ...
"permissions": [
"core:default",
"videoplayer:default" // <-- Add this line
]
}
Note: If you're adding the plugin to a new project, your IDE might show an error on this line initially. Run
yarn tauri devonce to force Tauri to regenerate its permission schemas, and the error will disappear.
Using the plugin in your frontend code is straightforward. Import the playVideo function and call it with a valid video URL.
import { playVideo } from 'tauri-plugin-videoplayer-api';
function MyComponent() {
const handlePlayButtonClick = () => {
const m3u8_url = 'https://your-stream-provider.com/stream.m3u8';
console.log(`Requesting native playback for: ${m3u8_url}`);
// This will launch the native fullscreen player on Android
playVideo(m3u8_url);
};
return (
<button onClick={handlePlayButtonClick}>
Play Video Natively
</button>
);
}
On Android, this will launch the fullscreen native player. The user can return to your app by using the standard system back button.