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

inferno-html5video

v1.0.0

Published

This is an InfernoJS port of the React-Html5Video package from [mderrick](https://github.com/mderrick/react-html5video) There are still as of this writing a couple of issues with properties like "mute" set in the component as properties.

Downloads

9

Readme

inferno-html5video

This is an InfernoJS port of the React-Html5Video package from mderrick There are still as of this writing a couple of issues with properties like "mute" set in the component as properties.

A customizeable HTML5 Video that uses the familiar HTML5 video markup but with custom and configurable controls with i18n and a11y.

npm version npm downloads

Install

npm install inferno-html5video --save or bower install inferno-html5video --save

Include dist/InfernoHtml5Video.css if you do not want to build your own CSS. Alternatively require src/assets/video.css if you want to compile the CSS yourself with css-loaders and url-loaders etc. See the demo Webpack config as an example.

Peer Dependencies

This component uses ES2015 and needs to be transpiled using something like babel-loader. You will also need to either polyfill or use babel-runtime. It depends on:

  • inferno@>=beta33
  • inferno-component@>=beta33
  • lodash.throttle@latest.

UMD

Alternatively if using the UMD module it is already transpiled to ES5 and lodash.throttle is included. You can find this build in the dist directory:

// Includes lodash.throttle and is transpiled already. No ES2015 polyfill is required.
var Video = require('inferno-html5video/dist/InfernoHtml5Video');  
// Exports to this global
var Video = window.InfernoHtml5Video.default;
// Requires es6 transpiling, an es6 polyfill/babel-runtime and all peer dependencies installed
import { default as Video, Controls, Play, Mute, Seek, Fullscreen, Time, Overlay } from 'inferno-html5video';

Usage

Simple Usage

Use normal HTML5 <video> markup with all the standard html attributes and supported Inferno media events:

import Video from 'inferno-html5video';
render() {
    return (
        <Video controls autoPlay loop muted
            poster="http://sourceposter.jpg"
            onCanPlayThrough={() => {
                // Do stuff
            }}>
            <source src="http://sourcefile.webm" type="video/webm" />
        </Video>
    );
}

Advanced Usage

You can configure, customize and modify the controls by adding, removing and shuffling them as you desire. You can create your very own custom children components and controls that can interact with the video. All children components will receive these props. Obviously you can still call methods and set properties on the HTML5 DOM element directly if you have access to it with refs:

import { default as Video, Controls, Play, Mute, Seek, Fullscreen, Time, Overlay } from 'inferno-html5video';
render() {
    return (
        <Video controls autoPlay loop muted poster="http://sourceposter.jpg">
            <source src="http://sourcefile.mp4" type="video/mp4" />
            <source src="http://sourcefile.webm" type="video/webm" />
            <h1>Optional HTML and components can be added also</h1>
            <CustomComponent />

            /* As soon as a child is supplied that is not a `<source>`
            you have to define all controls and overlays as the default
            controls will have been removed. They are however exported
            and can be re-applied as below in any order. */
            <Overlay />
            <Controls>
                <Play />
                <Seek />
                <Time />
                <Mute />
                <Fullscreen />
                <CustomControlComponent />
            </Controls>
        </Video>
    );
}

i18n

There is some text used that could require translations. This can be done like so:

<Video copyKeys={{ key: value }} />

The default english copyKeys can be found in here.

a11y*

The custom controls provided are built using <button> and <input type="range"> which means basic keyboard controls are available when they are focused. For example, you can and hit the space bar on mute, play and fullscreen buttons as well as seek using the arrow keys when focused on the slider. All inputs have a visible focus outline and can be tabbed to. aria-label attributes for screen readers have been used where user interaction is required. Try tabbing through the demo with Vox enabled.

*Disclaimer: Unfortuantely I don't much experience with a11y but I have tried to use some of the features from PayPal's accessible HTML5 player. If anyone has further input on this please raise an issue or a pull request.

Props and Methods

All children components will receive the following properties via props:

  • copyKeys
  • duration
  • currentTime
  • buffered
  • paused
  • muted
  • volume
  • playbackRate
  • percentageBuffered
  • percentagePlayed

All children components receive the following methods via props:

  • play
  • pause
  • togglePlay
  • mute
  • unmute
  • toggleMute
  • seek
  • fullscreen
  • setVolume
  • setPlaybackRate

Contributing

Dev Setup

To run a server with hot module replacement:

    $ npm install
    $ cd demo
    $ npm install
    $ npm run dev-server

Open http://localhost:8082. You can now modify the files in both src and demo/src.

Issues

Feel free to raise and solve any existing issues as desired. Where possible please do try and replicate any bugs you may have using the inferno-html5video jsfiddle and include them in your ticket.

Thank You

BrowserStack for a free subscription to help test cross browser.

License

MIT