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);
|
||||
|
||||
var rikey = '00000000000000000000000000000000';
|
||||
var rikeyid = 0;
|
||||
|
||||
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
|
||||
api = new NvHTTP(target, myUniqueid);
|
||||
api.init().then(function (ret) {
|
||||
if (api.currentGame != 0) {
|
||||
api.resumeApp('00000000000000000000000000000000', 0).then(function (ret) {
|
||||
if (api.currentGame == 0) {
|
||||
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()]);
|
||||
});
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ NvHTTP.prototype = {
|
||||
},
|
||||
|
||||
getAppById: function (appId) {
|
||||
return getAppList().then(function (list) {
|
||||
return _self.getAppList().then(function (list) {
|
||||
var retApp = null;
|
||||
|
||||
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 () {
|
||||
return sendMessage('openUrl', [_self._baseUrlHttps+'/applist?'+_self._buildUidStr()]).then(function (ret) {
|
||||
$xml = _self._parseXML(ret);
|
||||
|
||||
var rootElement = xml.getElementsByTagName("root")[0];
|
||||
var rootElement = $xml.find("root")[0];
|
||||
var appElements = rootElement.getElementsByTagName("App");
|
||||
var appList;
|
||||
var appList = [];
|
||||
|
||||
for(var i = 0, len = appElements.length; i < len; i++) {
|
||||
appList.push({
|
||||
title: appElements[i].getElementsByTagName("AppTitle")[0].nodeValue.trim(),
|
||||
id: appElements[i].getElementsByTagName("ID")[0].nodeValue.trim(),
|
||||
running: appElements[i].getElementsByTagName("IsRunning")[0].nodeValue.trim()
|
||||
title: appElements[i].getElementsByTagName("AppTitle")[0].innerHTML.trim(),
|
||||
id: parseInt(appElements[i].getElementsByTagName("ID")[0].innerHTML.trim(), 10),
|
||||
running: (appElements[i].getElementsByTagName("IsRunning")[0].innerHTML.trim() == 1)
|
||||
});
|
||||
}
|
||||
|
||||
@ -96,7 +113,7 @@ NvHTTP.prototype = {
|
||||
|
||||
launchApp: function (appId, mode, sops, rikey, rikeyid, localAudio, surroundAudioInfo) {
|
||||
return sendMessage('openUrl', [
|
||||
_self.baseUrlHttps +
|
||||
_self._baseUrlHttps +
|
||||
'/launch?' + _self._buildUidStr() +
|
||||
'&appid=' + appId +
|
||||
'&mode=' + mode +
|
||||
@ -104,7 +121,7 @@ NvHTTP.prototype = {
|
||||
'&rikey=' + rikey +
|
||||
'&rikeyid=' + rikeyid +
|
||||
'&localAudioPlayMode=' + localAudio +
|
||||
'&surroundAudioInfo=' + suroundAudioInfo
|
||||
'&surroundAudioInfo=' + surroundAudioInfo
|
||||
]).then(function (ret) {
|
||||
return true;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user