You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP β†’
Socket
Book a DemoInstallSign in
Socket

react-ambilight

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ambilight

🌈 A lightweight React component for creating an Ambilight effect with YouTube videos.

1.1.0
latest
npmnpm
Version published
Weekly downloads
1
-95.45%
Maintainers
0
Weekly downloads
Β 
Created
Source

🌈 Video Ambilight

A lightweight React component to create a stunning Ambilight effect for YouTube videos. This package is inspired by the visual effects seen in modern video presentations, adding an immersive ambient glow that synchronizes with your content.

✨ Features

  • Works seamlessly with YouTube videos using the YouTube IFrame API.
  • Supports synchronized playback between the video and the Ambilight effect.
  • Customizable and easy to integrate into any React project.

πŸ“¦ Installation

Install the package via npm:

npm install react-ambilight

or using Yarn:

yarn add react-ambilight

πŸ”§ Usage

Here's a quick example of how to use the component:

import React from 'react'
import { VideoAmbilight } from 'react-ambilight'
import 'react-ambilight/dist/style.css'

export default function App() {
  return (
    <div style={{ maxWidth: '800px', margin: '0 auto' }}>
      <VideoAmbilight videoId='dQw4w9WgXcQ' />
    </div>
  )
}

Customize the component by passing a className or classNames object with custom class names:

// tailwind example
import React from 'react'
import { VideoAmbilight } from 'react-ambilight'
import 'react-ambilight/dist/style.css'

export default function App() {
  return (
    <div className='max-w-4xl mx-auto'>
      <VideoAmbilight
        videoId='dQw4w9WgXcQ'
        classNames={{
          videoWrapper: 'relative',
          ambilightWrapper: 'absolute inset-0',
          aspectRatio: 'aspect-w-16 aspect-h-9',
          ambilight: 'bg-black opacity-50',
          ambilightVideo: 'hidden',
        }}
      />
    </div>
  )
}

Props

PropTypeDescriptionRequired
videoIdstringThe YouTube video ID to display.Yes
classNamestringOptional class name for styling.No
classNamesobjectOptional object for custom class names.No

classNames Object

The classNames object can have the following properties:

PropertyTypeDescription
videoWrapperstringClass name for the video wrapper.
ambilightWrapperstringClass name for the ambilight wrapper.
aspectRatiostringClass name for the aspect ratio container.
ambilightstringClass name for the ambilight effect container.
ambilightVideostringClass name for the ambilight video container.

πŸš€ Demo

Check out a live demo of the Ambilight effect: Live Demo

πŸ›  How It Works

The component leverages the YouTube IFrame API to create two synchronized players:

  • Primary Player: Displays the video.
  • Ambilight Player: Runs a low-quality version of the same video in the background to generate the glowing effect.

🧩 Contributing

Contributions are welcome! If you encounter any issues or have suggestions, feel free to open an issue or submit a pull request.

  • Fork the repository.
  • Create a feature branch: git checkout -b feature-name.
  • Commit your changes: git commit -m 'Add feature-name'.
  • Push to the branch: git push origin feature-name.
  • Open a pull request.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™Œ Acknowledgements

Inspired by the Ambilight effect seen during the Next.js Conf presentations.

πŸ’» Made with ❀️ by Bruno Silva

Keywords

ambilight

FAQs

Package last updated on 04 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts