@techsee/techsee-media-service 999.0.2-switch → 999.0.3-alpha
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/lib/LocalStreamManager.d.ts +12 -0
- package/lib/LocalStreamManager.d.ts.map +1 -1
- package/lib/LocalStreamManager.js +440 -283
- package/lib/LocalStreamManager.js.map +1 -1
- package/lib/MediaConstants.d.ts +14 -4
- package/lib/MediaConstants.d.ts.map +1 -1
- package/lib/MediaConstants.js +83 -38
- package/lib/MediaConstants.js.map +1 -1
- package/lib/MediaContracts.d.ts +17 -14
- package/lib/MediaContracts.d.ts.map +1 -1
- package/lib/MediaContracts.js +3 -3
- package/lib/MediaContracts.js.map +1 -1
- package/lib/MediaPublisher.d.ts +3 -3
- package/lib/MediaPublisher.d.ts.map +1 -1
- package/lib/MediaPublisher.js +46 -35
- package/lib/MediaPublisher.js.map +1 -1
- package/lib/MediaServiceBase.d.ts +21 -7
- package/lib/MediaServiceBase.d.ts.map +1 -1
- package/lib/MediaServiceBase.js +924 -586
- package/lib/MediaServiceBase.js.map +1 -1
- package/lib/MediaSession/MediaServer.d.ts +45 -0
- package/lib/MediaSession/MediaServer.d.ts.map +1 -0
- package/lib/MediaSession/MediaServer.js +538 -0
- package/lib/MediaSession/MediaServer.js.map +1 -0
- package/lib/MediaSession/MediaSessionBase.d.ts +10 -1
- package/lib/MediaSession/MediaSessionBase.d.ts.map +1 -1
- package/lib/MediaSession/MediaSessionBase.js +128 -66
- package/lib/MediaSession/MediaSessionBase.js.map +1 -1
- package/lib/MediaSession/SessionOpentok.d.ts +11 -9
- package/lib/MediaSession/SessionOpentok.d.ts.map +1 -1
- package/lib/MediaSession/SessionOpentok.js +500 -352
- package/lib/MediaSession/SessionOpentok.js.map +1 -1
- package/lib/MediaSession/SessionTurn.d.ts +4 -1
- package/lib/MediaSession/SessionTurn.d.ts.map +1 -1
- package/lib/MediaSession/SessionTurn.js +611 -422
- package/lib/MediaSession/SessionTurn.js.map +1 -1
- package/lib/MediaSession/TurnConstants.js +31 -30
- package/lib/MediaSession/TurnConstants.js.map +1 -1
- package/lib/MediaSubscriber.d.ts +11 -11
- package/lib/MediaSubscriber.d.ts.map +1 -1
- package/lib/MediaSubscriber.js +236 -192
- package/lib/MediaSubscriber.js.map +1 -1
- package/lib/MediaUtils/Compatibility.d.ts +2 -1
- package/lib/MediaUtils/Compatibility.d.ts.map +1 -1
- package/lib/MediaUtils/Compatibility.js +130 -85
- package/lib/MediaUtils/Compatibility.js.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.d.ts +3 -2
- package/lib/MediaUtils/MediaDomUtils.d.ts.map +1 -1
- package/lib/MediaUtils/MediaDomUtils.js +235 -174
- package/lib/MediaUtils/MediaDomUtils.js.map +1 -1
- package/lib/MediaUtils/MediaTracer.js +9 -4
- package/lib/MediaUtils/MediaTracer.js.map +1 -1
- package/lib/MediaUtils/index.d.ts +1 -0
- package/lib/MediaUtils/index.d.ts.map +1 -0
- package/lib/MediaUtils/index.js +16 -0
- package/lib/MediaUtils/index.js.map +1 -0
- package/lib/MultiParty/Contracts.d.ts +16 -0
- package/lib/MultiParty/Contracts.d.ts.map +1 -0
- package/lib/MultiParty/Contracts.js +6 -0
- package/lib/MultiParty/Contracts.js.map +1 -0
- package/lib/MultiParty/DetectWebRtcService.d.ts +16 -0
- package/lib/MultiParty/DetectWebRtcService.d.ts.map +1 -0
- package/lib/MultiParty/DetectWebRtcService.js +79 -0
- package/lib/MultiParty/DetectWebRtcService.js.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesService.d.ts +23 -0
- package/lib/MultiParty/MediaCapabilitiesService.d.ts.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesService.js +369 -0
- package/lib/MultiParty/MediaCapabilitiesService.js.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts +5 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.d.ts.map +1 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.js +305 -0
- package/lib/MultiParty/MediaCapabilitiesUtils.js.map +1 -0
- package/lib/MultiParty/MultiPartyService.d.ts +41 -0
- package/lib/MultiParty/MultiPartyService.d.ts.map +1 -0
- package/lib/MultiParty/MultiPartyService.js +72 -0
- package/lib/MultiParty/MultiPartyService.js.map +1 -0
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts +3 -0
- package/lib/MultiParty/MultiPartyServiceFactory.d.ts.map +1 -0
- package/lib/MultiParty/MultiPartyServiceFactory.js +21 -0
- package/lib/MultiParty/MultiPartyServiceFactory.js.map +1 -0
- package/lib/MultiParty/OpentokMultiPartyService.d.ts +29 -0
- package/lib/MultiParty/OpentokMultiPartyService.d.ts.map +1 -0
- package/lib/MultiParty/OpentokMultiPartyService.js +888 -0
- package/lib/MultiParty/OpentokMultiPartyService.js.map +1 -0
- package/lib/MultiParty/VideoLayoutType.d.ts +4 -0
- package/lib/MultiParty/VideoLayoutType.d.ts.map +1 -0
- package/lib/MultiParty/VideoLayoutType.js +13 -0
- package/lib/MultiParty/VideoLayoutType.js.map +1 -0
- package/lib/MultiParty/index.d.ts +4 -0
- package/lib/MultiParty/index.d.ts.map +1 -0
- package/lib/MultiParty/index.js +61 -0
- package/lib/MultiParty/index.js.map +1 -0
- package/lib/MultiParty/opentok.d.ts +503 -0
- package/lib/TechseeMediaStream.d.ts +6 -6
- package/lib/TechseeMediaStream.d.ts.map +1 -1
- package/lib/TechseeMediaStream.js +59 -53
- package/lib/TechseeMediaStream.js.map +1 -1
- package/lib/oldCode/constants.js +20 -15
- package/lib/oldCode/constants.js.map +1 -1
- package/lib/oldCode/event-emitter.js +45 -22
- package/lib/oldCode/event-emitter.js.map +1 -1
- package/lib/oldCode/index.js +48 -52
- package/lib/oldCode/index.js.map +1 -1
- package/lib/oldCode/opentok/session.js +261 -236
- package/lib/oldCode/opentok/session.js.map +1 -1
- package/lib/oldCode/opentok/stream.js +283 -269
- package/lib/oldCode/opentok/stream.js.map +1 -1
- package/lib/oldCode/publisher.js +96 -71
- package/lib/oldCode/publisher.js.map +1 -1
- package/lib/oldCode/service.js +294 -272
- package/lib/oldCode/service.js.map +1 -1
- package/lib/oldCode/session.js +82 -60
- package/lib/oldCode/session.js.map +1 -1
- package/lib/oldCode/stream.js +153 -125
- package/lib/oldCode/stream.js.map +1 -1
- package/lib/oldCode/subscriber.js +60 -35
- package/lib/oldCode/subscriber.js.map +1 -1
- package/lib/oldCode/tracer.d.ts +3 -2
- package/lib/oldCode/tracer.d.ts.map +1 -1
- package/lib/oldCode/tracer.js +181 -130
- package/lib/oldCode/tracer.js.map +1 -1
- package/lib/oldCode/utils/ImageFixer.js +67 -44
- package/lib/oldCode/utils/ImageFixer.js.map +1 -1
- package/lib/oldCode/webrtc/constants.js +102 -110
- package/lib/oldCode/webrtc/constants.js.map +1 -1
- package/lib/oldCode/webrtc/helper.js +176 -124
- package/lib/oldCode/webrtc/helper.js.map +1 -1
- package/lib/oldCode/webrtc/session-kms.js +408 -393
- package/lib/oldCode/webrtc/session-kms.js.map +1 -1
- package/lib/oldCode/webrtc/session-loopback.js +245 -227
- package/lib/oldCode/webrtc/session-loopback.js.map +1 -1
- package/lib/oldCode/webrtc/session-turn.js +705 -658
- package/lib/oldCode/webrtc/session-turn.js.map +1 -1
- package/lib/oldCode/webrtc/session-turn.v2.js +480 -471
- package/lib/oldCode/webrtc/session-turn.v2.js.map +1 -1
- package/lib/oldCode/webrtc/session.js +12 -6
- package/lib/oldCode/webrtc/session.js.map +1 -1
- package/lib/oldCode/webrtc/stream.js +526 -504
- package/lib/oldCode/webrtc/stream.js.map +1 -1
- package/lib/oldCode/webrtc/temasys/adapter-loader.js +5 -6
- package/lib/oldCode/webrtc/temasys/adapter-loader.js.map +1 -1
- package/lib/oldCode/webrtc/temasys/adapter.js +5264 -5192
- package/lib/oldCode/webrtc/temasys/adapter.js.map +1 -1
- package/lib/oldCode/webrtc/webrtc-ie-shim.js +3357 -2927
- package/lib/oldCode/webrtc/webrtc-ie-shim.js.map +1 -1
- package/lib/qos/raw-qos.js +348 -273
- package/lib/qos/raw-qos.js.map +1 -1
- package/lib/webrtc-ie-shim.js +3386 -2985
- package/lib/webrtc-ie-shim.js.map +1 -1
- package/package.json +54 -42
package/lib/oldCode/stream.js
CHANGED
|
@@ -1,31 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exports.TsMediaStream = exports.EVENTS = undefined;
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TsMediaStream = exports.EVENTS = void 0;
|
|
7
9
|
|
|
8
|
-
var _eventEmitter = require(
|
|
10
|
+
var _eventEmitter = require("./event-emitter");
|
|
9
11
|
|
|
10
|
-
var _session = require(
|
|
12
|
+
var _session = require("./session");
|
|
11
13
|
|
|
12
|
-
var _subscriber = require(
|
|
14
|
+
var _subscriber = require("./subscriber");
|
|
13
15
|
|
|
14
|
-
var _tsEnvironmentDetect = require(
|
|
16
|
+
var _tsEnvironmentDetect = require("@techsee/techsee-common/lib/helpers/ts-environment-detect");
|
|
15
17
|
|
|
16
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
19
|
|
|
18
|
-
function
|
|
20
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
19
21
|
|
|
20
|
-
function
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
23
|
+
|
|
24
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
+
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
+
|
|
28
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
|
+
|
|
30
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
+
|
|
32
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
+
|
|
34
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
36
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
37
|
|
|
22
38
|
/**
|
|
23
39
|
* @enum STREAM_EVENTS
|
|
24
40
|
*/
|
|
25
41
|
var STREAM_EVENTS = {
|
|
26
|
-
|
|
42
|
+
PROPERTY_CHANGED: 'PROPERTY_CHANGED'
|
|
27
43
|
};
|
|
28
|
-
|
|
29
44
|
exports.EVENTS = STREAM_EVENTS;
|
|
30
45
|
|
|
31
46
|
/**
|
|
@@ -40,97 +55,116 @@ exports.EVENTS = STREAM_EVENTS;
|
|
|
40
55
|
* @see TsOpenTokStream
|
|
41
56
|
* @see TsWebRTCStream
|
|
42
57
|
*/
|
|
58
|
+
var TsMediaStream = /*#__PURE__*/function (_EventEmitter) {
|
|
59
|
+
_inherits(TsMediaStream, _EventEmitter);
|
|
43
60
|
|
|
44
|
-
var
|
|
45
|
-
_inherits(TsMediaStream, _EventEmitter);
|
|
46
|
-
|
|
47
|
-
function TsMediaStream(id, session) {
|
|
48
|
-
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
49
|
-
var videoTrackSettings = arguments[3];
|
|
61
|
+
var _super = _createSuper(TsMediaStream);
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
function TsMediaStream(id, session) {
|
|
64
|
+
var _this;
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
var isRemote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
67
|
+
var videoTrackSettings = arguments.length > 3 ? arguments[3] : undefined;
|
|
54
68
|
|
|
55
|
-
|
|
56
|
-
_this.remote = isRemote;
|
|
69
|
+
_classCallCheck(this, TsMediaStream);
|
|
57
70
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
71
|
+
_this = _super.call(this);
|
|
72
|
+
session.registerStream(id, _assertThisInitialized(_this));
|
|
73
|
+
_this.remote = isRemote;
|
|
62
74
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* @protected
|
|
67
|
-
* @member { Object }
|
|
68
|
-
*/
|
|
69
|
-
_this._environment = new _tsEnvironmentDetect.TsEnvironmentDetect();
|
|
70
|
-
return _this;
|
|
75
|
+
if (videoTrackSettings) {
|
|
76
|
+
_this._width = videoTrackSettings.width;
|
|
77
|
+
_this._height = videoTrackSettings.height;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
79
|
/**
|
|
74
|
-
*
|
|
80
|
+
* Environment detector
|
|
75
81
|
*
|
|
82
|
+
* @protected
|
|
76
83
|
* @member { Object }
|
|
77
|
-
* @type { Object }
|
|
78
84
|
*/
|
|
79
85
|
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
_this._environment = new _tsEnvironmentDetect.TsEnvironmentDetect();
|
|
88
|
+
return _this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Stream video dimensions
|
|
92
|
+
*
|
|
93
|
+
* @member { Object }
|
|
94
|
+
* @type { Object }
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
_createClass(TsMediaStream, [{
|
|
99
|
+
key: "videoDimensions",
|
|
100
|
+
get: function get() {
|
|
101
|
+
// FIXME the fallback dimensions should be removed, and the Opentok/Webrtc implementations
|
|
102
|
+
// should pass the dimensions just like loopback does. I suspect current behavior is
|
|
103
|
+
// the cause of the video element "jumping" (change size) on initial connection
|
|
104
|
+
return {
|
|
105
|
+
width: this._width || 480,
|
|
106
|
+
height: this._height || 640
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "_updateVideoDimensions",
|
|
111
|
+
value: function _updateVideoDimensions(videoEl) {
|
|
112
|
+
if (videoEl) {
|
|
99
113
|
this._width = videoEl.videoWidth;
|
|
100
114
|
this._height = videoEl.videoHeight;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
115
|
+
var stream = this;
|
|
116
|
+
var property = 'videoDimensions';
|
|
117
|
+
var value = this.videoDimensions;
|
|
118
|
+
|
|
119
|
+
this._session.emit(_session.EVENTS.STREAM_PROPERTY_CHANGED, {
|
|
120
|
+
stream: stream,
|
|
121
|
+
property: property,
|
|
122
|
+
value: value
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "setupDimensionsListener",
|
|
128
|
+
value: function setupDimensionsListener(videoEl, subscriber) {
|
|
129
|
+
var _this2 = this;
|
|
130
|
+
|
|
131
|
+
this._clearUpdateDimensionsInterval();
|
|
132
|
+
|
|
133
|
+
this._width = videoEl.videoWidth;
|
|
134
|
+
this._height = videoEl.videoHeight;
|
|
135
|
+
|
|
136
|
+
if (!subscriber && !this._environment.isIE11() && !this._environment.isIOS()) {
|
|
137
|
+
$(videoEl).on('resize', function () {
|
|
138
|
+
return _this2._updateVideoDimensions(videoEl);
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
this.intervalId = setInterval(function () {
|
|
142
|
+
if (subscriber && !(subscriber.stream && subscriber.stream.hasVideo)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (_this2._width !== videoEl.videoWidth || _this2._height !== videoEl.videoHeight) {
|
|
147
|
+
_this2._updateVideoDimensions(videoEl);
|
|
148
|
+
}
|
|
149
|
+
}, 500);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (subscriber && this.intervalId) {
|
|
153
|
+
subscriber.on(_subscriber.EVENTS.DESTROYED, function () {
|
|
154
|
+
_this2._clearUpdateDimensionsInterval();
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "_clearUpdateDimensionsInterval",
|
|
160
|
+
value: function _clearUpdateDimensionsInterval() {
|
|
161
|
+
if (this.intervalId) {
|
|
162
|
+
clearInterval(this.intervalId);
|
|
163
|
+
this.intervalId = null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
133
166
|
/* eslint-disable no-unused-vars */
|
|
167
|
+
|
|
134
168
|
/**
|
|
135
169
|
* Get snapshot of the current frame in the media stream
|
|
136
170
|
*
|
|
@@ -150,46 +184,40 @@ var TsMediaStream = exports.TsMediaStream = function (_EventEmitter) {
|
|
|
150
184
|
* @returns { Promise<String> } snapshot
|
|
151
185
|
*/
|
|
152
186
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
187
|
+
}, {
|
|
188
|
+
key: "getSnapshot",
|
|
189
|
+
value: function getSnapshot(tsMediaElement) {
|
|
190
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
191
|
+
|
|
192
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
193
|
+
_ref$format = _ref.format,
|
|
194
|
+
format = _ref$format === void 0 ? 'image/png' : _ref$format,
|
|
195
|
+
_ref$quality = _ref.quality,
|
|
196
|
+
quality = _ref$quality === void 0 ? 0.92 : _ref$quality,
|
|
197
|
+
x = _ref.x,
|
|
198
|
+
y = _ref.y,
|
|
199
|
+
w = _ref.w,
|
|
200
|
+
h = _ref.h;
|
|
201
|
+
|
|
202
|
+
throw new TypeError('The method \'getSnapshot\' is not implemented');
|
|
203
|
+
}
|
|
204
|
+
}, {
|
|
205
|
+
key: "turnFlashlight",
|
|
206
|
+
value: function turnFlashlight() {
|
|
207
|
+
var isTorchOn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
208
|
+
throw new TypeError('The method \'turnFlashlight\' is not implemented');
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: "setAutoLightOffTimer",
|
|
212
|
+
value: function setAutoLightOffTimer(flashlightTimeout) {
|
|
213
|
+
throw new TypeError('The method \'setAutoLightOffTimer\' is not implemented');
|
|
214
|
+
}
|
|
180
215
|
/* eslint-enable no-unused-vars */
|
|
181
216
|
|
|
217
|
+
}]);
|
|
182
218
|
|
|
183
|
-
|
|
184
|
-
key: 'videoDimensions',
|
|
185
|
-
get: function get() {
|
|
186
|
-
// FIXME the fallback dimensions should be removed, and the Opentok/Webrtc implementations
|
|
187
|
-
// should pass the dimensions just like loopback does. I suspect current behavior is
|
|
188
|
-
// the cause of the video element "jumping" (change size) on initial connection
|
|
189
|
-
return { width: this._width || 480, height: this._height || 640 };
|
|
190
|
-
}
|
|
191
|
-
}]);
|
|
192
|
-
|
|
193
|
-
return TsMediaStream;
|
|
219
|
+
return TsMediaStream;
|
|
194
220
|
}(_eventEmitter.EventEmitter);
|
|
221
|
+
|
|
222
|
+
exports.TsMediaStream = TsMediaStream;
|
|
195
223
|
//# sourceMappingURL=stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["oldCode/stream.js"],"names":["STREAM_EVENTS","PROPERTY_CHANGED","
|
|
1
|
+
{"version":3,"sources":["oldCode/stream.js"],"names":["STREAM_EVENTS","PROPERTY_CHANGED","TsMediaStream","id","session","isRemote","videoTrackSettings","registerStream","remote","_width","width","_height","height","_environment","TsEnvironmentDetect","videoEl","videoWidth","videoHeight","stream","property","value","videoDimensions","_session","emit","SESSION_EVENTS","STREAM_PROPERTY_CHANGED","subscriber","_clearUpdateDimensionsInterval","isIE11","isIOS","$","on","_updateVideoDimensions","intervalId","setInterval","hasVideo","SUBSCRIBER_EVENTS","DESTROYED","clearInterval","tsMediaElement","timeout","format","quality","x","y","w","h","TypeError","isTorchOn","flashlightTimeout","EventEmitter"],"mappings":"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","sourcesContent":["import {EventEmitter} from './event-emitter';\n\nimport {\n EVENTS as SESSION_EVENTS\n} from './session';\n\nimport {\n EVENTS as SUBSCRIBER_EVENTS\n} from './subscriber';\n\nimport {TsEnvironmentDetect} from '@techsee/techsee-common/lib/helpers/ts-environment-detect';\n\n/**\n * @enum STREAM_EVENTS\n */\nconst STREAM_EVENTS = {\n PROPERTY_CHANGED: 'PROPERTY_CHANGED'\n};\n\nexport {STREAM_EVENTS as EVENTS};\n\n/**\n * Media stream wrapper.\n *\n * Represents video or audio stream, local or remote.\n *\n * General interface for the specific implementations - TsOpenTokStream or TsWebRTCStream\n *\n * @interface\n *\n * @see TsOpenTokStream\n * @see TsWebRTCStream\n */\nexport class TsMediaStream extends EventEmitter {\n constructor(id, session, isRemote = true, videoTrackSettings) {\n super();\n\n session.registerStream(id, this);\n this.remote = isRemote;\n\n if (videoTrackSettings) {\n this._width = videoTrackSettings.width;\n this._height = videoTrackSettings.height;\n }\n\n /**\n * Environment detector\n *\n * @protected\n * @member { Object }\n */\n this._environment = new TsEnvironmentDetect();\n }\n\n /**\n * Stream video dimensions\n *\n * @member { Object }\n * @type { Object }\n */\n get videoDimensions() {\n // FIXME the fallback dimensions should be removed, and the Opentok/Webrtc implementations\n // should pass the dimensions just like loopback does. I suspect current behavior is\n // the cause of the video element \"jumping\" (change size) on initial connection\n return {width: this._width || 480, height: this._height || 640};\n }\n\n _updateVideoDimensions(videoEl) {\n if (videoEl) {\n this._width = videoEl.videoWidth;\n this._height = videoEl.videoHeight;\n\n const stream = this;\n const property = 'videoDimensions';\n const value = this.videoDimensions;\n\n this._session.emit(SESSION_EVENTS.STREAM_PROPERTY_CHANGED, {stream, property, value});\n }\n }\n\n setupDimensionsListener(videoEl, subscriber) {\n this._clearUpdateDimensionsInterval();\n\n this._width = videoEl.videoWidth;\n this._height = videoEl.videoHeight;\n\n if (!subscriber && !this._environment.isIE11() && !this._environment.isIOS()) {\n $(videoEl).on('resize', () => this._updateVideoDimensions(videoEl));\n } else {\n this.intervalId = setInterval(() => {\n if (subscriber && !(subscriber.stream && subscriber.stream.hasVideo)) {\n return;\n }\n\n if (this._width !== videoEl.videoWidth || this._height !== videoEl.videoHeight) {\n this._updateVideoDimensions(videoEl);\n }\n }, 500);\n }\n\n if (subscriber && this.intervalId) {\n subscriber.on(SUBSCRIBER_EVENTS.DESTROYED, () => {\n this._clearUpdateDimensionsInterval();\n });\n }\n }\n\n _clearUpdateDimensionsInterval() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n\n this.intervalId = null;\n }\n }\n\n /* eslint-disable no-unused-vars */\n /**\n * Get snapshot of the current frame in the media stream\n *\n * Used internally in (TsMediaPublisher | TsMediaSubscriber).getSnapshot\n *\n * @method\n * @param { TsMediaPublisher | TsMediaSubscriber } tsMediaElement\n * @param { Number } timeout Usually used in IE. Time between video element transformation and snapshot.\n * @param { Object } options\n * format: Output MIME type (image/png or image/jpeg; default: image/png).\n * quality: Output quality (between 0 and 1; default: 0.92; applies only when the format is image/jpeg).\n * x: The x coordinate of the crop starting position.\n * y: The y coordinate of the crop starting position.\n * w: Crop width.\n * h: Crop Height.\n *\n * @returns { Promise<String> } snapshot\n */\n getSnapshot(tsMediaElement, timeout = 0, {format = 'image/png', quality = 0.92, x, y, w, h} = {}) {\n throw new TypeError('The method \\'getSnapshot\\' is not implemented');\n }\n\n turnFlashlight(isTorchOn = true) {\n throw new TypeError('The method \\'turnFlashlight\\' is not implemented');\n }\n\n setAutoLightOffTimer(flashlightTimeout) {\n throw new TypeError('The method \\'setAutoLightOffTimer\\' is not implemented');\n }\n\n /* eslint-enable no-unused-vars */\n}\n\n"],"file":"stream.js"}
|
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exports.TsMediaSubscriber = exports.EVENTS = undefined;
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TsMediaSubscriber = exports.EVENTS = void 0;
|
|
9
|
+
|
|
10
|
+
var _eventEmitter = require("./event-emitter");
|
|
7
11
|
|
|
8
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
13
|
|
|
10
|
-
function
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
+
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
17
|
+
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
22
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
+
|
|
24
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
11
25
|
|
|
12
|
-
function
|
|
26
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
+
|
|
28
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
+
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
31
|
|
|
14
32
|
/**
|
|
15
33
|
* @enum SUBSCRIBER_EVENTS
|
|
16
34
|
*/
|
|
17
35
|
var SUBSCRIBER_EVENTS = {
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
DESTROYED: 'DESTROYED',
|
|
37
|
+
DISCONNECTED: 'DISCONNECTED'
|
|
20
38
|
};
|
|
21
|
-
|
|
22
39
|
exports.EVENTS = SUBSCRIBER_EVENTS;
|
|
23
40
|
|
|
24
41
|
/**
|
|
@@ -32,30 +49,34 @@ exports.EVENTS = SUBSCRIBER_EVENTS;
|
|
|
32
49
|
*
|
|
33
50
|
* @see TsMediaStream
|
|
34
51
|
*/
|
|
52
|
+
var TsMediaSubscriber = /*#__PURE__*/function (_EventEmitter) {
|
|
53
|
+
_inherits(TsMediaSubscriber, _EventEmitter);
|
|
35
54
|
|
|
36
|
-
var
|
|
37
|
-
_inherits(TsMediaSubscriber, _EventEmitter);
|
|
55
|
+
var _super = _createSuper(TsMediaSubscriber);
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
function TsMediaSubscriber(data) {
|
|
58
|
+
var _this;
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
_classCallCheck(this, TsMediaSubscriber);
|
|
43
61
|
|
|
44
|
-
|
|
45
|
-
return _this;
|
|
46
|
-
}
|
|
62
|
+
_this = _super.call(this);
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
* Unsubscribe from the media stream and destroy subscriber's view
|
|
50
|
-
*
|
|
51
|
-
* @method
|
|
52
|
-
*/
|
|
64
|
+
_.assign(_assertThisInitialized(_this), data);
|
|
53
65
|
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Unsubscribe from the media stream and destroy subscriber's view
|
|
70
|
+
*
|
|
71
|
+
* @method
|
|
72
|
+
*/
|
|
54
73
|
|
|
55
|
-
TsMediaSubscriber.prototype.destroy = function destroy() {
|
|
56
|
-
return this.stream.destroySubscriber(this);
|
|
57
|
-
};
|
|
58
74
|
|
|
75
|
+
_createClass(TsMediaSubscriber, [{
|
|
76
|
+
key: "destroy",
|
|
77
|
+
value: function destroy() {
|
|
78
|
+
return this.stream.destroySubscriber(this);
|
|
79
|
+
}
|
|
59
80
|
/**
|
|
60
81
|
* Get snapshot of the current frame in the media stream
|
|
61
82
|
*
|
|
@@ -68,11 +89,11 @@ var TsMediaSubscriber = exports.TsMediaSubscriber = function (_EventEmitter) {
|
|
|
68
89
|
* @returns { Promise<String> } snapshot
|
|
69
90
|
*/
|
|
70
91
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
}, {
|
|
93
|
+
key: "getSnapshot",
|
|
94
|
+
value: function getSnapshot(timeout, options) {
|
|
95
|
+
return this.stream.getSnapshot(this, timeout, options);
|
|
96
|
+
}
|
|
76
97
|
/**
|
|
77
98
|
* Get statistics of the media subscription like bytes received.
|
|
78
99
|
*
|
|
@@ -80,11 +101,15 @@ var TsMediaSubscriber = exports.TsMediaSubscriber = function (_EventEmitter) {
|
|
|
80
101
|
* @returns { Promise<ToBeDefined> } stats
|
|
81
102
|
*/
|
|
82
103
|
|
|
104
|
+
}, {
|
|
105
|
+
key: "getStats",
|
|
106
|
+
value: function getStats() {
|
|
107
|
+
return this.stream.getStats(this);
|
|
108
|
+
}
|
|
109
|
+
}]);
|
|
83
110
|
|
|
84
|
-
|
|
85
|
-
return this.stream.getStats(this);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return TsMediaSubscriber;
|
|
111
|
+
return TsMediaSubscriber;
|
|
89
112
|
}(_eventEmitter.EventEmitter);
|
|
113
|
+
|
|
114
|
+
exports.TsMediaSubscriber = TsMediaSubscriber;
|
|
90
115
|
//# sourceMappingURL=subscriber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["oldCode/subscriber.js"],"names":["SUBSCRIBER_EVENTS","DESTROYED","DISCONNECTED","
|
|
1
|
+
{"version":3,"sources":["oldCode/subscriber.js"],"names":["SUBSCRIBER_EVENTS","DESTROYED","DISCONNECTED","TsMediaSubscriber","data","_","assign","stream","destroySubscriber","timeout","options","getSnapshot","getStats","EventEmitter"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA,IAAMA,iBAAiB,GAAG;AACtBC,EAAAA,SAAS,EAAE,WADW;AAEtBC,EAAAA,YAAY,EAAE;AAFQ,CAA1B;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaC,iB;;;;;AACT,6BAAYC,IAAZ,EAAkB;AAAA;;AAAA;;AACd;;AAEAC,IAAAA,CAAC,CAACC,MAAF,gCAAeF,IAAf;;AAHc;AAIjB;AAED;AACJ;AACA;AACA;AACA;;;;;WACI,mBAAU;AACN,aAAO,KAAKG,MAAL,CAAYC,iBAAZ,CAA8B,IAA9B,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WACI,qBAAYC,OAAZ,EAAqBC,OAArB,EAA8B;AAC1B,aAAO,KAAKH,MAAL,CAAYI,WAAZ,CAAwB,IAAxB,EAA8BF,OAA9B,EAAuCC,OAAvC,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;;;;WACI,oBAAW;AACP,aAAO,KAAKH,MAAL,CAAYK,QAAZ,CAAqB,IAArB,CAAP;AACH;;;;EAvCkCC,0B","sourcesContent":["import { EventEmitter } from './event-emitter';\n\n/**\n * @enum SUBSCRIBER_EVENTS\n */\nconst SUBSCRIBER_EVENTS = {\n DESTROYED: 'DESTROYED',\n DISCONNECTED: 'DISCONNECTED',\n};\n\nexport { SUBSCRIBER_EVENTS as EVENTS };\n\n/**\n * Subscriber object represents subscription to a media stream.\n *\n * Exposes session and stream wrapper methods specific for media subscription.\n *\n * Instance is returned by TsMediaStream.subscribe() call\n *\n * @class\n *\n * @see TsMediaStream\n */\nexport class TsMediaSubscriber extends EventEmitter {\n constructor(data) {\n super();\n\n _.assign(this, data);\n }\n\n /**\n * Unsubscribe from the media stream and destroy subscriber's view\n *\n * @method\n */\n destroy() {\n return this.stream.destroySubscriber(this);\n }\n\n /**\n * Get snapshot of the current frame in the media stream\n *\n * @method\n * @param { Number } timeout Usually used in IE.\n * Time between video element transformation and snapshot.\n *\n * @param { Object } options Snapshot options: format, quality and crop positions\n *\n * @returns { Promise<String> } snapshot\n */\n getSnapshot(timeout, options) {\n return this.stream.getSnapshot(this, timeout, options);\n }\n\n /**\n * Get statistics of the media subscription like bytes received.\n *\n * @method\n * @returns { Promise<ToBeDefined> } stats\n */\n getStats() {\n return this.stream.getStats(this);\n }\n}\n\n"],"file":"subscriber.js"}
|
package/lib/oldCode/tracer.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ export declare class TsTracer {
|
|
|
16
16
|
private readonly _callback;
|
|
17
17
|
consoleOutputEnabled: boolean;
|
|
18
18
|
constructor(tracerType: TsTracerType, enabled: boolean, callback: ITsTraceEvent);
|
|
19
|
-
Enabled: boolean;
|
|
20
|
-
|
|
19
|
+
get Enabled(): boolean;
|
|
20
|
+
set Enabled(enabled: boolean);
|
|
21
|
+
get TracerType(): TsTracerType;
|
|
21
22
|
trace(message: string, ...rest: any[]): void;
|
|
22
23
|
}
|
|
23
24
|
export declare class TsTracers {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/oldCode/tracer.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACpB,kBAAkB,uBAAuB;IACzC,oBAAoB,yBAAyB;CAChD;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC1B,CAAC,KAAK,EAAE,cAAc,GAAG,GAAG,CAAA;CAC/B;AA0BD,qBAAa,QAAQ;IACjB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiD;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IACnC,oBAAoB,EAAE,OAAO,CAAS;gBAEjC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa;
|
|
1
|
+
{"version":3,"sources":["../src/oldCode/tracer.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACpB,kBAAkB,uBAAuB;IACzC,oBAAoB,yBAAyB;CAChD;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC1B,CAAC,KAAK,EAAE,cAAc,GAAG,GAAG,CAAA;CAC/B;AA0BD,qBAAa,QAAQ;IACjB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiD;IACvE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IACnC,oBAAoB,EAAE,OAAO,CAAS;gBAEjC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa;IAM/E,IAAI,OAAO,IAIU,OAAO,CAF3B;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAE3B;IAED,IAAI,UAAU,iBAEb;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAaxC;AAED,qBAAa,SAAS;IAClB,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAA4B;;IAY9C,QAAQ,CAAC,QAAQ,EAAE,aAAa;IAMhC,UAAU,CAAC,QAAQ,EAAE,aAAa;IAQlC,OAAO,CAAC,IAAI;IASZ,aAAa,CAAC,KAAK,EAAE,OAAO;IAQ5B,mBAAmB;IAQnB,SAAS,CAAC,UAAU,EAAE,YAAY;CAIrC;AAID,wBAAgB,UAAU,IAAI,SAAS,CAEtC;AAED,wBAAgB,SAAS,CAAC,UAAU,GAAE,YAA8C,wBAGnF","file":"tracer.d.ts","sourcesContent":["export enum TsTracerType {\n WebRtcSessionTrace = 'WebRtcSessionTrace',\n TSMediaServiceHelper = 'TSMediaServiceHelper'\n}\n\nexport interface ITsTracerEvent {\n readonly Type: TsTracerType;\n readonly Message: string;\n readonly Extra: any[];\n}\n\nexport interface ITsTraceEvent {\n (event: ITsTracerEvent): any\n}\n\nclass TsTracerEvent implements ITsTracerEvent {\n private _type: TsTracerType = TsTracerType.WebRtcSessionTrace;\n private _message: string = '';\n private _extra: any[];\n\n constructor(type: TsTracerType, message: string, extra: any[]) {\n this._type = type;\n this._message = message;\n this._extra = extra;\n }\n\n get Type(): TsTracerType {\n return this._type;\n }\n\n get Message(): string {\n return this._message;\n }\n\n get Extra(): any[] {\n return this._extra;\n }\n}\n\nexport class TsTracer {\n private _enabled: boolean = false;\n private readonly _type: TsTracerType = TsTracerType.WebRtcSessionTrace;\n private readonly _callback: ITsTraceEvent;\n public consoleOutputEnabled: boolean = false;\n\n constructor(tracerType: TsTracerType, enabled: boolean, callback: ITsTraceEvent) {\n this._type = tracerType;\n this._enabled = enabled;\n this._callback = callback;\n }\n\n get Enabled() {\n return this._enabled;\n }\n\n set Enabled(enabled: boolean) {\n this._enabled = enabled;\n }\n\n get TracerType() {\n return this._type;\n }\n\n trace(message: string, ...rest: any[]) {\n if (this.consoleOutputEnabled) {\n console.log(`${this._type}:${message}`, ...rest);\n }\n\n if (!this.Enabled) {\n return;\n }\n\n if (this._callback) {\n this._callback(new TsTracerEvent(this._type, message, rest));\n }\n }\n}\n\nexport class TsTracers {\n private _tracers: Array<TsTracer> = [];\n private _callbacks: Array<ITsTraceEvent> = [];\n\n constructor() {\n\n // @ts-ignore\n _.keys(TsTracerType).forEach((tracerType: string) => {\n\n // @ts-ignore\n this._add(TsTracerType[tracerType]);\n });\n }\n\n register(callback: ITsTraceEvent) {\n if (this._callbacks.indexOf(callback) < 0) {\n this._callbacks.push(callback);\n }\n }\n\n unregister(callback: ITsTraceEvent) {\n let index = this._callbacks.indexOf(callback);\n\n if (index >= 0) {\n this._callbacks.splice(index, 1);\n }\n }\n\n private _add(tracerType: TsTracerType) {\n const tracer = new TsTracer(tracerType, false, (event: ITsTracerEvent) => {\n // @ts-ignore\n _.forEach(this._callbacks, (callback) => callback(event));\n });\n\n this._tracers.push(tracer);\n }\n\n enableTracers(value: boolean) {\n // @ts-ignore\n _.forEach(this._tracers, (tracer) => {\n tracer.Enabled = value;\n\n });\n }\n\n enableConsoleOutput() {\n // @ts-ignore\n _.forEach(this._tracers, (tracer) => {\n tracer.consoleOutputEnabled = true;\n\n });\n }\n\n getTracer(tracerType: TsTracerType) {\n // @ts-ignore\n return _.find(this._tracers, (tracer) => tracer.TracerType === tracerType);\n }\n}\n\nconst tracers = new TsTracers();\n\nexport function getTracers(): TsTracers {\n return tracers;\n}\n\nexport function getTracer(tracerType: TsTracerType = TsTracerType.WebRtcSessionTrace) {\n\n return getTracers().getTracer(tracerType);\n}\n"]}
|