pubo-node 1.0.15 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pubo-node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["pubo-node"]=n():t["pubo-node"]=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=3)}([function(t,n){t.exports=require("pubo-utils")},function(t,n){t.exports=require("child_process")},function(t,n){t.exports=require("crypto")},function(t,n,e){"use strict";e.r(n),e.d(n,"initRtspVideos",(function(){return g})),e.d(n,"md5",(function(){return p})),e.d(n,"FtpClient",(function(){return l}));var r=e(0),o=function(){return(o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},i=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}s((r=r.apply(t,n||[])).next())}))},u=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},c=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e},s=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},a=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(s(arguments[n]));return t},l=function(){function t(t){var n=t.driver,e=c(t,["driver"]);this.queue=new r.SyncQueue,this.get=this._bind("get"),this.put=this._bind("put"),this.delete=this._bind("delete"),this.list=this._bind("list"),this.rename=this._bind("rename"),this.driver=n,this.options=e}return t.prototype._push=function(t){var n=this;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.queue.push((function(){return t.call.apply(t,a([n],e))}))}},t.prototype._bind=function(t){var n=this;return this._push((function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return i(n,void 0,void 0,(function(){var n;return u(this,(function(r){switch(r.label){case 0:return[4,this.connect()];case 1:return n=r.sent(),[2,this._run(t,n,e)]}}))}))}))},t.prototype._run=function(t,n,e){return new Promise((function(r,o){n[t].apply(n,a(e,[function(e,i){e?(o(e),n.end()):(r(i||"operation successful."),"get"===t?i.once("close",(function(){return n.end()})):n.end())}]))}))},t.prototype.connect=function(){var t=this;return new Promise((function(n,e){var r=new t.driver;r.once("ready",(function(){n(r)})),r.once("error",(function(t){e(t),r.end()})),r.connect(o({},t.options))}))},t}(),f=e(2),p=function(t){return Object(f.createHash)("md5").update(t).digest("hex")},h=e(1),d=function(){return(d=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},y=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},v=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(y(arguments[n]));return t},b=function(){function t(t,n){var e=this;this.eventEmitter=new r.Emitter,this.dog=new r.WatchDog({limit:10,onTimeout:function(){return e.connect()}}),this.url=t,this.options=d({},n),this.options.input||(this.options.input=["-rtsp_transport","tcp","-i"]),this.options.output||(this.options.output=["-f","mpegts","-codec:v","mpeg1video"]),this.connect(),this.dog.init()}return t.prototype.onMessage=function(t){this.dog.feed(),this.eventEmitter.emit("message",t.toString())},t.prototype.closeOld=function(){this.s&&(console.log("LOG Video-Server: "+this.url+" try to reconnect;"),this.s.kill(),this.s=null)},t.prototype.connect=function(){var t=this;this.closeOld();var n=v(this.options.input,[this.url],this.options.output,["-"]);this.s=Object(h.spawn)("ffmpeg",n,{detached:!1}),this.s.stderr.on("data",(function(n){return t.onMessage(n)})),this.s.stdout.on("data",(function(n){return t.eventEmitter.emit("data",n)}))},t.prototype.on=function(t,n){return this.eventEmitter.on(t,n)},t.prototype.cancel=function(t){this.eventEmitter.cancel(t)},t}(),m=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e},g=function(t){var n=t.app,e=t.server,r=t.videos,o=t.path,i=t.expressWs,u=r.map((function(t){var n=t.url,e=m(t,["url"]);return new b(n,e)}));return i(n,e),n.ws(o,(function(t,n){var e=n.query.channel,r=void 0===e?0:e,o=null;u[r]&&(o=u[r].on("data",(function(n){t.send(n)}))),t.on("close",(function(){o&&u[r].cancel(o)}))})),u}}])}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["pubo-node"]=n():t["pubo-node"]=n()}(this,(function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=3)}([function(t,n){t.exports=require("pubo-utils")},function(t,n){t.exports=require("child_process")},function(t,n){t.exports=require("crypto")},function(t,n,e){"use strict";e.r(n),e.d(n,"initRtspVideos",(function(){return g})),e.d(n,"md5",(function(){return p})),e.d(n,"FtpClient",(function(){return l}));var r=e(0),o=function(){return(o=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},i=function(t,n,e,r){return new(e||(e=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(u,c)}s((r=r.apply(t,n||[])).next())}))},u=function(t,n){var e,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;u;)try{if(e=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=n.call(t,u)}catch(t){i=[6,t],r=0}finally{e=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},c=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e},s=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},a=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(s(arguments[n]));return t},l=function(){function t(t){var n=t.driver,e=c(t,["driver"]);this.queue=new r.SyncQueue,this.get=this._bind("get"),this.put=this._bind("put"),this.delete=this._bind("delete"),this.list=this._bind("list"),this.rename=this._bind("rename"),this.driver=n,this.options=e}return t.prototype._push=function(t){var n=this;return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return n.queue.push((function(){return t.call.apply(t,a([n],e))}))}},t.prototype._bind=function(t){var n=this;return this._push((function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return i(n,void 0,void 0,(function(){var n;return u(this,(function(r){switch(r.label){case 0:return[4,this.connect()];case 1:return n=r.sent(),[2,this._run(t,n,e)]}}))}))}))},t.prototype._run=function(t,n,e){return new Promise((function(r,o){n[t].apply(n,a(e,[function(e,i){e?(o(e),n.end()):(r(i||"operation successful."),"get"===t?i.once("close",(function(){return n.end()})):n.end())}]))}))},t.prototype.connect=function(){var t=this;return new Promise((function(n,e){var r=new t.driver;r.once("ready",(function(){n(r)})),r.once("error",(function(t){e(t),r.end()})),r.connect(o({},t.options))}))},t}(),f=e(2),p=function(t){return Object(f.createHash)("md5").update(t).digest("hex")},h=e(1),d=function(){return(d=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var o in n=arguments[e])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},y=function(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,o,i=e.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},v=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(y(arguments[n]));return t},b=function(){function t(t,n){var e=this;this.eventEmitter=new r.Emitter,this.dog=new r.WatchDog({limit:10,onTimeout:function(){return e.connect()}}),this.url=t,this.options=d({},n),this.options.input||(this.options.input=["-rtsp_transport","tcp","-i"]),this.options.output||(this.options.output=["-f","mpegts","-codec:v","mpeg1video"]),this.connect(),this.dog.init()}return t.prototype.onMessage=function(t){this.dog.feed(),this.eventEmitter.emit("message",t.toString())},t.prototype.closeOld=function(){this.s&&(console.log("LOG Video-Server: "+this.url+" try to reconnect;"),this.s.kill(),this.s=null)},t.prototype.connect=function(){var t=this;this.closeOld();var n=v(this.options.input,[this.url],this.options.output,["-"]);this.s=Object(h.spawn)("ffmpeg",n,{detached:!1}),this.s.stderr.on("data",(function(n){return t.onMessage(n)})),this.s.stdout.on("data",(function(n){return t.eventEmitter.emit("data",n)}))},t.prototype.on=function(t,n){return this.eventEmitter.on(t,n)},t.prototype.cancel=function(t){this.eventEmitter.cancel(t)},t}(),m=function(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e},g=function(t){var n=t.app,e=t.server,r=t.videos,o=t.path,i=t.expressWs,u=r.map((function(t){var n=t.url,e=m(t,["url"]);return new b(n,e)}));return n.ws||i(n,e),n.ws(o,(function(t,n){var e=n.query.channel,r=void 0===e?0:e,o=null;u[r]&&(o=u[r].on("data",(function(n){t.send(n)}))),t.on("close",(function(){o&&u[r].cancel(o)}))})),u}}])}));
|
package/es/rtsp-video/index.d.ts
CHANGED
package/es/rtsp-video/index.js
CHANGED
|
@@ -24,7 +24,11 @@ export var initRtspVideos = function initRtspVideos(_a) {
|
|
|
24
24
|
|
|
25
25
|
return new RTSP2Mpeg(url, options);
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
if (!app.ws) {
|
|
29
|
+
expressWs(app, server);
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
app.ws(path, function (ws, req) {
|
|
29
33
|
var _a = req.query.channel,
|
|
30
34
|
channel = _a === void 0 ? 0 : _a;
|
package/lib/rtsp-video/index.js
CHANGED
|
@@ -32,7 +32,11 @@ exports.initRtspVideos = function (_a) {
|
|
|
32
32
|
|
|
33
33
|
return new rtsp2mpeg_1.RTSP2Mpeg(url, options);
|
|
34
34
|
});
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
if (!app.ws) {
|
|
37
|
+
expressWs(app, server);
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
app.ws(path, function (ws, req) {
|
|
37
41
|
var _a = req.query.channel,
|
|
38
42
|
channel = _a === void 0 ? 0 : _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubo-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@types/node": "^17.0.25",
|
|
23
|
-
"pubo-utils": "^1.0.
|
|
23
|
+
"pubo-utils": "^1.0.18"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "617fa4bcda39baa434e5ed20eb68d33894fef9f4"
|
|
26
26
|
}
|