summaryrefslogtreecommitdiff
path: root/www/js/DataModel.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/DataModel.js')
-rwxr-xr-xwww/js/DataModel.js66
1 files changed, 52 insertions, 14 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 1fda628c..61d78d86 100755
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -1531,34 +1531,72 @@ angular.module('zmApp.controllers')
return monitors;
},
- killLiveStream: function (ck,url) {
+ pauseLiveStream: function (ck,url) {
+ if (!url) url = loginData.url;
+
+ var myauthtoken = $rootScope.authSession.replace("&auth=", "");
+ var req = url+'/index.php';
+ req = req + "?view=request&request=stream";
+ req = req + "&connkey="+ck;
+ req = req + "&auth="+myauthtoken;
+ // req = req + "&command=17";
-
- // monitors[i].Monitor.mportControlURL = controlURL;
- if (!url) url = loginData.url;
- // var url = mon.Monitor.mportControlURL;
- // console.log (JSON.stringify(mon));
- // return;
+ debug ("DataModel: Pausing live stream ck:"+ck);
+ return $http.get(req+"&command=1")
+ .then (
+ function (s) {
+ debug ("pause success for ck:"+ck+" with:"+JSON.stringify(s));
+
+ },
+ function (e) {debug ("pause success for ck:"+ck+" with:"+JSON.stringify(e));}
+ );
-
+ },
+
+ resumeLiveStream: function (ck,url) {
+ if (!url) url = loginData.url;
+
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
var req = url+'/index.php';
req = req + "?view=request&request=stream";
req = req + "&connkey="+ck;
req = req + "&auth="+myauthtoken;
- req = req + "&command=1";
+ // req = req + "&command=17";
- debug ("DataModel: Killing live stream ck:"+ck+ " with:"+req);
- $http.get(req)
+ debug ("DataModel: Resuming live stream ck:"+ck);
+ return $http.get(req+"&command=2")
.then (
function (s) {
- debug ("success with:"+JSON.stringify(s));
+ debug ("play success for ck:"+ck+" with:"+JSON.stringify(s));
+
},
- function (e) {debug ("error with:"+JSON.stringify(e));}
+ function (e) {debug ("play success for ck:"+ck+" with:"+JSON.stringify(e));}
);
},
+ killLiveStream: function (ck,url,name) {
+
+ if (!url) url = loginData.url;
+
+ var myauthtoken = $rootScope.authSession.replace("&auth=", "");
+ var req = url+'/index.php';
+ req = req + "?view=request&request=stream";
+ req = req + "&connkey="+ck;
+ req = req + "&auth="+myauthtoken;
+ // req = req + "&command=17";
+ if (name==undefined) name="";
+ debug ("DataModel: killing "+name+" live stream ck:"+ck);
+ return $http.get(req+"&command=17")
+ .then (
+ function (s) {
+ debug ("kill success for ck:"+ck+" with:"+JSON.stringify(s));
+
+ },
+ function (e) {ebug ("kill success for ck:"+ck+" with:"+JSON.stringify(e));}
+ );
+ },
+
/*killStream: function (ck) {
debug ("Killing connKey: "+ck);
var myauthtoken = $rootScope.authSession.replace("&auth=", "");
@@ -1605,7 +1643,7 @@ angular.module('zmApp.controllers')
regenConnKeys: function () {
- debug ("Regenerating connkeys...");
+ debug ("DataModel: Regenerating connkeys...");
for (var i=0; i < monitors.length; i++){
monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString();
}