A light-weight YouTube, SoundCloud, Spotify and Deezer streaming and searching library.
- Search by video, playlist/album, channel/artist
- Stream audio from YouTube and SoundCloud
ytdl-core has some issues with miniget and also stream abort issues. On the other hand, youtube-dl is a perfect alternative but it takes time to launch. Hence, play-dl is created to avoid these issues along with providing comparatively faster performance than others.
You can contact us for support on our chat server.
Node.js 16.0.0 or newer is required.
npm install play-dl@latest
pnpm add play-dl@latest
yarn add play-dl@latestTypeScript:
import play from 'play-dl'; // Everything
import { video_basic_info, stream } from 'play-dl'; // Individual functionsCommonJS modules:
const play = require('play-dl'); // Everything
// Individual functions by using destructuring
const { video_basic_info, stream } = require('play-dl');ES6 modules:
import play from 'play-dl'; // Everything
import { video_basic_info, stream } from 'play-dl'; // Individual functionsBecause discord-player doesn't work with raw opus packets you need to enable the compatibility mode in play-dl, if you want to use both frameworks together.
-
To fix the playback of YouTube videos with
discord-player, you can disable some of play-dl's optimisations and fixes by setting thediscordPlayerCompatibilityoption forstreamandstream_from_infoto true -
The
discordPlayerCompatiblityoption might break the playback of long YouTube videos. -
Even with the
discordPlayerCompatibilityoption set you will not be able to use the seek option forstreamandstream_from_info.