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

video-range-selector

v1.2.0

Published

A React library for selecting a specific range within a video timeline. The library provides a customizable and intuitive interface for users to select start and end times for video segments.

Downloads

33

Readme

video-range-selector

A React library for selecting a specific range within a video timeline. The library provides a customizable and intuitive interface for users to select start and end times for video segments.

Video Range selector

Features

  • Customizable: Modify the appearance and behavior using props.
  • Intuitive Interface: Drag handles for selecting start and end times.
  • Dynamic: Automatic adjust to varying video durations with pixel-to-millisecond scaling.

Installation

Install the library via npm, yarn, pnpm:

npm install video-range-selector

Components

VideoRangeSelector

Props:

  • videoDuration (number, required): The total duration of the video in milliseconds.
  • onRangeChange (function, required): Callback function that receives the updated start and end times.
  • startSelection (number, required): The initial start time for the selection in milliseconds.
  • endSelection (number, required): The initial end time for the selection in milliseconds.
  • licenseKey (string): License key for using the component on production.
  • maxDuration (number, optional): Maximum duration that can be selected.
  • theme (object, optional): Custom theme to apply styles. Can include primary and overlay colors.

Range

A component that displays the selectable range on the video timeline.

Props:

  • thumbnailUrl (string, required): URL of the video thumbnail to be displayed in the range selector.
  • containerClassName (string, optional): Custom class name for the range container.
  • overlayLeftClassName (string, optional): Custom class name for the left overlay.
  • overlayRightClassName (string, optional): Custom class name for the right overlay.
  • leftHandleClassName (string, optional): Custom class name for the left handle.
  • rightHandleClassName (string, optional): Custom class name for the right handle.
  • centerHandleClassName (string, optional): Custom class name for the center handle.

RangeInputs

A component that provides input fields for manually entering the start and end times.

Props:

  • containerClassName (string, optional): Custom class name for the input container.
  • inputClassName (string, optional): Custom class name for the input fields.

Basic Usage

Here’s a basic example of how to use the video-range-selector components:

import { VideoRangeSelector, Range, RangeInputs } from "video-range-selector";

const MyComponent = () => {
  const videoDuration = 120000; // 2 minutes in milliseconds
  const [startSelection, setStartSelection] = useState(5000); // 5 seconds
  const [endSelection, setEndSelection] = useState(70000); // 1 minute 10 seconds
  const thumbnailUrl = "thumbnail-url";

  const handleRangeChange = (start: number, end: number) => {
    setStartSelection(start);
    setEndSelection(end);
  };

  return (
    <VideoRangeSelector
      videoDuration={videoDuration}
      onRangeChange={handleRangeChange}
      startSelection={startSelection}
      endSelection={endSelection}
      licenseKey="0000-0000-0000-0000"
    >
      <Range thumbnailUrl={thumbnailUrl} />
      <RangeInputs />
    </VideoRangeSelector>
  );
};

License

This library requires a license key for use in commercial applications. Please obtain a license key from here and include it in the licenseKey prop.

Support

For questions, issues, or feature requests, please contact [email protected].