Git Product home page Git Product logo

nodeshout's People

Contributors

dgurkaynak avatar fusion2004 avatar twosdai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nodeshout's Issues

Stream finished, stop html5 playback

When a stream is finished the html5 stream lose connection so I need to press Play again.
The weird part is that sometime it doesn't, so it's as if there is a variable delay between the start of the next stream. Which seem to stop the playback in the player.

I am using this

const fileStream = new FileReadStream('./some/music.mp3', 65536);
const shoutStream = fileStream.pipe(new ShoutStream(shout));

shoutStream.on('finish', () => {
    // I start the next stream here
});

Is there a way to make sure the next stream is starting fast enough to not stop the connection?

Dynamic Linking Error: Win32 error 126

I cloned the repo. when try to run this project it gives me
Error: Dynamic Linking Error: Win32 error 126
at new DynamicLibrary (C:\Users\anuj\Desktop\testing\nodeshout\node_modules\ffi-napi\lib\dynamic_library.js:75:11)
at Object.Library (C:\Users\anuj\Desktop\testing\nodeshout\node_modules\ffi-napi\lib\library.js:47:10)
at Object. (C:\Users\anuj\Desktop\testing\nodeshout\src\libshout.js:11:23)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (C:\Users\anuj\Desktop\testing\nodeshout\src\index.js:1:18)
git-issue

Metadata

Hi,
how to send Metadata to Icecast, please?

Unable to play next track.

After streaming one mp3 file, the stream turns itself off. And when I try to play the second file, although the data is sent correctly, I cannot listen to it via icecast.

I am experimenting with this piece of code:

const nodeshout = require("nodeshout");
const fs = require("fs");

nodeshout.init();

// Create a shout instance
const shout = nodeshout.create();

// Configure it
shout.setHost('localhost');
shout.setPort(8000);
shout.setUser('source');
shout.setPassword('hackme');
shout.setMount('source');
shout.setFormat(1); // 0=ogg, 1=mp3
shout.setAudioInfo('bitrate', '320');
shout.setAudioInfo('samplerate', '44100');
shout.setAudioInfo('channels', '2');

console.log(shout.open());

function playFile(fileName, next) {
  fs.open(fileName, 'r', function (status, fd) {
    if (status) {
      console.log(status.message);
      return;
    }

    fs.fstat(fd, function (err, stats) {
      var fileSize = stats.size,
        bufferSize = fileSize,
        chunkSize = 4096,
        bytesRead = 0;

      function read() {
        var buffer = Buffer.alloc(bufferSize);

        if ((bytesRead + chunkSize) > fileSize) {
          chunkSize = (fileSize - bytesRead);
        }

        fs.read(fd, buffer, 0, chunkSize, bytesRead, function (err, bytesRead_, buffer) {
          if (err) {
            console.log(e);
            return;
          }

          bytesRead += bytesRead_;
          console.log(fileName, 'Bytes read:' + bytesRead + ' Total:' + fileSize);

          if (bytesRead_ > 0) {
            console.log(shout.send(buffer, bytesRead_));
            setTimeout(read, Math.abs(shout.delay()));
          } else {
            console.log('Zero bytes read, aborting');
            fs.closeSync(fd);
            setTimeout(next, Math.abs(shout.delay()));
          }
        });
      }

      read();
    });
  });
}

const fileNames = fs.readdirSync("./test-mp3s");
let idx = -1;
function playNext() {
  let n = fileNames[(idx = ((idx + 1) % fileNames.length))];
  console.log(n);
  playFile(`./test-mp3s/${n}`, () => {
    playNext();
  });
}

playNext();

Metadata at given time

Hi,
let's say we have a DJ Mix of multiple songs wich is one long audio file.
Is there a way to determine the current position of the stream so that we can inject the correct metadata ?

Ogg is not working

mp3 is fine. But I can't play ogg files.

var song = './mysong.ogg';
shout.setFormat(0); // 0=ogg, 1=mp3

"Read 65536 bytes of data" messages flow too fast, then stream stops, listeners can't hear anything.

Cannot start stream with external host

I am having trouble connecting connecting nodeshout to external Icecast servers. When connecting to localhost, it works perfectly; but if I put in the hostname for an Icecast server on another computer, the stream fails to start.

The program stops when shout.open() invokes ffi_call() in the FFI proxy function. There is no console output, it just hangs.

Here's my stack trace:

Trace
    at eval (eval at proxy (./node_modules/ffi/lib/_foreign_function.js:59:5), <anonymous>:1:9)
    at Object.proxy [as shout_open] (./node_modules/ffi/lib/_foreign_function.js:59:5)
    at shoutT.open (./node_modules/nodeshout/src/shoutT.js:185:21)
    at Object.<anonymous> (./index.js:76:7)
    at Module._compile (internal/modules/cjs/loader.js:686:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)

Stream randomly ends after 8-9 minutes

i use a ffmpeg readableStream as input

  const ffmpegProcess = spawn('ffmpeg',[
        '-i','pipe:3',
        '-f','mp3',
        '-ar','44100',
        '-ac','2',
        '-codec:a','libmp3lame',
        '-b:a','128k',
        'pipe:4'],{stdio:['ignore','ignore','ignore','pipe','pipe']});
        ytdlStream.pipe(ffmpegProcess.stdio[3]);
        resolve(ffmpegProcess.stdio[4]);

below code works for hours without any issue

    readable.on('data',async (chunk)=>{
        shout.sync();
        shout.send(chunk,chunk.length);
    });

but it's blocking so i've tried making it non-blocking like this

    readable.on('data',async (chunk)=>{
        readable.pause();
        shout.send(chunk,chunk.length);
        const delay = shout.delay();
        await new Promise((resolve)=>setTimeout(resolve,delay));
        readable.resume();
    });

this works until 8-9 minutes after that for some reason the stream ends and mountpoint gets destroyed. Is there a better way to read from a stream?

Disconnected event

Is there a way to get notified when you get disconnected from the icecast server?

error when trying to use module

Error: ENOENT: no such file or directory, open 'libshout.so'

Some enviroment info:
Node version: 10.19.0
NPM version: 6.13.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.