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 🙏

© 2026 – Pkg Stats / Ryan Hefner

vertical-video-kit

v1.0.0

Published

React components for vertical video feeds like TikTok/Reels

Readme

vertical-video-kit

A React component library for building vertical video feed experiences like TikTok, Instagram Reels, or YouTube Shorts.

Features

  • 📱 Optimized for vertical video layouts
  • 🔄 Smart video preloading with bandwidth optimization
  • 📺 Support for both MP4 and HLS (m3u8) formats
  • 🌐 Cross-browser compatibility with HLS.js for non-Safari browsers
  • 📦 Lightweight with minimal dependencies

Installation

npm install vertical-video-kit
# or
yarn add vertical-video-kit

Make sure to also install the peer dependencies if not already in your project:

npm install react react-dom hls.js
# or
yarn add react react-dom hls.js

Usage

VideoCard Component

The VideoCard component handles video playback with proper lifecycle management:

import { VideoCard } from 'vertical-video-kit';

function VideoItem({ videoUrl, isActive }) {
  return (
    <div style={{ height: '100vh', width: '100%' }}>
      <VideoCard 
        src={videoUrl} 
        isActive={isActive} 
        muted={false} 
      />
    </div>
  );
}

useVideoPreload Hook

The useVideoPreload hook optimizes bandwidth by preloading adjacent videos:

import { useVideoPreload, VideoCard } from 'vertical-video-kit';

function VideoFeed() {
  const videos = ['video1.mp4', 'video2.mp4', 'video3.mp4'];
  const [currentIndex, setCurrentIndex] = useState(0);
  
  // Preload adjacent videos
  useVideoPreload(videos, currentIndex);
  
  return (
    <div>
      {videos.map((video, index) => (
        <VideoCard 
          key={index}
          src={video}
          isActive={index === currentIndex}
          muted={true}
        />
      ))}
    </div>
  );
}

Complete Example

Here's a complete example of a basic vertical video feed:

import React, { useState, useEffect } from 'react';
import { VideoCard, useVideoPreload } from 'vertical-video-kit';

const VerticalFeed = ({ videos }) => {
  const [activeIndex, setActiveIndex] = useState(0);
  
  // Preload adjacent videos
  useVideoPreload(videos, activeIndex);
  
  // Handle scroll to determine active video
  useEffect(() => {
    const handleScroll = () => {
      // Simple implementation - in a real app, you'd determine
      // which video is most visible in the viewport
      const newIndex = Math.floor(window.scrollY / window.innerHeight);
      if (newIndex >= 0 && newIndex < videos.length) {
        setActiveIndex(newIndex);
      }
    };
    
    window.addEventListener('scroll', handleScroll);
    return () => window.removeEventListener('scroll', handleScroll);
  }, [videos.length]);
  
  return (
    <div>
      {videos.map((videoUrl, index) => (
        <div 
          key={index}
          style={{ 
            height: '100vh', 
            width: '100%',
            scrollSnapAlign: 'start'
          }}
        >
          <VideoCard 
            src={videoUrl}
            isActive={index === activeIndex}
            muted={false}
          />
        </div>
      ))}
    </div>
  );
};

export default VerticalFeed;

API Reference

VideoCard

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | required | URL of the video (supports .mp4 and .m3u8) | | isActive | boolean | required | Whether this video is currently active (plays when true, pauses when false) | | muted | boolean | true | Whether the video should be muted |

useVideoPreload

useVideoPreload(videoUrls: string[], currentIndex: number)
  • videoUrls: Array of video URLs to manage
  • currentIndex: Index of the currently active video

License

MIT