1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 00:23:17 +00:00

version and some formatting to play func

This commit is contained in:
MatteZ02 2020-04-23 19:18:57 +03:00
parent 3f1aedfef8
commit 6408cbe525
3 changed files with 8 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "musix", "name": "musix",
"version": "3.2.0", "version": "3.2.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -44,4 +44,4 @@
"ytdl-core": "^2.1.0", "ytdl-core": "^2.1.0",
"zlib-sync": "^0.1.6" "zlib-sync": "^0.1.6"
} }
} }

View File

@ -16,7 +16,8 @@ module.exports = async function (guild, song, client, seek, play) {
streamConfig.options.seek = seek; streamConfig.options.seek = seek;
let input = song.url; let input = song.url;
if (song.type === "ytdl") input = ytdl(song.url, streamConfig.ytdlOptions); if (song.type === "ytdl")
input = ytdl(song.url, streamConfig.ytdlOptions);
const ffmpegArgs = [ const ffmpegArgs = [
"-analyzeduration", "-analyzeduration",
@ -44,10 +45,12 @@ module.exports = async function (guild, song, client, seek, play) {
args.unshift("-ss", String(seek)); args.unshift("-ss", String(seek));
const transcoder = new prism.FFmpeg({ const transcoder = new prism.FFmpeg({
args: args args: args,
}); });
const stream = input.pipe(transcoder); const stream = input.pipe(transcoder).on("error", (error) => {
console.log(error);
});
const dispatcher = queue.connection const dispatcher = queue.connection
.play(stream, streamConfig.options) .play(stream, streamConfig.options)