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

react-media-optimizer

v1.1.1

Published

Drop-in React component for auto-optimized images & media with lazy loading, WebP conversion, SEO metadata, and performance optimization

Readme

🚀 React Media Optimizer

npm versionnpm downloadsbundle sizeLicense: MITTypeScript SEO Ready Drop-in image & video optimization for React applications. Automatically compress, lazy-load, convert media, AND inject SEO metadata to improve performance, UX, and search rankings with minimal effort.

📊 Average improvements: 60% faster LCP, 75% smaller images, 40% better SEO scores, +25% Google Image CTR Results vary depending on implementation and infrastructure.


✨ Why Choose React Media Optimizer?

| Feature | Benefit | Impact | |---------|---------|--------| | Auto Lazy Loading | Images/videos load only when visible | ⬇️ 50-80% initial page weight | | Auto Blur Placeholders | Smooth fade-in from blurred preview to sharp image | ⬆️ Better perceived load speed & premium UX | | WebP/WebM Conversion | Modern formats with better compression | ⬇️ 25-35% smaller file sizes | | Client-side Compression | Reduce upload sizes before server | ⬇️ 60-80% upload bandwidth | | SSR/SSG Safe | Works with Next.js, Gatsby, Remix | ✅ Zero hydration errors | | Zero Configuration | Sensible defaults out of the box | ⏱️ 5-minute integration | | SEO Features | Automatic JSON-LD schema injection | ⬆️ +25% Google Image CTR |

🎯 v1.1.0: The SEO Update

🔔 New SEO Features for Images:

  • Google "Licensable" Badge - Automatically adds license metadata
  • ImageObject Schema - Rich snippets in Google Search
  • E-E-AT Signals - Author, credit, copyright information
  • representativeOfPage - Marks hero images as page representatives
  • Preload Priority - Automatic preload for LCP optimization

🎬 New SEO Features for Videos:

  • Key Moments (Video Chapters) - Google shows clickable chapters in search
  • VideoObject Schema - Duration, upload date, thumbnail in search results
  • Transcript Support - Better accessibility and SEO
  • Automatic Preload - Priority loading for critical videos

📦 Installation

Install using your preferred package manager.

npm

npm  install  react-media-optimizer

yarn

yarn  add  react-media-optimizer

pnpm

pnpm  add  react-media-optimizer

📌 Peer Dependencies

This package requires React 16.8+ (Hooks support).


{
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}

🚀 Quick Start

1. Optimized Image with SEO


import { OptimizedImage } from 'react-media-optimizer';

function HeroSection() {
  return (
    <OptimizedImage
      src="https://example.com/hero-banner.jpg"
      alt="Product showcase"
      width={1920}
      height={1080}
      
      // Performance props
      placeholder="blur"
      blurIntensity={25}
      lazy={true}
      webp={true}
      quality={85}
      priority="hero"  // Preloads + representativeOfPage
      className="rounded-lg shadow-xl"
      
      // SEO props
      license="CC BY-SA 4.0"        // Google "Licensable" badge
      author="John Doe Photography" // E-E-AT signal
      credit="Shot on Sony A7III"   // Photographer credit
      caption="Sunset over mountains with beautiful colors" // Image description
      keywords={["nature", "sunset", "mountains", "landscape"]}
      contentLocation="Swiss Alps, Switzerland"
      copyrightHolder="Nature Photography Inc"
      datePublished="2024-01-15"
    />
  );
}

**2. Optimized Video with Key Moments **

import { OptimizedVideo } from 'react-media-optimizer';

function TutorialVideo() {
  // Define chapters for Key Moments
  const chapters = [
    { startTime: 0, title: "Introduction" },
    { startTime: 300, title: "Installation" },
    { startTime: 900, title: "Components" },
    { startTime: 1800, title: "Hooks Deep Dive" },
    { startTime: 2700, title: "Conclusion" }
  ];

  return (
    <OptimizedVideo
      src="https://example.com/tutorial.mp4"
      poster="/thumbnail.jpg"
      width="100%"
      height="auto"
      
      // Performance props
      lazy={true}
      webm={true}
      mp4={true}
      controls
      priority="critical"
      
      // Video SEO with Key Moments
      title="Complete React Tutorial 2024"
      description="Learn React from scratch in 1 hour - Hooks, Components, State Management"
      author="React Academy"
      license="Royalty Free"
      duration={3600} // 1 hour in seconds
      uploadDate="2024-01-15"
      isFamilyFriendly={true}
      keywords={["react", "tutorial", "javascript", "frontend", "web development"]}
      transcript="Full video transcript available for accessibility and SEO..."
      chapters={chapters}  // Google Key Moments!
      showChapters={true}   // Show clickable chapters overlay
    />
  );
}

** 3. Manual Schema Injection Example **

import { 
  generateImageSchema, 
  generateVideoSchema,
  injectJsonLd 
} from 'react-media-optimizer';

// Manual image schema injection
const imageSchema = generateImageSchema({
  url: "https://example.com/image.jpg",
  alt: "Beautiful landscape",
  license: "CC BY-SA 4.0",
  author: "John Doe",
  caption: "Mountain landscape at sunset",
  keywords: ["mountains", "sunset", "nature"],
  isRepresentative: true
});

injectJsonLd(imageSchema);

// Manual video schema with chapters
const videoSchema = generateVideoSchema({
  url: "https://example.com/video.mp4",
  name: "Tutorial Video",
  description: "Complete guide",
  duration: 600,
  uploadDate: "2024-01-15",
  chapters: [
    { startTime: 0, title: "Intro" },
    { startTime: 120, title: "Main Content" }
  ]
});

injectJsonLd(videoSchema);

** 4. Priority Preload Example **

