From e0c4c01e44de563691af2e3f8da4969579eeeaed Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 4 Oct 2017 19:19:56 -0700 Subject: [PATCH] Keep the display awake when streaming. Fixes #325 --- manifest.json | 1 + static/js/messages.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/manifest.json b/manifest.json index 33d4987..b81a2a9 100644 --- a/manifest.json +++ b/manifest.json @@ -26,6 +26,7 @@ "pointerLock", "system.network", "fullscreen", + "power", "overrideEscFullscreen", { "socket": [ "tcp-connect", diff --git a/static/js/messages.js b/static/js/messages.js index 9ea552e..4533466 100644 --- a/static/js/messages.js +++ b/static/js/messages.js @@ -37,6 +37,9 @@ function handleMessage(msg) { $('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream. $('body').css('backgroundColor', '#282C38'); + // Release our keep awake request + chrome.power.releaseKeepAwake(); + api.refreshServerInfo().then(function (ret) { // refresh the serverinfo to acknowledge the currently running app api.getAppList().then(function (appList) { appList.forEach(function (app) { @@ -54,6 +57,9 @@ function handleMessage(msg) { } else if(msg.data === 'Connection Established') { $('#loadingSpinner').css('display', 'none'); $('body').css('backgroundColor', 'black'); + + // Keep the display awake while streaming + chrome.power.requestKeepAwake("display"); } else if(msg.data.indexOf('ProgressMsg: ') === 0) { $('#loadingMessage').text(msg.data.replace('ProgressMsg: ', '')); } else if(msg.data.indexOf('TransientMsg: ') === 0) {