Handling the events in the server
Now that we have animations and our web pages ready, let's handle the emitted events in our server:
When the user presses the Play button in the controls web page, it will emit an event, requesting the animation to start. When the server receives this event, it needs to notify the player to start. By its turn, the player, on changing the status to playing, will emit its current status, which must be captured by the server and used to play the LED strip animation.
When the user presses the Stop button in the controls web page, the server will receive it and will notify the player to stop playing the video. When the player status changes, the server will be notified to stop the LED strip animation.
When the Skip button is pressed in the controls web page, the server stops the LED animation immediately and notifies the player to skip to the next playlist video. On changing the player status, the server will be notified to start the LED animation again.
Edit your...