create-music-stream
v1.2.0
Published
Creates a PCM 16 bit Little Endian Stream from a **mp3 file** or **youtube video**
Downloads
14
Readme
create-music-stream
Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
Usage
1. Install native dependencies
sudo apt-get install libasound2-dev ffmpeg
2. Install package
yarn add create-music-stream
3. Get music stream
const createMusicStream = require('create-music-stream')
const stream = createMusicStream(source, logger)
Examples
Stream local MP3 file
const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')
createMusicStream('./track.mp3', console.log)
.pipe(new Speaker())
Stream Youtube audio
const Speaker = require('speaker')
const createMusicStream = require('create-music-stream')
createMusicStream('https://www.youtube.com/watch?v=fz4MzJTeL0c', console.log)
.pipe(new Speaker())
Changelog
- 1.0 - First public version
- 1.1 - Adds tests, Adds standard.js, Enables gh-actions, Upgrades deps
- 1.2 - Upgrades deps
FAQ
- If the YouTube player doesn't work read this article What if it stops working?
- If
speaker
dependency is unable to build read this doc Audio Backend Selection - If you want to force
ffmpeg
binary path you can force it with the following code snippet
require('fluent-ffmpeg')
.setFfmpegPath('/your/path/to/ffmpeg')
Contributors
- chrvadala (author)
- cihadturhan