4.0.6 • Published 4 years ago

@favware/ytdl-prismplayer v4.0.6

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago


Project Status

GitHub Coverage Status

Bundle Sizes

npm bundle size npm bundle size npm

Social Media and Donations

Join Discord server Twitter Follow Patreon Donate PayPal Donate


For compatible videos, this module uses prism-media to extract Opus or Vorbis audio from a stream without having to pipe it through FFmpeg first. This greatly reduces the processing power required, making playback smoother and allowing you to play over more connections simultaneously.

For videos where the required codec (webm + opus) isn't available, the module will fallback to using FFmpeg to encode the stream in Opus. Many new videos on YouTube are available in this codec so hopefully this isn't frequent.

Put simply, this module finds the most efficient way to extract a stream of Opus or Vorbis audio from a YouTube video.

Install

Install with yarn or npm:

yarn add @favware/ytdl-prismplayer ytdl-core prism-media

# npm install @favware/ytdl-prismplayer ytdl-core prism-media
# ytdl-core and prism-media are mandatory peer dependencies

Usage

Usage depends on the version of Discord.JS you are using, examples below. You can pass the exact same arguments as you would with the ytdl-core module, with the exception that you must await the function call.

Usage in Discord.js 11.x

const ytdl = require('@favware/ytdl-prismplayer');
// import ytdl from '@favware/ytdl-prismplayer'

async function play(connection, url) {
  connection.playOpusStream(await ytdl(url));
}

Usage in Discord.js 12.x / main

const ytdl = require('@favware/ytdl-prismplayer');
// import ytdl from '@favware/ytdl-prismplayer'

async function play(connection, url) {
  connection.play(await ytdl(url), {
    type: 'opus'
  });
}

// You can prefer vorbis instead of opus
async function play(connection, url) {
  connection.play(await ytdl(url, {}, { preferredFormat: 'vorbis' }), {
    type: 'opus'
  });
}

API Documentation

4.0.6

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

3.0.0-canary.0

4 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.3

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.4

4 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.2-next.8

5 years ago

2.1.2-alpha.8

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago