
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@gradeup/react-youtube
Advanced tools
Simple React component acting as a thin layer over the YouTube IFrame Player API
$ npm install react-youtube
<YouTube
videoId={string} // defaults -> null
id={string} // defaults -> null
className={string} // defaults -> null
containerClassName={string} // defaults -> ''
opts={obj} // defaults -> {}
onReady={func} // defaults -> noop
onPlay={func} // defaults -> noop
onPause={func} // defaults -> noop
onEnd={func} // defaults -> noop
onError={func} // defaults -> noop
onStateChange={func} // defaults -> noop
onPlaybackRateChange={func} // defaults -> noop
onPlaybackQualityChange={func} // defaults -> noop
/>
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.
import React from 'react';
import YouTube from 'react-youtube';
class Example extends React.Component {
render() {
const opts = {
height: '390',
width: '640',
playerVars: { // https://developers.google.com/youtube/player_parameters
autoplay: 1
}
};
return (
<YouTube
videoId="2g811Eo7K8U"
opts={opts}
onReady={this._onReady}
/>
);
}
_onReady(event) {
// access to player in all event handlers via event.target
event.target.pauseVideo();
}
}
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.
MIT
FAQs
react.js powered YouTube player component
The npm package @gradeup/react-youtube receives a total of 0 weekly downloads. As such, @gradeup/react-youtube popularity was classified as not popular.
We found that @gradeup/react-youtube demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.