Hi there,
I would like to integrate a shairport-sync instance into my node-red flow.
The goal is being able to start / stop an airplay server listening to streams coming for iDevices and send that stream to the speaker output of a raspberry.
I (very naively) tried to import the shairport-sync module into a function node and piping the output stream to msg.speech and output it to a node-red-contrib-speakerpi-output node.
[
{
"id": "10ba55bf0ff143a6",
"type": "function",
"z": "c472a0f874cdcb87",
"name": "",
"func": "const airplay = new shairportSync();\nairplay.name = 'My Airplay Receiver';\nairplay.start();\nairplay.output.stream.pipe(msg.speech);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "shairportSync",
"module": "shairport-sync"
}
],
"x": 400,
"y": 140,
"wires": [
[
"3186abae45bab32d",
"cc194a98caec879a"
]
]
},
{
"id": "cc194a98caec879a",
"type": "speakerpi-output",
"z": "c472a0f874cdcb87",
"choose": "streambased",
"filename": "",
"channels": "2",
"bitdepth": "16",
"samplerate": "44100",
"name": "",
"x": 640,
"y": 140,
"wires": [
[]
]
}
]
As naive as it is, it doesn't work The function node claims that "TypeError: shairportSync is not a constructor"
.
Yet the module is installed as expected by node-red :
[info] Installing module: shairport-sync, version: latest
[info] Installed module: shairport-sync
Any idea ?
Thanks