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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yormungandr/react-splayer

v0.0.21

Published

Splayer lib for ReactJS

Downloads

4

Readme

ReactSplayer

ReactSplayer is a customizable React component for playing video files. It supports multiple video sources and offers easy integration into your React projects.


Features

  • Supports multiple video sources
  • Customizable player settings
  • Easy to integrate and use

Installation

You can install the package via npm:

npm install react-splayer

First, you need to import the ReactSplayer component and its associated CSS file.

import ReactSplayer from "@yormungandr/react-splayer";
import React from 'react';
import ReactSplayer from "@yormungandr/react-splayer";
import 'react-splayer/dist/splayer.css';

function App() {
    const videoSources = [
        {src: 'video.mp4', type: 'video/mp4'},
        {src: 'video.webm', type: 'video/webm'}
    ];

    return (
        <div>
            <h1>My Video Player</h1>
            <ReactSplayer
                sources={videoSources}
                loadstart={e => {
                }}
            />
        </div>
    );
}

export default App;

Props


The ReactSplayer component accepts the following props:

| Prop name | description | default value | Example value | |-----------------|:----------------------------------------------------------------------------------------------------------------:|:-------------:|:------------------------------------------------------------------:| | sources | Source of video to play | [ ] | [{src: "video source uri here", type: "video/mp4", label: "720" }] | | videoTitle | Title shown on player | "" | "Chapter 1: Example" | | fullscreenAuto | If true player will automatically go fullscreen | false | true | | backNavigation | Must be function, function is fired when user clicks on back button(arrow left) | null | () => {console.log("Clicked on back button")} | | episodes | Is a number value if chosen video has more than 1 episode it will episodes button on player | 1 | 15 | | onClickEpisodes | This function prop is used only if episodes is more than 1 to fire a function when episodes button is clicked. | () => {} | () => {console.log("Clicked on episodes")} |

  • sources: An array of objects representing the video sources. Each object should have the properties:
    • src: The URL of the video file.
    • type: The MIME type of the video file (e.g., video/mp4).
    • label: quality label of video file (e.g., '480p' or '720p').

Events


| Event name | Fired when | |----------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | canplay | The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. | | canplaythrough | The browser estimates it can play the media up to its end without stopping for content buffering. | | durationchange | The duration attribute has been updated. | | emptied | The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. | | ended | Playback has stopped because the end of the media was reached. | | error | An error occurred while fetching the media data, or the type of the resource is not a supported media format. | | loadeddata | The first frame of the media has finished loading. | | loadedmetadata | The metadata has been loaded. | | loadstart | Fired when the browser has started to load the resource. | | pause | Playback has been paused. | | play | Playback has begun. | | playing | Playback is ready to start after having been paused or delayed due to lack of data. | | progress | Fired periodically as the browser loads a resource. | | ratechange | The playback rate has changed. | | seeked | A seek operation completed. | | seeking | A seek operation began. | | stalled | The user agent is trying to fetch media data, but data is unexpectedly not forthcoming. | | suspend | Media data loading has been suspended. | | timeupdate | The time indicated by the currentTime attribute has been updated. | | volumechange | The volume has changed. | | waiting | Playback has stopped because of a temporary lack of data. |