MPlayer icon indicating copy to clipboard operation
MPlayer copied to clipboard

Mplayer should disable the Windows screensaver

Open ujos opened this issue 4 years ago • 0 comments

During the video playback the MPlayer should disable the screensaver.

Following is the code how to disable the screensaver:

if( !SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED)) {
  DWORD err = GetLastError();
  std::cerr << "[ERROR] Cannot disable the screensaver. Code=" << err 
    << ". " << std::system_category().message(err) << "\n";
}

The issue applies to the video playback only as in case if audio content is playing, Windows automatically locks the ES_SYSTEM_REQUIRED. Thus just for the clarity, in case if -novideo key is provided, application should not lock the display.

ujos avatar Jun 05 '21 19:06 ujos