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

react-video-seek-slider-fork

v6.0.6

Published

React video seek slider like youtube

Downloads

33

Readme

react-video-seek-slider

The simplest, light weight and dependency free html video seeker like YouTube for React With time codes and video preview opportunity

Demo codesandbox demo

react-video-seek-slider

What's new in v6

  • Added time codes and seeker preview fully like in youtube player!
  • The codebase is completely refactored and optimized

Braking changes from v5 -> v6

props names that are changed

  • progress -> bufferTime
  • hideSeekTimes -> hideThumbTooltip

Braking changes from v4 -> v5

All time values you pass to props like max, currentTime and progress now are in milliseconds instead of seconds.

onChange prop will also return time param in milliseconds as well.

How to install

npm i react-video-seek-slider
or
yarn add react-video-seek-slider

How to import

For TypeScript usage there is a index.d.ts

import { VideoSeekSlider } from "react-video-seek-slider";

Also you have to use css file in a lib folder:

import "react-video-seek-slider/styles.css"

How to use

//JSX
    const [currentTime, setCurrentTime] = useState(0);
    /// ..... 
    <VideoSeekSlider
        max={1152000}
        currentTime={currentTime}
        bufferTime={400000}
        onChange={setCurrentTime}
        secondsPrefix="00:00:"
        minutesPrefix="00:"
        timeCodes={[
          {
            fromMs: 0,
            description: 'Description label of the first part',
          },
          {
            fromMs: 130000,
            description: 'Description label of the last part',
          },
        ]}
    />

Available component props

  • max (number, required) - video duration (in milliseconds)
  • currentTime (number, required) - current video progress (in milliseconds)
  • bufferTime (number) - Current buffer progress (in milliseconds)
  • hideThumbTooltip (boolean) - hide hover seek time (Default: false)
  • onChange ((time:number, offsetTime:number)=>void, required) - script to be run when thumb change position
  • offset (number, default:0) - when you need start slider with offset time
  • minutesPrefix (string, default: '') - when video duration is less than an hour you can use time prefix like "0:" so the time tooltip will show e.g "0:25:23"
  • secondsPrefix (string, default: '') - when video duration is less than one minute it's possible to use time prefix like "0:00:" and the time tooltip will show e.g "0:00:10"
  • limitTimeTooltipBySides (boolean, default: true) - limit the time tooltip position inside of the slider
  • timeCodes (TimeCode[], default: undefined) - will divide slider into parts according to an array of times
  • getPreviewScreenUrl ((hoverTimeValue: number) => string, default: undefined) - the callback function is going to be called each time when a slider in hovered. It will pass a current hover mouse time and expect and preview image url to be returned

TimeCode object

  • fromMs (number, required) - time stamp in milliseconds from where the part is starting
  • description (string, required) - label that will appear on seeking tooltip

To use time codes you should provide to the component an array of timeCode objects according to scheme above. The very first part is always should start from fromMs=0. The other parts any valuer according to those places where you would like to slice a slider.

For development

just use:

$ npm i
$ npm run dev

open your browser http://localhost:3000

For Build

$ npm run build