import { preloadCritical } from 'react-media-optimizer';

// Preload critical images/videos on page load
useEffect(() => {
  preloadCritical([
    { src: '/hero.jpg', type: 'image' },
    { src: '/intro.mp4', type: 'video' },
    { src: '/logo.png', type: 'image' }
  ]);
}, []);

## 📖 API Reference v1.1.0


<OptimizedImage /> Props

Basic Props


Performance Props

🔔 NEW SEO Props (v1.1.0)

Basic Props


Performance Props


🔔 NEW Video SEO Props (v1.1.0)


VideoChapter Interface

interface VideoChapter {
  startTime: number; // seconds
  title: string;
  thumbnail?: string; // optional chapter thumbnail
}

📊 Google Search Results Examples

Image with License Badge

Google Image Search will show:
🖼️ [Your Image]
📌 Licensable · CC BY-SA 4.0
👤 Author: John Doe Photography
📅 Published: Jan 15, 2024

Video with Key Moments

Google Search will show:
🎬 Complete React Tutorial
⏱️ 1 hour · 50K views · Jan 15, 2024

Key Moments:
▸ 0:00 Introduction
▸ 5:00 Installation  
▸ 15:00 Components
▸ 30:00 Hooks Deep Dive
▸ 45:00 Conclusion

🛠️ Advanced Usage

Batch Preloading Critical Resources

import { preloadCritical } from 'react-media-optimizer';

// Preload all hero images and videos
useEffect(() => {
  preloadCritical([
    { src: '/hero.jpg', type: 'image' },
    { src: '/intro.mp4', type: 'video' }
  ]);
}, []);

Generate Schema Manually

import { generateImageSchema, injectJsonLd } from 'react-media-optimizer';

const schema = generateImageSchema({
  url: 'https://example.com/image.jpg',
  alt: 'Beautiful landscape',
  license: 'CC BY-SA 4.0',
  author: 'John Doe'
});

injectJsonLd(schema);

📈 Performance Impact

🏗️ Framework Integration

Next.js with SEO


import { OptimizedImage } from 'react-media-optimizer';

export default function HomePage() {
  return (
    <OptimizedImage
      src="/hero.jpg"
      alt="Homepage hero"
      width={1200}
      height={630}
      priority="hero"
      license="Commercial"
      author="Company Name"
      datePublished="2024-01-15"
    />
  );
}

Gatsby with Video SEO

import { OptimizedVideo } from 'react-media-optimizer';

const VideoPage = () => (
  <OptimizedVideo
    src={data.file.publicURL}
    poster={data.thumbnail.publicURL}
    title="Product Demo"
    description="Watch our product in action"
    chapters={[
      { startTime: 0, title: "Intro" },
      { startTime: 30, title: "Features" }
    ]}
    duration={120}
    uploadDate="2024-01-15"
  />
);

🔄 Migration Guide

From v1.0.x to v1.1.0

<OptimizedImage
  src="/image.jpg"
  alt="Example"
  // Old props still work
  placeholder="blur"
  lazy={true}
  
+ // NEW SEO props (optional)
+ license="CC BY-SA 4.0"
+ author="John Doe"
+ caption="Example image"
/>

<OptimizedVideo
  src="/video.mp4"
  poster="/poster.jpg"
  
+ // NEW video SEO props
+ title="Tutorial"
+ description="Learn how to use it"
+ chapters={[{ startTime: 0, title: "Start" }]}
+ duration={300}
+ uploadDate="2024-01-15"
/>

📝 License Types Supported

// All supported licenses:
type LicenseType = 
  | 'CC0'                    // Public Domain
  | 'CC BY'                   // Attribution
  | 'CC BY-SA'                // ShareAlike
  | 'CC BY-NC'                // NonCommercial
  | 'CC BY-ND'                // NoDerivatives
  | 'CC BY-NC-SA'             // NonCommercial-ShareAlike
  | 'CC BY-NC-ND'             // NonCommercial-NoDerivs
  | 'Royalty Free'            // Royalty-free
  | 'Commercial'              // Commercial use
  | 'Public Domain'           // Public domain
  | 'All Rights Reserved'     // All rights reserved
  | 'MIT'                     // MIT License
  | 'Apache 2.0';             // Apache 2.0

📦 Changelog

v1.1.0 (Latest) 🎉

  • SEO Features: Automatic JSON-LD schema injection

  • 🏷️ License Badges: Google "Licensable" image support

  • 🎬 Video Key Moments: Google video chapters

  • Priority Preload: hero and critical priority levels

  • 📝 E-E-AT Signals: Author, credit, copyright metadata

  • 🎯 Rich Snippets: Better search result appearance

  • 🔧 TypeScript: Full type support for new props

v1.0.x

  • 🚀 Initial release with lazy loading and WebP conversion

  • 🌫️ Auto blur placeholders

  • 📱 Responsive image support


🤝 Contributing

Contributions are welcome! Please read our contributing guidelines.


📄 License

MIT © 2026 Yared Abebe


⭐ Support

If you find this package helpful, please consider:

  • ⭐ Starring on GitHub

  • 📢 Sharing on social media

  • 🐛 Reporting issues

  • 💡 Suggesting new features

🎯 Key Updates Made:

  1. SEO Features Highlight - New badge and section
  2. v1.1.0 Tag - Clear version indication
  3. Image SEO Props - License, author, credit, etc.
  4. Video SEO Props - Chapters, duration, transcript
  5. Key Moments Examples - Google video chapters
  6. Migration Guide - From v1.0.x to v1.1.0
  7. License Types - Complete list supported
  8. Google Search Examples - Visual preview of results
  9. Performance Metrics - Updated with SEO impact
  10. Changelog - New features listed