Help Wizard

Step 1

NEXT STEP

Spotify prevents Mac from going to sleep

Solved!

Spotify prevents Mac from going to sleep

Hi,

 

running the Spotify client prevents my Mac from going to sleep, even when no song is being played.

By typing "pmset -g assertions" into the terminal window, you'll get a list of diagnostic information regarding power save mode. As long as Spotify is running, it contains the the line

  PreventUserIdleSystemSleep named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep" 

 

This would be the expected behavior when a song is being played but seems to be a bug otherwise.

 

A fix would be nice!

 

Thanks,

 

Norb

Reply
69 Replies

I agree that it shouldn't but it just might... Could be due to the P2P part of Spotify. They want everyone's computer to stay awake so that they save on bandwidth.

 

If you'll work a bit on the problem maybe you could contact the developers of Boom. They're a much smaller company that seems to be on their toes that seems to have the same problem though: http://globaldelight.com/globaldelightforum/discussion/130/boom-1-3-preventing-mac-sleep/p1 

The getsatisfaction link earlier had a comment suggesting creating an AppleScript to quit Spotify after some time of not playing. I have modified that script, and you can find it below.

 

  • Open AppleScript.
  • Copy in the script below to a new script file.
  • Compile it and Export it as an Application (Be sure to select "Stay open after run").
  • Launch the application you just created, and you're good to go. You can even set it up to launch on login (It's an option in the dock menu).
  • You can adjust the "1800" seconds (30 minutes of Spotify being paused) and "600" seconds (10 minutes to start playing Spotify before it quits) values to meet your needs.


on idle 
tell application "System Events" 
if not (exists (some process whose name is "Spotify")) then 
return -- Spotify not running 
end if 
end tell 

tell application "Spotify" 
if player state is playing then 
delay 1800 -- 30 mins 
else 
delay 600 -- 10 min buffer to start playing 
if player state is not playing then 
quit 
end if 
end if 
end tell 
end idle

This is still an issue.  I just bought a mac mini, since I use it for my TV I'm concerned about scren burn-in.

 

Spotify is absolutely the issue.  Before launching spotify I see: 

 

$ pmset -g assertions
12/21/12 8:59:19 PM PST  
Assertion status system-wide:
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             1
   PreventUserIdleSystemSleep     1
   ExternalMedia                  0
   UserIsActive                   0
   ApplePushServiceTask           0
   BackgroundTask                 0

 

Watching the assertions log, when I launch spotify and click play I see:

 

12/21/12 8:59:36 PM PST  
Assertion status system-wide:
   PreventUserIdleDisplaySleep    1
   CPUBoundAssertion              0
   PreventSystemSleep             1
   PreventUserIdleSystemSleep     1
   ExternalMedia                  0
   UserIsActive                   0
   ApplePushServiceTask           0
   BackgroundTask                 0

Listed by owning process:
  pid 129(coreaudiod): [0x0000000100000189] 00:00:00 NoIdleSleepAssertion named: "com.apple.audio.'AppleHDAEngineOutputDP:1B,3,1,2:0:{D94D-2702-01010101}'.noidlesleep" 
  pid 129(coreaudiod): [0x000000050000018a] 00:00:00 NoDisplaySleepAssertion named: "com.apple.audio.'AppleHDAEngineOutputDP:1B,3,1,2:0:{D94D-2702-01010101}'.nodisplaysleep" 

 

If anyone knows how to block this assertion when using Spotify, would be most helpful.

 

HOW CAN THIS STILL BE AN ISSUE?

Marked as solution

Yeah, it's a bummer.  I now use hotcorners and have the ScreenSaver app in my dock just so I can activate it manually.  But then there are times I fall asleep on my couch and wake up to my TV on and spotify open and think "Yep, can't wait until that's burned-in forever"

You can always create the AppleScript above and leave it running to auto-quit Spotify after some time of not playing.

The problem is while it is playing, the screensaver will never activate.  

That's not a problem for me. I'm not even sure if I have a screensaver. I just set my Mac up to turn off the display. Which works fine while Spotify is playing.

 

PreventUserIdleDisplaySleep 1

 

Prevents both screen saver and display sleep, if it works for you then great, but there's an issue with the product that effects the rest of us in this thread.  "Works for me" is never a solution.

 

 

I wonder if it's related to having an external display connected. Maybe you're having the issue on your MacBook screen? Nonetheless, I see it is an issue and should be fixed. With the time that this thread has been going, I don't see anything being done by the Spotify team; I was hoping to give you a possible workaround.

 

This makes me so angry.

 

Spotify just does not WANT to fix it, because when the application is running and preventing your Mac from sleeping, it can still use your bandwidth and save theirs. As far as i know, Spotify uses peer-to-peer techniques and uploads the music from your computer to other Spotify users – please correct me if I'm wrong.

 

How many hours of battery drain and wasted electricity has Spotify caused? With millions of users this number must be huge! It's time for an official statement about this. I am 99% sure that the developers know about this bug, but they are told not to fix it.

 

Again, this makes me angry and if there isn't any sign of improvement (or acknowledgement) in the next weeks, I will quit my plan and use RDIO or Simfy or whatever … Pretty sad.

Honestly, I would be OK with spotify creating NoIdleSleepAssertion and use all the bandwidth it wants.

 

I just don't know why it must assert NoDisplaySleepAssertion as well.

 

What I've seen, if the screen is built-in (like a laptop or imac) Spotify will only create the NoIdleSleepAssertion (which is all good).  Yet when the monitor is not built-in (like a mac mini or if an external is connected) it will annoyingly create both assertions.

 

Seems like a bug they shoudl fix.

Honestly I could Not care less about the bandwidth, but everytime I leave Spotify on by accident overnight, the battery of my MacBook has drained. That has cost me a lot of valuable battery cycles. Also electricity is not free around here ...

Hi dougg, please do not say it is 'all good' that Spotify prevents idle sleep when NOT playing music. You are not helpful.

FYI I made a complaint because I reported this as a bug and they never got back to me. They said that they face passed it on to their developers (again?)

Hey guys 🙂 

 

Sorry I'm not a Mac user, so excuse anything stupid I say but this sorta thing interests me.

 

From reading your comments here, it would appear that Spotify prevents Macs from going into a low power state. Does this only occur when you leave your Mac running, or always? What I am trying to ask is (if it is possible) if you force your Mac into that state by say pressing "Sleep" similar to Windows, will it then sleep or does Spotify stop that as well?

 

Peter

Peter
Spotify Community Mentor and Troubleshooter

Spotify Last.FM Twitter LinkedIn Meet Peter Rock Star Jam 2014


If this post was helpful, please add kudos below!

it only prevents idle sleep. you can still put it to sleep or shutdown manually. 

 

the fact spotify overrides idle sleep settings is a good feature of most music players _when music is playing_. what spotify fails to do is remove its block against idle sleep when music has stopped.

That would make sense. 

 

My guess is that this is probably intentional (but remember I don't work for Spotify). It is not really fair to compare Spotify to other media players, since it is part of a streaming service.

 

As you probably know, Spotify on the desktop runs on top of a very cleverly designed p2p system, which is how you can have such epic playback with almost no buffering (gapless). You can see the logic in Spotify not wanting your computer to sleep when their program is running, primarily because it is part of that p2p network which provides the service. 

 

I do admit though, it would be handy if there was a way to opt out of it blocking sleep. Does anyone know does this occur on Windows too? 

 

Peter

 

 

Peter
Spotify Community Mentor and Troubleshooter

Spotify Last.FM Twitter LinkedIn Meet Peter Rock Star Jam 2014


If this post was helpful, please add kudos below!

Suggested posts