You are not logged in.

#1 2015-10-24 03:56:59

emacsomancer
Member
Registered: 2014-09-20
Posts: 211

Any way to prevent suspend if audio is playing?

I'm trying to figure out a good setup for my media centre computer, used mainly for playing videos via Kodi/XBMC or via Youtube or other online video services. I would like the computer to suspend (or hibernate), but *not* when someone's watching a video (and YouTube videos are not always played full screen). The ideal solution to me seems to be not to suspend if there is audio output.  Is there a good way of setting this up? (Possibly using systemd)

Offline

#2 2015-10-24 10:56:05

fdservices
Member
From: France
Registered: 2012-02-06
Posts: 413

Re: Any way to prevent suspend if audio is playing?

Have a look here

Andrew

Offline

#3 2015-10-24 17:18:52

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Any way to prevent suspend if audio is playing?

In Kodi: Settings > System > Power saving > Shutdown function

It will only shut down if nothing is playing and no key/button is pressed for the duration of the timer. Kodi has a YouTube add-on as well that should obey Kodi's settings.

Personally, I don't see the point of this except as a "sleep" timer. If you have the time and presence of mind to stop playback before leaving the room/apartment/house, you can spare the three extra seconds to manually suspend the system. The resources consumed between when you leave and when the system finally suspends are just wasted.

Offline

#4 2015-10-26 05:22:30

emacsomancer
Member
Registered: 2014-09-20
Posts: 211

Re: Any way to prevent suspend if audio is playing?

The thing is I don't want only to do this Kodi, or even just with YouTube - users will be playing videos from other sites too.

ANOKNUSA wrote:

In Kodi: Settings > System > Power saving > Shutdown function
....Personally, I don't see the point of this except as a "sleep" timer. If you have the time and presence of mind to stop playback before leaving the room/apartment/house, you can spare the three extra seconds to manually suspend the system. The resources consumed between when you leave and when the system finally suspends are just wasted.

There are multiple users using it, who are distracted/called away suddenly so if makes sense to automate it.

Here: http://unix.stackexchange.com/questions … -in-silent I found a good lead - to check PulseAudio:

pacmd list-sink-inputs | grep -c 'state: RUNNING'

Presumably I can figure out a way to have a sleep/suspend timer that only starts if PulseAudio isn't receiving input.

Offline

Board footer

Powered by FluxBB