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

@epiclabs/epic-video-comparator

v0.0.7

Published

JS library to create a video comparator, i.e., two overlaped and syncrhonized video players each one with an independent source.

Downloads

10

Readme

Epic Video Comparator · npm version Travis CI Status

LIVE DEMO

JavaScript library which implements a video comparator component: two overlapped and synchronized video players each one playing an independent source. It is based on epic-video-player library, which currently supports native HTML video (WebM, Ogg Theora Vorbis, Ogg Opus, Ogg FLAC and MP4 H.264), MPEG-DASH(dash.js) and HLS (hls.js) streams.

video-comparator-overview

For ABR sources, it is also possible to select the desired rendition to be played:

video-comparator-quality-selector

Installation

Install epic-video-comparator into your project

$ npm install @epiclabs/epic-video-comparator --save

Using it as CommonJS module

import { Comparator } from '@epiclabs/epic-video-comparator';
...
const comparatorConfig = {
    leftUrl: 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.mpd',
    rightUrl: 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.mpd',
    mediaControls: true,
    loop: true,
};
const myComp = new Comparator(comparatorConfig, document.getElementById('comparator-container'));

Using it as UMD module within <script> tag

<head>
    ...
    <script src="bundle/index.min.js"></script>
    ...
</head>
<body>
    ...
    <div id="comparator-container"></div>
    ...
    <script type="text/javascript">
        document.addEventListener('DOMContentLoaded', function () {
            var comparatorConfig = {
                leftUrl: 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.mpd',
                rightUrl: 'https://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.mpd',
                mediaControls: true,
                loop: true,
            };
            window.myComp = new evc.Comparator(comparatorConfig, document.getElementById('comparator-container'));
        });
    </script>
    ...
</body>

Development

$ git clone https://github.com/epiclabs-io/epic-video-comparator.git
$ cd epic-video-comparator
$ npm install
$ npm run build

API

Methods

  • new Comparator(config: IComparatorConfig, container: HTMLDivElement)

    Creates a new instance of epic-video-comparator.

  • pause()

    Stops playback of both videos.

  • play()

    Starts playback of both videos.

  • togglePlayPause()

    Switches playing/pause status.

  • seek(time: number)

    Sets both players' playback to the same time position.

  • reload()

    Destroys and reload the epic-video-comparator.

  • toggleFullScreen()

    Enters / exits fullscreen mode.

  • setRenditionByKbps(player: 'left' | 'right', kbps: number): IRendition

    Sets a desired rendition given as Kbps on one of the players.

  • ~~setRenditionKbps(player: 'left' | 'right', kbps: number): IRendition~~

    This method has been deprecated since version 0.0.2. Use setRenditionByKbps instead.

  • setRenditionByIndex(player: 'left' | 'right', index: number): IRendition

    Sets a desired rendition given as index number on one of the players. The order will be the order of the array returned by getRenditions method.

  • ~~setRenditionIndex(player: 'left' | 'right', index: number): IRendition~~

    This method has been deprecated since version 0.0.2. Use setRenditionByIndex instead.

  • getRenditions(player: 'left' | 'right'): IRendition[]

    Retrieves the list of available renditions of one of the players.

  • togggleStats(): void

    Shows / Hides the stats boxes.

  • updateStats(innerLeft: string, innerRight: string): void

    Sets the given content to each one of the players' stats box. It will overwrite any stat given by this library as default. It is recommended to be used within a setInterval.

  • destroy(): void

    Removes all DOM elements and binding listeners.

Events

The events are binded to the comparator container. Usage example:

var container = document.getElementById('comparator-container');
container.addEventListener('created', () => console.log('created!'));

| Event | Description | | ----- | ----------- | | created | Fires when the comparator is created (it occurs during comparator creation or reload but also when a new rendition is selected on any side). | | fullscreen_toggle | Fires when the comparator toggles its fullscreen mode. |

Object interfaces

| Name | Properties | Default value | | ---- | ---------- |:-------------:| | IComparatorConfig | autoplay?: boolean;leftUrl: string;loop?: boolean; rightUrl: string;mediaControls?: boolean;stats?: IStatsConfig / boolean | true - true - true IStatsConfig defaults | | IStatsConfig | showDuration?: boolean;showBitrate?: boolean;showResolution?: boolean;showVideoCodec?: boolean;showAudioCodec?: boolean;showDroppedFrames?: boolean;showBuffered?: boolean;showStartupTime?: boolean;custom?: boolean; | true true true true true true true true false |