Skip to content
This repository has been archived by the owner on Dec 15, 2019. It is now read-only.

Commit

Permalink
fix(discord-bot): try to fix youtube tracks by increasing highWaterMark
Browse files Browse the repository at this point in the history
  • Loading branch information
TotomInc committed Jan 22, 2019
1 parent b39cf87 commit 6e4d69f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export async function fetchHandler(query: string, message: Discord.Message): Pro
export function getReadableStream(track: models.Track): Readable {
return YTDL(track.streamURL, {
filter: 'audioonly',
highWaterMark: 1<<25,
})
.on('error', (err) => {
logger.log('error', 'youtube-handler YTDL error from getReadableStream');
Expand Down

2 comments on commit 6e4d69f

@Spellminer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you add highWaterMark to your code? Im trying to add it to mine but I cant seem to get it to work, would appreciate it if we could chat over discord or something to fix this,

@TotomInc
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Spellminer, as mentioned in the ytdl-core docs (readme), you can pass options to the YTDL function. In those options, an option named highWaterMark will determine how much of the video download to buffer into memory. See node's docs for more.

See this comment by @fent which explains how highWaterMark resolves this issue.

Please sign in to comment.