Installations
npm install react-youtube
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>= 14.x
Node Version
16.14.2
NPM Version
8.19.1
Score
90.3
Supply Chain
100
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (95.68%)
JavaScript (2.52%)
HTML (0.72%)
CSS (0.66%)
Shell (0.41%)
Developer
Download Statistics
Total Downloads
59,502,457
Last Day
21,930
Last Week
253,583
Last Month
1,557,260
Last Year
16,704,002
GitHub Statistics
1,864 Stars
413 Commits
222 Forks
20 Watching
7 Branches
45 Contributors
Bundle Size
17.46 kB
Minified
5.88 kB
Minified + Gzipped
Package Meta Information
Latest Version
10.1.0
Package Id
react-youtube@10.1.0
Unpacked Size
72.48 kB
Size
10.63 kB
File Count
7
NPM Version
8.19.1
Node Version
16.14.2
Total Downloads
Cumulative downloads
Total Downloads
59,502,457
Last day
-71.2%
21,930
Compared to previous day
Last week
-33.7%
253,583
Compared to previous week
Last month
-1%
1,557,260
Compared to previous month
Last year
13.9%
16,704,002
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
react-youtube
Simple React component acting as a thin layer over the YouTube IFrame Player API
Features
- url playback
- playback event bindings
- customizable player options
Installation
NPM
1npm install react-youtube
Yarn
1yarn add react-youtube
PNPM
1pnpm add react-youtube
Usage
1<YouTube 2 videoId={string} // defaults -> '' 3 id={string} // defaults -> '' 4 className={string} // defaults -> '' 5 iframeClassName={string} // defaults -> '' 6 style={object} // defaults -> {} 7 title={string} // defaults -> '' 8 loading={string} // defaults -> undefined 9 opts={obj} // defaults -> {} 10 onReady={func} // defaults -> noop 11 onPlay={func} // defaults -> noop 12 onPause={func} // defaults -> noop 13 onEnd={func} // defaults -> noop 14 onError={func} // defaults -> noop 15 onStateChange={func} // defaults -> noop 16 onPlaybackRateChange={func} // defaults -> noop 17 onPlaybackQualityChange={func} // defaults -> noop 18/>
For convenience it is also possible to access the PlayerState constants through react-youtube:
YouTube.PlayerState
contains the values that are used by the YouTube IFrame Player API.
Example
1// js 2import React from 'react'; 3import YouTube from 'react-youtube'; 4 5class Example extends React.Component { 6 render() { 7 const opts = { 8 height: '390', 9 width: '640', 10 playerVars: { 11 // https://developers.google.com/youtube/player_parameters 12 autoplay: 1, 13 }, 14 }; 15 16 return <YouTube videoId="2g811Eo7K8U" opts={opts} onReady={this._onReady} />; 17 } 18 19 _onReady(event) { 20 // access to player in all event handlers via event.target 21 event.target.pauseVideo(); 22 } 23}
1// ts 2import React from 'react'; 3import YouTube, { YouTubeProps } from 'react-youtube'; 4 5function Example() { 6 const onPlayerReady: YouTubeProps['onReady'] = (event) => { 7 // access to player in all event handlers via event.target 8 event.target.pauseVideo(); 9 } 10 11 const opts: YouTubeProps['opts'] = { 12 height: '390', 13 width: '640', 14 playerVars: { 15 // https://developers.google.com/youtube/player_parameters 16 autoplay: 1, 17 }, 18 }; 19 20 return <YouTube videoId="2g811Eo7K8U" opts={opts} onReady={onPlayerReady} />; 21}
Controlling the player
You can access & control the player in a way similar to the official api:
The
APIcomponent will pass an event object as the sole argument to each ofthose functionsthe event handler props. The event object has the following properties:
- The event's
target
identifies the video player that corresponds to the event.- The event's
data
specifies a value relevant to the event. Note that theonReady
event does not specify adata
property.
License
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 13/14 approved changesets -- score normalized to 9
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/commitlint.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/commitlint.yml/canary?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/commitlint.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/commitlint.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/deploy.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/deploy.yml/canary?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/deploy.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/release.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/release.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/tests.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/tests.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/tests.yml/canary?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/tjallingt/react-youtube/tests.yml/canary?enable=pin
- Info: 0 out of 9 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/commitlint.yml:1
- Warn: no topLevel permission defined: .github/workflows/deploy.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Warn: no topLevel permission defined: .github/workflows/tests.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
Project has not signed or included provenance with any releases.
Details
- Warn: release artifact v10.1.0 not signed: https://api.github.com/repos/tjallingt/react-youtube/releases/83906111
- Warn: release artifact v10.1.0-canary.1 not signed: https://api.github.com/repos/tjallingt/react-youtube/releases/83905914
- Warn: release artifact v10.0.0-canary.2 not signed: https://api.github.com/repos/tjallingt/react-youtube/releases/83900203
- Warn: release artifact v10.0.0 not signed: https://api.github.com/repos/tjallingt/react-youtube/releases/76872837
- Warn: release artifact v10.0.0-canary.1 not signed: https://api.github.com/repos/tjallingt/react-youtube/releases/76861654
- Warn: release artifact v10.1.0 does not have provenance: https://api.github.com/repos/tjallingt/react-youtube/releases/83906111
- Warn: release artifact v10.1.0-canary.1 does not have provenance: https://api.github.com/repos/tjallingt/react-youtube/releases/83905914
- Warn: release artifact v10.0.0-canary.2 does not have provenance: https://api.github.com/repos/tjallingt/react-youtube/releases/83900203
- Warn: release artifact v10.0.0 does not have provenance: https://api.github.com/repos/tjallingt/react-youtube/releases/76872837
- Warn: release artifact v10.0.0-canary.1 does not have provenance: https://api.github.com/repos/tjallingt/react-youtube/releases/76861654
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Reason
23 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-hpx4-r86g-5jrg
- Warn: Project is vulnerable to: GHSA-prr3-c3m5-p7q2
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-7hpj-7hhx-2fgx
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-c59h-r6p8-q9wc
- Warn: Project is vulnerable to: GHSA-g77x-44xx-532m
- Warn: Project is vulnerable to: GHSA-7gfc-8cq8-jh5f
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4
Score
3.3
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-youtube
react-player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
react-native-youtube-iframe
A simple wrapper around the youtube iframe js API for react native
react-lite-youtube-embed
A private by default, faster and cleaner YouTube embed component for React applications
@plasmicpkgs/react-youtube
Plasmic registration call for react-youtube