jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

Feature request MediaRenderer/AVTransport/Control #801

Open jbittner1002 opened 3 years ago

jbittner1002 commented 3 years ago

Looking for a way to mimic an Apple app called Sonos Intercom. It allows you to broadcast your voice in realtime over sonos speakers. I did a little work and captures how it talks to the Sonos units. It uses api call MediaRenderer/AVTransport/Control When the app starts it send a post with the following envelope. <s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/' s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> <u:SetAVTransportURI xmlns:u='urn:schemas-upnp-org:service:AVTransport:1'>

http://192.168.1.129:8080/SonosIntercom.wav
            <InstanceID>
                0
                </InstanceID>
            <CurrentURIMetaData>
                </CurrentURIMetaData>
            </u:SetAVTransportURI>
        </s:Body>
    </s:Envelope>

This looks like it sets the sonos to load this wav file. Then the app send another api command when the end user hits the hold to talk button to play. Very simple the app creates the wav file in realtime and the sonos then streams it.

I cannot find any options in this code that would support this type of feature. I tried the clip options but it will not play the file while its open or recording. I get this error: FourCC contains invalid characters. I think this is because it a file and not being streamed via http but not sure I am very new to this.

Attached is copy of wireshark recording.

packet-dump.zip

Any help on this would be appreciated.

jasonthefirs commented 2 years ago

I would also love this!

jsiegenthaler commented 2 years ago

There are other ways:

  1. TTS where you type in text and the text is spoken over the Sonos speakers
  2. Record your voice and then AirPlay the voice file to the speakers

I use TTS a lot.

jasonthefirs commented 2 years ago

Yeah I need to look into tts. And I hadn’t thought about airplaying a file after recording it, I might play around with that too! Thanks.