Jump to content
c4forums | The Control4 Community

How to program based on Digital Media play/stop state?


Sugar

Recommended Posts

I've been trying to program a keypad LED so that it turns on when Digital Media is playing, and turns off, when Digital Media stops. I tried PLAYING_AUDIO_DEVICE, but no luck.

 

Also, what is the difference between "room off" and "in session"?

Link to comment
Share on other sites


I do this in the "audio selection changed" event for the room in question. My code under this event is essentially, use the on colour for the LED, followed by, if the room's power is off, use the off colour for the LED.

I also turn the LED off (use the off colour) when the room goes off (power off event for the room), although I suspect that is overkill.

Both events can be found when selecting the room itself in programming.

Link to comment
Share on other sites

"AUDIO SELECTION CHANGED" is not triggered when I just stop/pause or play audio (TuneIn).

I'm not changing an audio device, I just want to display the state of a currently-playing or paused device.

Is there anything else I'm missing.

Link to comment
Share on other sites

You can try using the rooms 'stop', play' and 'pause' commands to trigger LED behaviour. However, as these are not always unique functions (e.g. Play and pause often both toggle between play and pause modes) you may want to include some conditionals...

There may be a better way of doing this but this is the method I've always used.

Link to comment
Share on other sites

I'm just using TuneIn from the main controller (HC800).

IMO it's better to program based on the actual "state" changes rather than "buttons" being pressed.

You can control your media in so many ways (by pressing a button on a remote, pressing a button on a touchscreen, or by programming), but the resulting state change is allays the same, so using it as a trigger is much more reliable.

Link to comment
Share on other sites

if this is feeding a matrix you might be able to use the audio sensing feature. but with out additional hardware I can not find any related variables. Honestly i would probably program the LED to change colors on room on/off and then if the ROOM pause key is hit or the ROOM play button is hit. If you program all of your interfaces and use the ROOM pause/play commands you should be able to get a fairly accurate read.

Link to comment
Share on other sites

I have it working without having ever noticed a problem.

My coding (on play, pause, stop, up button and down button) looks at which device is playing and got some (those where play and pause does the same - e.g. Apple TV) it essentially toggles the LED; for sources with a unique play button (etc.) I set the LED to 'on' not an effective toggle on play etc.

If things go wrong, it will all sort itself out on room-off. While I have fairly messy code for all of this, I have never seen it fail!

Good luck

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...