npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tauri-plugin-videoplayer-api

v0.1.6

Published

[![crate](https://img.shields.io/crates/v/tauri-plugin-videoplayer.svg?logo=rust&logoColor=white)](https://crates.io/crates/tauri-plugin-videoplayer) [![npm](https://img.shields.io/npm/v/tauri-plugin-videoplayer-api?logo=npm&logoColor=white)](https://www.

Readme

Tauri Plugin: Native Video Player

crate npm license tauri-v2 creator creator

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.


🤔 Why This Plugin?

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.

✨ Features

  • Native Android Playback: Utilizes a fullscreen Activity with androidx.media3 (ExoPlayer).
  • Simple API: A single playVideo(url) function to launch the player.
  • HLS/M3U8 Support: Built to handle streaming playlists out of the box.
  • Robust Lifecycle Management: Automatically stops and releases the player when the user navigates away (e.g., switches app, goes to home screen), ensuring stream connections are properly terminated.
  • Tauri v2 Ready: Built from the ground up for the modern Tauri v2 architecture, including the new permission system.

📦 Compatibility

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.

🛠️ Installation

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 dev once to force Tauri to regenerate its permission schemas, and the error will disappear.

🚀 Usage

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.