Keep the display awake when streaming. Fixes #325

This commit is contained in:
Cameron Gutman 2017-10-04 19:19:56 -07:00
parent 3f244ff8e1
commit e0c4c01e44
2 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@
"pointerLock", "pointerLock",
"system.network", "system.network",
"fullscreen", "fullscreen",
"power",
"overrideEscFullscreen", { "overrideEscFullscreen", {
"socket": [ "socket": [
"tcp-connect", "tcp-connect",

View File

@ -37,6 +37,9 @@ function handleMessage(msg) {
$('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream. $('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream.
$('body').css('backgroundColor', '#282C38'); $('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.refreshServerInfo().then(function (ret) { // refresh the serverinfo to acknowledge the currently running app
api.getAppList().then(function (appList) { api.getAppList().then(function (appList) {
appList.forEach(function (app) { appList.forEach(function (app) {
@ -54,6 +57,9 @@ function handleMessage(msg) {
} else if(msg.data === 'Connection Established') { } else if(msg.data === 'Connection Established') {
$('#loadingSpinner').css('display', 'none'); $('#loadingSpinner').css('display', 'none');
$('body').css('backgroundColor', 'black'); $('body').css('backgroundColor', 'black');
// Keep the display awake while streaming
chrome.power.requestKeepAwake("display");
} else if(msg.data.indexOf('ProgressMsg: ') === 0) { } else if(msg.data.indexOf('ProgressMsg: ') === 0) {
$('#loadingMessage').text(msg.data.replace('ProgressMsg: ', '')); $('#loadingMessage').text(msg.data.replace('ProgressMsg: ', ''));
} else if(msg.data.indexOf('TransientMsg: ') === 0) { } else if(msg.data.indexOf('TransientMsg: ') === 0) {