O-Hahn / node-red-contrib-speakerpi

Speaker Node for Raspi
2 stars 4 forks source link

Return a node status when done playing the audio - solution provided #8

Closed juggledad closed 5 years ago

juggledad commented 6 years ago

It would be nice to return a node.status when finished playing so users could use the status node to continue processing after waiting for the audio to complete.

This could be done simply by adding: node.status({text:"done"}); after the three lines calling speakOutputFile(...) lines 172, 181 and 191

This would allow a user to have a status node (pointing at this node) send the output msg to a switch node and check if msg.status.text == 'done' and then continue processing knowing the audio was done.

juggledad commented 6 years ago

Well I forked the code and put in the changes but it looks like this doesn't work. The node.status is fired before the sound finish's playing...sigh...

It would be nice if there was a way to find our when the sound finished playing

O-Hahn commented 6 years ago

Yes you are right - I use a fork system call to run aplayer from the system. So the code has to reworked to wait for the process feedback - when ended. Also it was not designed to interrupt the player with a new payload .. Therefore a rework of the whole model is needed. A possiblility is using a sound-library from nodejs - but i had troubles with it (quality) ..

O-Hahn commented 5 years ago

I have now implemented a version where the msg.payload is send when the play of the sound ends.