EliasKotlyar / Xiaomi-Dafang-Hacks

4.16k stars 1k forks source link

Full two way audio support #1850

Open dbuezas opened 1 year ago

dbuezas commented 1 year ago

Now that go2rtc supports 2 way audio, and given that the webrtc integration even supports adding a camera as a media player, it would be really interesting to implement the "back channel connection".

This would allow using the camera as a wifi speaker for text to speech notifications and whatnot.

I see this repository already has some software to play wav files, and also some basic onvif stuff, I wonder if there would be interest to do this. I would even give it a try myself, but I need first learn a lot about how the back channel stream works and how this camera plays audio. :)

dbuezas commented 1 year ago

Keeping the spirit of this project, I'm thinking of this hack:

  1. Make a fake file in the file system with mkfifo /tmp/audio_pipe
  2. Create some small application that listens for incoming audio.
  3. When a connection is open, decode it to wav with the right frequency, etc and stream it to /tmp/audio_pipe
  4. Call audioplay /tmp/audio_pipe
  5. When the connection is closed, kill it

Thoughts? Any recommendatioins?