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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@slogvo/react-universal-video

v1.1.5

Published

React universal video

Readme

@slogvo/react-universal-video

@slogvo/react-universal-video is a React module that allows you to easily play videos from different sources such as HTML5, YouTube, and streaming services (like HLS). Simply provide a video URL, and the module will automatically select the appropriate player to play the video. You can also customize the player’s style as needed.

DEMO

Link demo: https://reaact-universal-app.vercel.app/

Installation

1. You can install it via npm, yarn or pnpm:

pnpm i @slogvo/[email protected]
yarn add @slogvo/[email protected]
npm add @slogvo/[email protected]

2. Install required peer dependencies:

pnpm install react react-dom video.js videojs-contrib-quality-levels videojs-http-source-selector

3. You can import the Video.js CSS into your project wherever you need it. You have the flexibility to include it globally, or only in the specific components or pages where it is required. Here are a couple of options for doing so:

import "video.js/dist/video-js.css";

You can also check out more information at https://videojs.com/guides/react.

Usage

To use the video player, simply import the VideoPlayer component and pass the video URL as a prop.

Example:

import React from "react";
import VideoPlayer from "@slogvo/react-universal-video";

const App = () => {
  return (
    <div>
      // HTML5
      <VideoPlayer
        url="https://videos.pexels.com/video-files/5013307/5013307-hd_1920_1080_30fps.mp4"
        width="800"
        height="450"
      />
      // Yotube
      <VideoPlayer
        url="https://www.youtube.com/watch?v=oA91tf1Udr0"
        width="800"
        height="450"
      />
      // HLS
      <VideoPlayer
        url="https://live-hls-abr-cdn.livepush.io/live/bigbuckbunnyclip/index.m3u8"
        width="800"
        height="450"
      />
    </div>
  );
};

export default App;

VideoPlayer Component Props

| Prop | Description | Default | | ----------- | ----------------------------------------------------------------------------- | ------- | | url | The video URL to play. This can be a YouTube URL, MP4 file, or streaming URL. | - | | width | The width of the player. | 100% | | height | The height of the player. | 400px | | autoplay | Whether the video should autoplay. | false | | controls | Whether to show video controls (play, pause, volume, etc.). | true | | className | Custom CSS class for the player. | - |

Components

VideoPlayer

The main component of this module. It automatically selects the appropriate player (YouTube, HTML5, or streaming) based on the video URL you provide.

import VideoPlayer from "@slogvo/react-universal-video";

How It Works

The VideoPlayer component automatically determines the type of video based on the provided URL:

Customizing Styles

You can add custom CSS classes to the player using the className prop to style the player as needed.

Utility Functions

You can use utility functions from @slogvo/react-universal-video to interact with video URLs, such as extracting YouTube video IDs:

import { getYoutubeId } from "@slogvo/react-universal-video";

const youtubeId = getYoutubeId("https://www.youtube.com/watch?v=9cklv0qQ8Jw");
console.log(youtubeId); // Output: 9cklv0qQ8Jw

Contributing

If you'd like to contribute to @slogvo/react-universal-video, feel free to fork the repository and submit a pull request. We appreciate your contributions!