Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Music ends abruptly without log #3314

Closed
1 task
JMTK opened this issue Jun 1, 2019 · 3 comments
Closed
1 task

Music ends abruptly without log #3314

JMTK opened this issue Jun 1, 2019 · 3 comments
Assignees

Comments

@JMTK
Copy link
Contributor

JMTK commented Jun 1, 2019

I checked this before opening this. It seems to be the similar, but the dispatcher doesn't seem to fire any more events.

Please describe the problem you are having in as much detail as possible:
This code has remained largely unchanged, but I used to be on 1327889
when it was first checked in and did not get latest src for a while. Once I got the current build(hash below), I had a couple of code updates to do with changing voiceConnection -> voice.connection etc. However some songs abruptly stop without error/debug log. A video it happened to was https://www.youtube.com/watch?v=penvn9VL32Y. However I restarted the bot and queued it again and it finished without stopping so it isn't consistent from my testing.

If I call my skip command to go to the next song in queue, it begins playing the next song as if nothing was wrong.

Include a reproducible code sample here, if possible:

//in another file
mybot.on('debug', (e) => {
    var err = e.toString().toLowerCase();
    if (err.includes("voice")) util.log("DEBUG>", e);
});

//in music file
let ytstream = ytdl(nextSong.url, {
  filter: "audioonly",
  quality: "highestaudio"
});

ytstream.on("error", err => {
  util.log("ytdl err: ", err.toString().split("\n")[0]);

  ytstream.destroy();

  musicReply(message, "There was an issue playing this track");
  moveToNextSongInQueue();
});

ytstream.on("info", async o => {
  let ts =
    nextSong.timestamp && !isNaN(nextSong.timestamp) ? nextSong.timestamp : 0;
  let volume = Config.AudioVolume;
  try {
    let l = o.loudness; //yt volume equalization
    volume = Number(((60 + (l && l < 0 ? l : -40)) / 100).toFixed(2));
  } catch (ex) {
    volume = Config.AudioVolume;
  }
  if (isNaN(volume)) {
    volume = Config.AudioVolume;
  }
  util.log("Intent Info", ts, volume); //this is usually something like 0, 0.2
  let intent = vCon.play(ytstream, {
    seek: ts,
    volume: volume
  });

  intent.on("debug", util.log);

  intent.once("error", e => {
    try {
      util.log("ERROR> Playing YouTube", e);

      if (e.toString().includes("ERR_STREAM_DESTROYED")) return;
      musicReply(message, "There was an issue playing this song.");
    } catch (ex) {
      util.log(ex);
    }
  });

  intent.once("finish", () => {
    try {
      ytstream.destroy();

      queue.splice(0, 1);
      playNextSong();
    } catch (ex) {
      util.log(ex);
    }
  });
});

Log output
image

Further details:

The only optional package I have is zlib-sync.

I'm happy to provide more code/versions if needed.

  • Priority this issue should have – please be realistic and elaborate if possible:

  • I have also tested the issue on latest master, commit hash:
    I can get latest but it didn't look like any major voice changes happened.

@amishshah amishshah self-assigned this Jun 1, 2019
@hickleydonate

This comment has been minimized.

@JMTK
Copy link
Contributor Author

JMTK commented Nov 16, 2019

This seems mostly resolved by upping the highWaterMark value. I don't know if that's considered an acceptable solution though.

fent/node-ytdl-core#402

@iCrawl
Copy link
Member

iCrawl commented Feb 24, 2020

#3362

@iCrawl iCrawl closed this as completed Feb 24, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants