-
Notifications
You must be signed in to change notification settings - Fork 5
Can't connect to pulseaudio from interactive shell #7
Description
I've now spend hour of hours and not able to solve an issue to connect to pulseaudio using "paclient" on an X64 unix machine (Linux cms 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux).
My node modul swich between two audio sinks using the 'paclient' modul. Everything is working fine as long as I work an start the sript from an interactive shell. Starting the node modul at boot time from "/etc/rc.local" out of a shell script which works interactive results in the following error:
Error: Unable to connect to PulseAudio server
at nextAddr (/home/cms/mrp/node_modules/@futpib/paclient/lib/client.js:1363:26)
at Socket.sock.on (/home/cms/mrp/node_modules/@futpib/paclient/lib/client.js:1406:7)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:561:12)
Comparing the connect credentials used by "PAclient.connect" there is no difference. In both cases the following information is passed to that method.
paclient nextAddr: PAClient {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
_socket: null,
_reqid: 0,
_reqs: null,
_index: -1,
_serverVer: -1 } [ [ 'unix', '/var/run/pulse/native' ],
[ 'ip', 4, '127.0.0.1', 4713 ],
[ 'ip', 6, '::1', 4713 ] ] <Buffer 9f 12 fd f3 4e bc 81 87 b7 94 73 56 fd 3f 10 c1 70 20 41 43 c7 0c 92 62 18 1d f0 85 b0 fb 10 43 9b 07 7e 19 9e ac a3 b3 44 d9 90 ab 56 4c 26 ea 51 17 ... > { application: { name: 'paclient.js' } }
My shell script execute "pulseaudio --start" and afterwards the node modul as part of a multmedia player to switch between 2 audio sinks. As mentioned, the same script works fine if it run form an interactive shell but fails if I start it in the background out of "/etc/rc.local" with the command
sudo -u cms /bin/bash -c "/home/cms/mrp_load.sh"
Any idea what I need to consider?