question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

playFile/playStream fails to play short (<1 sec) files

See original GitHub issue

My bot has a soundboard command where the bot joins a voice channel, plays a simple mp3 file, then leaves.

On 8.x I had no trouble but I couldn’t figure out why some mp3s weren’t launching on 9.x and I narrowed it down to the ones that were that short(less than 1 second long).

I’ve tested it on 3 different mp3s and none of them work, however other mp3s longer than this seem to work correctly.

vc
    .join()
    .then(conn => {
        console.log(fileName);
        const intent = conn.playFile(fileName, {volume: Config.AudioVolume});
        intent.on('debug', i => {
            console.log(i);
        });
        intent.on('start', () => {
            console.log("playing " + fileName);
        });
        intent.once('end', () => {
            //intent usually ends before it's acutally done outputting to the websocket
            setTimeout(function() {
                message
                    .delete()
                    .catch(merr => {
                        console.log("Deleted message after voice: " + merr);
                    }
                );
                conn.channel.leave();
            }, 800);
        });
        intent.once('error', errWithFile => {
            console.log("err with file: " + errWithFile);
            util.botReply(message, "There was an error playing your soundbite.");
            conn.channel
                .leave()
                .catch(function(e) {
                    console.log("err leaving voice channel: " + e);
                }
            );
        });
    })
    .catch(e => {
        console.log("err joining voice: " + e);
    }
);

In this code example, normal mp3s play and then the bot leaves the channel. Printing out something like

/some/path/potg.mp3 playing /some/path/potg.mp3 Triggered terminal state end - stream is now dead

However with <1s mp3, I get only

/some/path/short.mp3

And nothing follows, the music intent never fires “start”.

I can’t upload mp3s here, I can gladly link the ones that I have tested(with permission to do so).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:20 (16 by maintainers)

github_iconTop GitHub Comments

16reactions
amishshahcommented, Dec 28, 2016

Really happy to announced this is finally fixed on the indev-prism branch! 🎉

While this isn’t completely ready for release, it’s fairly stable and it simplifies a lot of voice internals. It uses prism-media which moves a lot of the audio transcoding code that used to exist in discord.js into a separate module. It has a significant performance improvement when streaming from files, and should also allow streaming from URLs!

Anyway, I’ll close this issue once the fix is released 😃

6reactions
amishshahcommented, Dec 24, 2016

Taking another look at voice soon, should have this fixed soon 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

SEC EDGAR Filer Technical Support
A filing is suspended when it does not meet EDGAR's content or technical requirements. One of the most common reasons for a suspended...
Read more >
Fails-to-Deliver Data - SEC.gov
File Format Size File: November 2022, second half Format:ZIP Size:1.4 MB File: November 2022, first half Format:ZIP Size:1.11 MB File: October 2022, second half Format:ZIP Size:1.35...
Read more >
Instructions for Electronic Filing and Service Of Documents in ...
Documents you file electronically in eFAP, and which are served on you by the. Commission, on or after the compliance date will be...
Read more >
Securities Act Rules - SEC.gov
Question: When the conditions of Rule 144(c)(1) must be satisfied in selling ... at the time of filing, does not satisfy the registrant ......
Read more >
Frequently Asked Questions About Form 13F - SEC.gov
Q: What is a Form 13F file number, and how do I get one? ... like your short equity positions will not be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found