mildsunrise / dcs-utils

Utilities for the DCS-2121 IP camera.
2 stars 2 forks source link

send and receive audio #2

Open jaha1930 opened 8 years ago

jaha1930 commented 8 years ago

How to read the mic audio and send it to the camera and play the audio stream using html5 audio

mildsunrise commented 8 years ago

For streaming the cam's audio to the browser, the easiest way would probably be to use this module to grab audio from the camera, then stream it to something like Icecast to distribute it. Then, from the browser just load the Icecast livestream in an <audio> as usual. You don't even need to write code, you should be able to just execute speaker.js as shown in the README, and pipe the output to Ezstream to send it to Icecast.

Reading audio from the (browser's mic, I'm assuming) using HTML5 is something I've never done, but I assume you can somehow stream the audio to a small Node.JS webserver that would first resample / transcode as required and then use this module to stream it to the camera.

I can't recall, but I remember the camera firmware is so fucked up that it doesn't properly synchronize the stream, you may run into trouble after a few mins of stream.