musix-streamer
v0.0.9
Published
An easy way to stream audio
Downloads
3
Readme
musix-streamer
An easy way to stream audio
Support
You can contact us on our Discord server
Usage
Play a readable stream
const Streamer = require("musix-streamer");
const ytdl = require("ytdl-core");
const Speaker = require("speaker");
const streamer = new Streamer();
const speaker = new Speaker({
channels: 2,
bitDepth: 16,
sampleRate: 44100
});
console.log("start playback");
streamer.stream(ytdl("https://www.youtube.com/watch?v=hyj4JFSErrw")).pipe(speaker);
API
Streamer(options?: constructorOptions)
stream(options: streamOptions) returns
streamOptions
- List of options can be found here.
Options
All options are optional!
constructorOptions
{
opus: boolean, // whether to output an opus stream (skipping ffmpeg and improving performance) Defaults to `false`
volume: boolean, // whether to have the ability to alter volume. Defaults to `true`
output: outputType // what to output when streaming. Defaults to `readable`
}
streamOptions
{
seek: number, // how far to seek in the stream when starting playback.
volume: number, // initial volume when starting playback. Defaults to `1`
ffmpegArgs: array // Custom FFmpeg arguments to pass.
}
outputType
Ffmpeg: Will output an instance of FFmpeg. readable: Will output an instance of nodeJS readable. opus: Will output an instance of opus encoder. (useful for Discord bots)
Copyright (c) 2020 MatteZ02