Skip to content

VLCKit-based app preventing macOS screensaver

I've recently built a simple Swift macOS app based upon VLCKit; its purpose is mainly to play IP camera streams via RTSP in a window that stays always visible on screen (i.e. to monitor a gate).

Given the purpose of the app, I keep the streaming playing all the time, except when the user minimizes it in the Dock (meaning that I only call mediaPlayer?.stop in viewDidDisappear).

The app works very well, but I've recently discovered that, unless it is minimized (and, as a consequence, the playback is already stopped), something prevents the screensaver from running.

I've tried subscribing to all NSNotificationCenter com.apple.screensaver.* notifications, and I've realized that when the playback is running, none of them is fired; if I minimize the app and stop the playback, everything behaves normally (screensaver starts after the regular delay, all the com.apple.screensaver notifications are properly detected).

I've also tried running pmset -g to check if my app was listed as preventing sleep, but it's not.

My impression, but I might be wrong, is that my instance of VLCMediaPlayer by default prevents the screensaver launch.

I know that in the VLC Mac app the screensaver can be manually prevented via an advanced setting, but I can't seem to be able to find a parameter to set in my code to tell VLCKit to stop blocking the screensaver.

By default, does VLCKit prevent the screensaver from running? Is there a way to alter that behavior?

Please let me know if you need any further detail... and thanks in advance!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information