abalabahaha / eris

A NodeJS Discord library
https://abal.moe/Eris/
MIT License
1.49k stars 417 forks source link

Webm Streams sometimes end instantly. #213

Open macdja38 opened 7 years ago

macdja38 commented 7 years ago

Tested this with abal the other day without finding a decent solution. Every now and then a webm result from youtube-dl / ytdl pops up that eris refuses to play and instantly skips. using the same https.get method eris uses I can pipe the stream into a file, then play that file though eris, but when fed directly the URL of the stream eris fires an end event instantly.

macdja38 commented 7 years ago

https://pvpcraft.ca/i/6lgu9.png which states the reason as the one emitted by this reason I've added in here https://github.com/macdja38/eris/blob/voice-error/lib/voice/VoiceConnection.js#L438

SinisterRectus commented 7 years ago

Some Discordia users have reported similar occurences. Their streams stop while using youtube-dl and FFmpeg. Likewise, the audio can be fully downloaded to a file and played without issue. I'll keep an eye on this issue, but I'd sooner blame the reliability of a YouTube stream before anything else.

abalabahaha commented 7 years ago

This problem appears to be specific to webm/opus streams though (which bypass FFmpeg entirely)... and I think Mac is using his thing that resumes the stream on ECONNRESET, so that wouldn't be an issue here

macdja38 commented 7 years ago

@abalabahaha @SinisterRectus I can confirm that downloading and playing from a file fixes it... and playing the same song over and over again will reliably skip it. the skip happens with or without my stream-resume library (none of the skips pictured were caused by econnresets, and my library handles those when they pop up).

SomeoneCares11 commented 7 years ago

i was having this problem using npm install node-gyp solved after install node-gyp with -g npm install -g node-gyp

abalabahaha commented 7 years ago

Interesting... because the Webm parser does not use node-gyp in any way

SomeoneCares11 commented 7 years ago

@abalabahaha i solved it in two bots with that command, try it.

macdja38 commented 7 years ago

@SomeoneCares11 I tried it and it didn't work.

Brayzure commented 7 years ago

Are there any more instances of this behavior occurring? More than three months without any followup suggests there aren't.

abalabahaha commented 7 years ago

Yeah, but still don't have a solid repro method

macdja38 commented 7 years ago

It definitely still happens, problem is the urls it happens on seem to be temporary and it seems to depend where they are fetched from. If I download the file using something like wget then eris can play them, but without doing that trying to stream skips.

macdja38 commented 7 years ago

Also nooblance confirms he is having the same issue, though he's not testing on the latest version of eris.

HcgRandon commented 6 years ago

I've definitely experienced this issue as well, sadly it seems very random.

urPlaceOrMine commented 6 years ago

hi-- i don't think this is an ERIS issue. Can we see if this is a USB power management issue. (for Windows users). You need to go to device manager and turn off USB power management.\ usb power management. there is a setting for the device and the usb hub. There is also a similar setting for the network card. All three of these play a part in the success of your app. IMHO.

Even if you set the confuser (computer) to high performance try changing these settings. --Drop me a note and let me know your experience after changing these settings.

UPoM

well sorry I missed this was sorted out

macdja38 commented 6 years ago

It's not sorted out, and I don't know if I speak for all of us but random and I def had this problem on linux not windows.

LJNeon commented 6 years ago

Wait what how do USBs play into anything.

abalabahaha commented 6 years ago

This is caused by a (still unknown) parser bug, and is unrelated to power or networking system settings.

macdja38 commented 5 years ago

So… the bug may actually be that nothing ever bothers to check that it's not trying to parse text / html… on like a redirect page. Also the error handling is not great in that whole region, along with not checking for non 200 response codes from http.get, they are technically successes from the perspective of making a request, so they won't trigger the error handler and if they have a body they get piped to the audio decoder…

linkjay commented 5 years ago

Hello all,

There is a very large chance that this is caused by a buffer read/write issue as I documented in my PR here https://github.com/abalabahaha/eris/pull/451

Try modifying that file on your own in your node_modules with my commit there and see if this will still happen.

Good luck