Add basic logic for resuming an existing stream

This commit is contained in:
Cameron Gutman 2016-03-10 22:29:00 -08:00
parent 8ce558f701
commit 02341e85e2
2 changed files with 12 additions and 5 deletions

View File

@ -107,8 +107,15 @@ function startPushed() {
console.log('startRequest:' + target + ":" + streamWidth + ":" + streamHeight + ":" + frameRate + ":" + bitrate);
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString()]);
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) {
sendMessage('startRequest', [target, streamWidth, streamHeight, frameRate, bitrate.toString()]);
});
}
});
});
// we just finished the gameSelection section. only expose the NaCl section

View File

@ -39,8 +39,8 @@ NvHTTP.prototype = {
$root = $xml.find('root')
if($root.attr("status_code") == 200) {
_self.pair = getXMLString(xml, "PairStatus").trim() == 1;
_self.currentGame = getXMLString(xml, "currentgame").trim();
_self.paired = $root.find("PairStatus").text().trim() == 1;
_self.currentGame = parseInt($root.find("currentgame").text().trim(), 10);
}
});
},
@ -93,7 +93,7 @@ NvHTTP.prototype = {
});
},
launchApp: function (context, appId, mode, sops, rikey, rikeyid, localAudio, surroundAudioInfo) {
launchApp: function (appId, mode, sops, rikey, rikeyid, localAudio, surroundAudioInfo) {
return sendMessage('openUrl', [
_self.baseUrlHttps +
'/launch?' + _self._buildUidStr() +
@ -109,7 +109,7 @@ NvHTTP.prototype = {
});
},
resumeApp: function (context, rikey, rikeyid) {
resumeApp: function (rikey, rikeyid) {
return sendMessage('openUrl', [
_self._baseUrlHttps +
'/resume?' + _self._buildUidStr() +