
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@andrewgibson/react-youtube-fixed
Advanced tools
Control fixed-position YouTube videos from anywhere in your React application
A fixed-position, responsive YouTube player you can control from anywhere in your React app!
Uses:
npm i @andrewgibson/react-youtube-fixed --save
yarn add @andrewgibson/react-youtube-fixed
<script src="https://unpkg.com/@andrewgibson/react-youtube-fixed@latest/dist/rytf.min.js"></script>
import React, { useContext } from 'react';
import { render } from 'react-dom';
import {
YouTubeContext, // the context itself
FixedYouTube, // the actual player component
YouTubeWrapper, // a wrapper around the context's Provider
} from '@andrewgibson/react-youtube-fixed';
const Controller = () => {
const ytContextValue = React.useContext(YouTubeContext);
const { setVideoId, setIsPlaying, setIsVisible } = ytContextValue;
return (
<div>
<button
onClick={() => {
setVideoId('XgtopghkBZc');
}}
>
Create video
</button>
<button
onClick={() => {
setVideoId(null);
}}
>
Destroy video
</button>
<button
onClick={() => {
setIsPlaying(false);
}}
>
Pause video
</button>
<button
onClick={() => {
setIsPlaying(true);
}}
>
Play video
</button>
<button
onClick={() => {
setIsVisible(false);
}}
>
Hide video
</button>
<button
onClick={() => {
setIsVisible(true);
}}
>
Show video
</button>
</div>
);
};
const App = () => (
<div>
<Controller />
<FixedYouTube />
</div>
);
render(
<YouTubeWrapper>
<App />
</YouTubeWrapper>,
document.getElementById('foo')
);
The <YouTubeWrapper />
component has one optional prop:
initialVideoId (string, default: null)
: If you want a video to play immediately when FixedYouTube
is rendered, send this in.A small stylesheet positions the player and makes it go full width on smaller screens.
import '@andrewgibson/react-youtube-fixed/dist/rytf.min.css'
;
<link href="https://unpkg.com/@andrewgibson/react-youtube-fixed@latest/dist/rytf.min.css" rel="stylesheet" type="text/css">
You can run npm run dev
to fire up a development server. The index.html
file in this repo contains the bundle produced by that command.
We tell TypeScript to compile down to ES5, but you'll need promises for this thing to work.
MIT
FAQs
Control fixed-position YouTube videos from anywhere in your React application
The npm package @andrewgibson/react-youtube-fixed receives a total of 0 weekly downloads. As such, @andrewgibson/react-youtube-fixed popularity was classified as not popular.
We found that @andrewgibson/react-youtube-fixed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.