node-youtube-player
v1.0.2
Published
NodeJs YouTube Player by text search.
Downloads
9
Maintainers
Readme
NodeJs Youtube Player
Install
npm i -S node-youtube-player
On Debian/Ubuntu, the ALSA backend is selected by default, so be sure to have the alsa.h header file in place:
sudo apt-get install libasound2-dev
Use
const YoutubePlay = require('node-youtube-player');
// (optional) Pass true as second argument to enable Debugging console logs
const yt = new YoutubePlay("<YOUR-YOUTUBE-TOKEN>", true);
yt.play("In my feelings");
Methods
// Play music
yt.play("Despacito");
// Pause music
yt.pause();
// Stop music
yt.stop();
Events
const YoutubePlay = require('node-youtube-player');
// (optional) Pass true as second argument to enable Debugging console logs
const yt = new YoutubePlay("<YOUR-YOUTUBE-TOKEN>", true);
yt.play("In my feelings");
yt.events.on("play", () => {
console.log("Music playing...");
});
yt.events.on("stop", () => {
console.log("Music stops.");
});