0.0.9 • Published 3 years ago

musix-streamer v0.0.9

Weekly downloads
19
License
UNLICENSED
Repository
-
Last release
3 years ago

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

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago