Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

youtube-player

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

youtube-player

YouTube IFrame Player API abstraction.

  • 5.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
410K
decreased by-5.3%
Maintainers
1
Weekly downloads
 
Created

What is youtube-player?

The youtube-player npm package is a simple wrapper around the YouTube IFrame Player API, allowing you to easily embed and control YouTube videos in your web applications.

What are youtube-player's main functionalities?

Load a YouTube Video

This feature allows you to load a YouTube video by its ID into an HTML element with the specified ID. In this example, the video with ID 'M7lc1UVf-VE' is loaded into the element with ID 'video-player'.

const YouTubePlayer = require('youtube-player');
const player = YouTubePlayer('video-player');
player.loadVideoById('M7lc1UVf-VE');

Play a Video

This feature allows you to play the currently loaded video. The `playVideo` method starts the video playback.

player.playVideo();

Pause a Video

This feature allows you to pause the currently playing video. The `pauseVideo` method pauses the video playback.

player.pauseVideo();

Seek to a Specific Time

This feature allows you to seek to a specific time in the video. The `seekTo` method takes the time in seconds and a boolean indicating whether to allow seeking ahead of the video.

player.seekTo(30, true);

Get Video Duration

This feature allows you to get the duration of the currently loaded video. The `getDuration` method returns a promise that resolves with the duration in seconds.

player.getDuration().then(duration => console.log(duration));

Other packages similar to youtube-player

Keywords

FAQs

Package last updated on 13 Feb 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc