JSPM

  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q62876F
  • License MIT

Dual-mode audio library: HTTP streaming proxy + Discord player (Lavalink alternative). Supports YouTube, Spotify, SoundCloud with audio filters.

Package Exports

  • streamify-audio
  • streamify-audio/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (streamify-audio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐ŸŽต Streamify

A dual-mode Node.js audio streaming engine that actually works with YouTube.

npm version License: MIT Node.js


โšก Why Streamify?

YouTube breaks music bots constantly. Lavalink times out. DisTube uses fragmented formats that fail. Most libraries don't work reliably anymore.

Streamify works because it:

  • Uses format 18 (progressive MP4, not fragmented DASH)
  • Uses web_creator player client (bypasses restrictions)
  • Pipes directly to Discord (no HTTP timeouts)
  • Relies on yt-dlp (actively maintained, adapts fast)

๐ŸŽฏ Two Modes, One Library

Streamify offers two ways to stream audio:

Mode Use Case How It Works
๐ŸŽฎ Discord Player Discord music bots Direct pipe to @discordjs/voice
๐ŸŒ HTTP Server Web apps, other platforms, debugging REST API with stream URLs

Both modes share the same providers, filters, and streaming engine.


๐ŸŽต Supported Sources

Streamify is built to be a universal audio engine. It supports:

  • YouTube: Videos, Music, Shorts, Live, Playlists
  • Spotify: Tracks, Albums, Playlists (resolved to YouTube)
  • SoundCloud: Tracks
  • Twitch: Live streams
  • Mixcloud: Mixes and DJ sets
  • Bandcamp: Tracks and Albums
  • Direct URLs: Public raw audio links (MP3, OGG, WAV, etc.)
  • Local Files: Absolute or relative paths on the host system

๐Ÿš€ Quick Start

npm install streamify-audio

๐ŸŽฎ Discord Player Mode

For Discord bots โ€” plays directly in voice channels.

npm install @discordjs/voice @discordjs/opus
const { Client, GatewayIntentBits } = require('discord.js');
const Streamify = require('streamify-audio');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent
    ]
});

const manager = new Streamify.Manager(client, {
    cookiesPath: './cookies.txt'
});

client.on('messageCreate', async (message) => {
    if (message.content.startsWith('!play')) {
        const query = message.content.slice(6);
        const vc = message.member.voice.channel;

        const result = await manager.search(query);
        const player = await manager.create(message.guild.id, vc.id);

        player.on('trackStart', (track) => {
            message.channel.send(`๐ŸŽต Now playing: **${track.title}**`);
        });

        await player.play(result.tracks[0]);
    }
});

client.login(process.env.TOKEN);

๐ŸŒ HTTP Server Mode

For web apps, external services, or any platform that can consume audio streams.

const Streamify = require('streamify-audio');

const streamify = new Streamify({
    port: 8787,
    host: '0.0.0.0'
});

await streamify.start();
console.log('Server running at http://localhost:8787');

// Search for tracks
const results = await streamify.youtube.search('never gonna give you up');
console.log(results.tracks[0].title);

// Get a stream URL (playable in any audio player)
const url = streamify.youtube.getStreamUrl(results.tracks[0].id);
// โ†’ http://localhost:8787/youtube/stream/dQw4w9WgXcQ

// With filters
const urlWithFilters = streamify.youtube.getStreamUrl('dQw4w9WgXcQ', {
    bass: 10,
    speed: 1.25,
    nightcore: true
});
// โ†’ http://localhost:8787/youtube/stream/dQw4w9WgXcQ?bass=10&speed=1.25&nightcore=true

๐ŸŒ HTTP Server API

When running in HTTP mode, Streamify exposes a REST API:

Endpoints

Method Endpoint Description
GET /health Server status
GET /stats Memory, uptime, active streams
GET /streams List all active streams
GET /youtube/search?q=query Search YouTube
GET /youtube/info/:id Get track info
GET /youtube/stream/:id Stream audio (OGG/Opus)
GET /spotify/search?q=query Search Spotify
GET /spotify/stream/:id Stream Spotify track
GET /soundcloud/search?q=query Search SoundCloud
GET /soundcloud/stream/:id Stream SoundCloud track
GET /twitch/stream/:channel Stream Twitch live
GET /mixcloud/stream/:id Stream Mixcloud set
GET /bandcamp/stream/:id Stream Bandcamp track
GET /http/stream/:base64_url Stream from direct URL
GET /local/stream/:base64_path Stream local file
GET /search?q=query&source=... Generic search across providers
GET /stream/:source/:id Generic stream endpoint

Stream Parameters

Add query parameters to /stream endpoints for real-time audio processing:

/youtube/stream/dQw4w9WgXcQ?bass=10&speed=1.25&nightcore=true

Example: Web Audio Player

<audio controls>
    <source src="http://localhost:8787/youtube/stream/dQw4w9WgXcQ" type="audio/ogg">
</audio>

Example: Fetch from Backend

// Search
const response = await fetch('http://localhost:8787/youtube/search?q=lofi+beats');
const { tracks } = await response.json();

// Play in browser
const audio = new Audio(`http://localhost:8787/youtube/stream/${tracks[0].id}`);
audio.play();

โœจ Features

Feature Discord HTTP
๐ŸŽต YouTube, Spotify, SoundCloud โœ… โœ…
๐ŸŽฎ Twitch, Mixcloud, Bandcamp โœ… โœ…
๐Ÿ“ Local Files & Direct URLs โœ… โœ…
๐Ÿ“บ Voice Channel Status โœ… โ€”
๐Ÿ” Advanced Search Filters โœ… โœ…
๐Ÿ“‹ Playlists & Albums โœ… โœ…
๐ŸŽš๏ธ 30+ Stackable Filters โœ… โœ…
๐ŸŽ›๏ธ 15-Band Equalizer โœ… โœ…
๐ŸŽจ 15 EQ Presets โœ… โœ…
๐Ÿ”„ Seamless Transitions โœ… โœ…
โญ๏ธ Instant Skip (prefetch) โœ… โ€”
โธ๏ธ Auto-pause when alone โœ… โ€”
โ–ถ๏ธ Auto-resume on rejoin โœ… โ€”
๐Ÿšช Auto-leave on inactivity โœ… โ€”
๐Ÿšซ Sponsorblock โœ… โœ…
๐Ÿ“Š Timing & Performance Logs โœ… โœ…
๐Ÿ”Œ No Lavalink/Java needed โœ… โœ…

๐ŸŽฎ Discord Player Features

Voice Channel Status

Show what's playing directly in the sidebar of the voice channel.

const manager = new Streamify.Manager(client, {
    voiceChannelStatus: {
        enabled: true,
        template: '๐ŸŽถ Playing: {title} | {requester}'
    }
});

Search with Filters

Filter for live streams, sort results, or filter by artist.

const results = await manager.search('lofi hip hop', {
    source: 'youtube',   // youtube, spotify, soundcloud
    type: 'live',        // video, live, playlist
    sort: 'popularity',  // relevance, popular, latest
    limit: 10
});

// Artist search - filters results to only include tracks by that artist
const artistTracks = await manager.search('Drake', {
    source: 'spotify',
    artist: 'Drake',     // filters results to tracks BY this artist
    limit: 5
});

Queue Management

const player = manager.get(guildId);

// Add tracks
player.queue.add(track);
player.queue.addMany(tracks);

// Controls
await player.skip();
await player.previous();
await player.seek(30000); // 30 seconds

// Queue operations
player.queue.shuffle();
player.queue.move(0, 5);
player.queue.remove(2);
player.queue.clear();

// Loop modes
player.setLoop('off');    // No loop
player.setLoop('track');  // Loop current track
player.setLoop('queue');  // Loop entire queue

Events

player.on('trackStart', (track) => {
    console.log(`Playing: ${track.title}`);
});

player.on('trackEnd', (track, reason) => {
    console.log(`Ended: ${track.title} (${reason})`);
});

player.on('queueEnd', () => {
    console.log('Queue finished');
});

player.on('trackError', (track, error) => {
    console.error(`Error: ${error.message}`);
});

// Voice events
player.on('userJoin', (member, count) => { });
player.on('userLeave', (member, count) => { });
player.on('channelEmpty', () => { });
player.on('autoPause', (userCount) => { });
player.on('autoResume', (userCount) => { });

Auto Features

const manager = new Streamify.Manager(client, {
    autoLeave: {
        enabled: true,
        emptyDelay: 30000,      // Leave after 30s if channel empty
        inactivityTimeout: 300000  // Leave after 5min of no playback
    },
    autoPause: {
        enabled: true,
        minUsers: 1  // Pause when fewer than 1 user (excluding bot)
    },
    autoplay: {
        enabled: true,
        maxTracks: 5  // Add up to 5 related tracks when queue ends
    }
});

๐ŸŽ›๏ธ Filters & Presets

Both modes support the same filters:

