0.4.0
New features
Opus audio probing utility
The new probing utility lets you figure out whether it's possible to demux your ReadableStream with an Ogg/WebM demuxer, rather than passing it to FFmpeg straight away. This enables you to make some performance improvements:
import { createReadStream } from 'fs';
import { StreamType, demuxProbe, createAudioResource } from '@discordjs/voice';
async function start() {
// Example verifications
assert.equal((await demuxProbe(createReadStream('file.mp3'))).type, StreamType.Arbitrary);
assert.equal((await demuxProbe(createReadStream('file.opus'))).type, StreamType.OggOpus);
assert.equal((await demuxProbe(createReadStream('file.webm'))).type, StreamType.WebmOpus);
// Example of creating an audio resource using the probe
const input = createReadStream('./song.unknownextension');
const { stream, type } = await demuxProbe(input);
createAudioResource(stream, { inputType: type });
}
Silence padding for audio resources
By default, all audio resources now end with 5 packets of silence to avoid interpolation noises. See #120 on examples of configurability.
Other
- You can now use event handlers that return
void | Promise<void>
, since the latter is handled exactly the same as avoid
return in Node.js v16 - The music bot example has been refactored to use
youtube-dl
instead ofytdl-core
/ytdl-core-discord
for streaming videos due to its reliability.
Commits
-
feat(Util): add Opus audio probing utility (#118)
-
chore(Deps): update prism-media
-
feat(Util): opus demux probe tool
-
feat: update music bot example
-
refactor(Util): remove unnecessary log
-
chore: update typescript dep in example
-
chore(Util): add docs to demuxProbe
-
chore: update discord.js dep and set download limit cap in example
-
refactor: use youtube-dl-exec instead of child_process
-
test(Util): initial demuxProbe test
-
test(Util): remaining demuxProbe tests
-
refactor: combine event listener bindings in docs
-
refactor: use promises properly in example
-
docs(Util): write docs for ProbeInfo
-
refactor: use probe.stream in music bot example
-
-
feat!: add silence padding frames to AudioResources (#120)
-
feat(AudioResource): add ended getter
-
feat(AudioResource): silence padding frames
-
test(AudioResource): silence padding frames
-
feat(AudioPlayer): stop() respects silent padding by default
-
test(AudioPlayer): stop() will play silence frames
-
feat(AudioResource): use silenceRemaining in ended
-
test(AudioResource): read() after silence ends
-
-
feat: allow awaitable void event listeners, fix VoiceConnection disconnected states (#121)
- feat: use Awaited for event emitters
Credit to Kyra for the Awaited implementation in discord.js
Co-authored-by: Antonio Román [email protected]
- fix(Example): improve reconnection logic
Co-authored-by: Antonio Román [email protected]
-
chore(Examples): re-enable eslint rule
-
chore(Release): v0.4.0