mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Add support for starting a new stream of Steam Big Picture
This commit is contained in:
parent
b796b496dd
commit
147b4cf9f3
@ -107,11 +107,25 @@ function startPushed() {
|
|||||||
|
|
||||||
console.log('startRequest:' + target + ":" + streamWidth + ":" + streamHeight + ":" + frameRate + ":" + bitrate);
|
console.log('startRequest:' + target + ":" + streamWidth + ":" + streamHeight + ":" + frameRate + ":" + bitrate);
|
||||||
|
|
||||||
|
var rikey = '00000000000000000000000000000000';
|
||||||
|
var rikeyid = 0;
|
||||||
|
|
||||||
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
||||||
api = new NvHTTP(target, myUniqueid);
|
api = new NvHTTP(target, myUniqueid);
|
||||||
api.init().then(function (ret) {
|
api.init().then(function (ret) {
|
||||||
if (api.currentGame != 0) {
|
if (api.currentGame == 0) {
|
||||||
api.resumeApp('00000000000000000000000000000000', 0).then(function (ret) {
|
api.getAppByName("Steam").then(function (app) {
|
||||||
|
api.launchApp(app.id,
|
||||||
|
streamWidth + "x" + streamHeight + "x" + frameRate,
|
||||||
|
1, // Allow GFE to optimize game settings
|
||||||
|
rikey, rikeyid,
|
||||||
|
0, // Play audio locally too
|
||||||
|
0x030002 // Surround channel mask << 16 | Surround channel count
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
api.resumeApp(rikey, rikeyid).then(function (ret) {
|
||||||
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString(), api.serverMajorVersion.toString()]);
|
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString(), api.serverMajorVersion.toString()]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ NvHTTP.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getAppById: function (appId) {
|
getAppById: function (appId) {
|
||||||
return getAppList().then(function (list) {
|
return _self.getAppList().then(function (list) {
|
||||||
var retApp = null;
|
var retApp = null;
|
||||||
|
|
||||||
list.some(function (app) {
|
list.some(function (app) {
|
||||||
@ -63,19 +63,36 @@ NvHTTP.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAppByName: function (appName) {
|
||||||
|
return _self.getAppList().then(function (list) {
|
||||||
|
var retApp = null;
|
||||||
|
|
||||||
|
list.some(function (app) {
|
||||||
|
if (app.title == appName) {
|
||||||
|
retApp = app;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return retApp;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getAppList: function () {
|
getAppList: function () {
|
||||||
return sendMessage('openUrl', [_self._baseUrlHttps+'/applist?'+_self._buildUidStr()]).then(function (ret) {
|
return sendMessage('openUrl', [_self._baseUrlHttps+'/applist?'+_self._buildUidStr()]).then(function (ret) {
|
||||||
$xml = _self._parseXML(ret);
|
$xml = _self._parseXML(ret);
|
||||||
|
|
||||||
var rootElement = xml.getElementsByTagName("root")[0];
|
var rootElement = $xml.find("root")[0];
|
||||||
var appElements = rootElement.getElementsByTagName("App");
|
var appElements = rootElement.getElementsByTagName("App");
|
||||||
var appList;
|
var appList = [];
|
||||||
|
|
||||||
for(var i = 0, len = appElements.length; i < len; i++) {
|
for(var i = 0, len = appElements.length; i < len; i++) {
|
||||||
appList.push({
|
appList.push({
|
||||||
title: appElements[i].getElementsByTagName("AppTitle")[0].nodeValue.trim(),
|
title: appElements[i].getElementsByTagName("AppTitle")[0].innerHTML.trim(),
|
||||||
id: appElements[i].getElementsByTagName("ID")[0].nodeValue.trim(),
|
id: parseInt(appElements[i].getElementsByTagName("ID")[0].innerHTML.trim(), 10),
|
||||||
running: appElements[i].getElementsByTagName("IsRunning")[0].nodeValue.trim()
|
running: (appElements[i].getElementsByTagName("IsRunning")[0].innerHTML.trim() == 1)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +113,7 @@ NvHTTP.prototype = {
|
|||||||
|
|
||||||
launchApp: function (appId, mode, sops, rikey, rikeyid, localAudio, surroundAudioInfo) {
|
launchApp: function (appId, mode, sops, rikey, rikeyid, localAudio, surroundAudioInfo) {
|
||||||
return sendMessage('openUrl', [
|
return sendMessage('openUrl', [
|
||||||
_self.baseUrlHttps +
|
_self._baseUrlHttps +
|
||||||
'/launch?' + _self._buildUidStr() +
|
'/launch?' + _self._buildUidStr() +
|
||||||
'&appid=' + appId +
|
'&appid=' + appId +
|
||||||
'&mode=' + mode +
|
'&mode=' + mode +
|
||||||
@ -104,7 +121,7 @@ NvHTTP.prototype = {
|
|||||||
'&rikey=' + rikey +
|
'&rikey=' + rikey +
|
||||||
'&rikeyid=' + rikeyid +
|
'&rikeyid=' + rikeyid +
|
||||||
'&localAudioPlayMode=' + localAudio +
|
'&localAudioPlayMode=' + localAudio +
|
||||||
'&surroundAudioInfo=' + suroundAudioInfo
|
'&surroundAudioInfo=' + surroundAudioInfo
|
||||||
]).then(function (ret) {
|
]).then(function (ret) {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user