// Discord mode
await player.setFilter('bass', 10);
await player.setFilter('nightcore', true);
await player.setPreset('rock');

// HTTP mode (via URL params)
const url = streamify.getStreamUrl('youtube', 'dQw4w9WgXcQ', {
    bass: 10,
    nightcore: true,
    preset: 'rock'
});

EQ Presets

flat ยท rock ยท pop ยท jazz ยท classical ยท electronic ยท hiphop ยท acoustic ยท rnb ยท latin ยท loudness ยท piano ยท vocal ยท bass_heavy ยท treble_heavy

All available filters
Filter Type Description
bass -20 to 20 Bass boost/cut
treble -20 to 20 Treble boost/cut
speed 0.5 to 2.0 Playback speed
pitch 0.5 to 2.0 Pitch shift
volume 0 to 200 Volume %
nightcore boolean Speed + pitch up
vaporwave boolean Speed + pitch down
subboost boolean Extreme sub-bass boost
reverb boolean Room acoustics effect
surround boolean Surround sound mapping
boost boolean Clarity & volume boost
8d boolean Rotating audio
karaoke boolean Reduce vocals
bassboost boolean Heavy bass
tremolo object Volume wobble
vibrato object Pitch wobble
rotation object 8D with custom speed
flanger boolean Flanger effect
phaser boolean Phaser effect
chorus boolean Chorus effect
compressor boolean Dynamic compression
normalizer boolean Loudness normalization
lowpass Hz Cut highs
highpass Hz Cut lows
bandpass object Bandpass filter
bandreject object Notch filter
lowshelf object Low shelf EQ
highshelf object High shelf EQ
peaking object Parametric EQ
mono boolean Stereo to mono
surround boolean Surround effect

Streamify Lavalink
Setup npm install Java + separate server
YouTube โœ… Works โš ๏ธ Timeout issues
Latency ~3s start Variable
Skip Instant 2-3s
Dependencies Node.js only Java 17+
Filters Built-in Requires config
Auto-pause โœ… Built-in โŒ DIY
HTTP API โœ… Built-in โŒ WebSocket only

โš™๏ธ Configuration

Discord Mode

const manager = new Streamify.Manager(client, {
    ytdlpPath: '/usr/local/bin/yt-dlp',
    ffmpegPath: '/usr/bin/ffmpeg',
    cookiesPath: './cookies.txt',
    providers: {
        youtube: { enabled: true },
        spotify: { enabled: true },
        soundcloud: { enabled: true },
        twitch: { enabled: true },
        mixcloud: { enabled: true },
        bandcamp: { enabled: true }
    },
    spotify: {
        clientId: 'your_client_id',
        clientSecret: 'your_client_secret'
    },
    audio: {
        bitrate: '128k',
        format: 'opus',
        vbr: true,
        compressionLevel: 10,
        application: 'audio'
    },
    ytdlp: {
        format: 'bestaudio/best',
        additionalArgs: []
    },
    defaultVolume: 80,
    maxPreviousTracks: 25,
    sponsorblock: {
        enabled: true,
        categories: ['sponsor', 'selfpromo', 'interaction', 'intro', 'outro', 'preview', 'music_offtopic']
    }
});

HTTP Mode

const streamify = new Streamify({
    port: 8787,
    host: '0.0.0.0',
    ytdlpPath: '/usr/local/bin/yt-dlp',
    ffmpegPath: '/usr/bin/ffmpeg',
    cookiesPath: './cookies.txt',
    providers: {
        youtube: { enabled: true },
        spotify: { enabled: true },
        soundcloud: { enabled: true },
        twitch: { enabled: true },
        mixcloud: { enabled: true },
        bandcamp: { enabled: true }
    },
    spotify: {
        clientId: 'your_client_id',
        clientSecret: 'your_client_secret'
    },
    audio: {
        bitrate: '128k',
        format: 'opus',
        vbr: true,
        compressionLevel: 10,
        application: 'audio'
    },
    ytdlp: {
        format: 'bestaudio/best',
        additionalArgs: []
    },
    logLevel: 'info'
});

๐Ÿ“‹ Requirements

  • Node.js 18+
  • yt-dlp โ€” pip install yt-dlp
  • ffmpeg โ€” apt install ffmpeg
  • @discordjs/voice + @discordjs/opus โ€” Discord mode only

๐Ÿ“– Documentation

Guide Description
Quick Start Get running in 5 minutes
Configuration All options explained
Filters Audio filters, EQ, presets
Events Player events reference
Examples Full bot examples


๐Ÿ“„ License

MIT ยฉ LucasCzechia