Gathering detailed insights and metrics for youtube-player
Gathering detailed insights and metrics for youtube-player
Gathering detailed insights and metrics for youtube-player
Gathering detailed insights and metrics for youtube-player
npm install youtube-player
Typescript
Module System
Node Version
NPM Version
98.6
Supply Chain
99.5
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
382 Stars
109 Commits
80 Forks
12 Watchers
11 Branches
14 Contributors
Updated on Jul 09, 2025
Latest Version
5.6.0
Package Id
youtube-player@5.6.0
Unpacked Size
32.07 kB
Size
7.82 kB
File Count
19
NPM Version
8.19.3
Node Version
18.14.0
Published on
Feb 13, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
19
youtube-player
is an abstraction of YouTube IFrame Player API (YIPA).
The downsides of using YouTube IFrame Player API are:
window
).youtube-player
:
1/** 2 * @typedef options 3 * @see https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player 4 * @param {Number} width 5 * @param {Number} height 6 * @param {String} videoId 7 * @param {Object} playerVars 8 * @param {Object} events 9 */ 10 11/** 12 * @typedef YT.Player 13 * @see https://developers.google.com/youtube/iframe_api_reference 14 * */ 15 16/** 17 * A factory function used to produce an instance of YT.Player and queue function calls and proxy events of the resulting object. 18 * 19 * @param {YT.Player|HTMLElement|String} elementId Either An existing YT.Player instance, 20 * the DOM element or the id of the HTML element where the API will insert an <iframe>. 21 * @param {YouTubePlayer~options} options See `options` (Ignored when using an existing YT.Player instance). 22 * @param {boolean} strictState A flag designating whether or not to wait for 23 * an acceptable state when calling supported functions. Default: `false`. 24 * See `FunctionStateMap.js` for supported functions and acceptable states. 25 * @returns {Object} 26 */ 27import YouTubePlayer from 'youtube-player';
youtube-player
is a factory function.
The resulting object exposes all functions of an instance of YT.Player
. The difference is that the function body is wrapped in a promise. This promise is resolved only when the player has finished loading and is ready to begin receiving API calls (onReady
). Therefore, all function calls are queued and replayed only when player is ready.
This encapsulation does not affect the API other than making every function return a promise.
1let player; 2 3player = YouTubePlayer('video-player'); 4 5// 'loadVideoById' is queued until the player is ready to receive API calls. 6player.loadVideoById('M7lc1UVf-VE'); 7 8// 'playVideo' is queue until the player is ready to received API calls and after 'loadVideoById' has been called. 9player.playVideo(); 10 11// 'stopVideo' is queued after 'playVideo'. 12player 13 .stopVideo() 14 .then(() => { 15 // Every function returns a promise that is resolved after the target function has been executed. 16 });
player.on
event emitter is used to listen to all YouTube IFrame Player API events, e.g.
1player.on('stateChange', (event) => { 2 // event.data 3}); 4
player.off
removes a previously added event listener, e.g.
1var listener = player.on(/* ... */); 2 3player.off(listener); 4
Note that the built version does not inline polyfills.
You need to polyfill the environment locally (e.g. using a service such as https://polyfill.io/v2/docs/).
youtube-player
is using debug
module to expose debugging information.
The debug
namespace is "youtube-player".
To display youtube-player
logs configure localStorage.debug
, e.g.
1localStorage.debug = 'youtube-player:*'; 2
Using NPM:
1npm install youtube-player
1npm install 2npm run build 3cd ./examples 4npm install 5npm run start
This will start a HTTP server on port 8000.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 7/25 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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 More