TooTallNate / node-ogg

Node.js native binding to libogg
MIT License
65 stars 36 forks source link

Using node ogg with icecast meta data #4

Closed virtualfunction closed 11 years ago

virtualfunction commented 11 years ago

You'll have to excuse me if I'm doing things wrong, I've only started using node a few days and my background on the OGG container format isn't extensive.

I've been trying to get this working with Icecast meta data using your icecast npm package.

https://gist.github.com/virtualfunction/5ca3edfbc38b99e581fb

I'm writing to a file here, but the same error occurs if output is a stream stack HTTP response.

However I seem to get an error:

./node_modules/icecast/lib/writer.js:136
  write(chunk);
  ^
TypeError: string is not a function
    at Writer._onRawData (./node_modules/icecast/lib/writer.js:136:3)
    at Writer._transform (./node_modules/icecast/lib/writer.js:118:10)
    at Writer.Transform._read (_stream_transform.js:181:10)
    at Writer.Transform._write (_stream_transform.js:169:12)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)
    at Writer.Writable.write (_stream_writable.js:172:11)
    at write (_stream_readable.js:547:24)
    at flow (_stream_readable.js:556:7)
    at Encoder.pipeOnReadable (_stream_readable.js:588:5)

Now if I omit the use of node icecast, and do ogg_encoder.pipe(output) the output works, but obviously it has no Icecast meta data embedded.

virtualfunction commented 11 years ago

FYI, I'm using Node 0.10.2, though I don't think this matters.

virtualfunction commented 11 years ago

It seems to be (I think) because your code is passing/expecting a callback for the write action as the second parameter in your node icecast package, where as the Node and stream docs at https://github.com/isaacs/readable-stream#transform_transformchunk-encoding-callback suggest that this should be an encoding (and I assume the write method on the transform object/stream should be called instead)

TooTallNate commented 11 years ago

Fixed, ya?