@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
|
@@ -1,39 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
exports.KMSWebRTCSession = 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.KMSWebRTCSession = void 0;
|
|
7
9
|
|
|
8
|
-
var _session = require(
|
|
10
|
+
var _session = require("../session");
|
|
9
11
|
|
|
10
|
-
var _publisher = require(
|
|
12
|
+
var _publisher = require("../publisher");
|
|
11
13
|
|
|
12
|
-
var _stream = require(
|
|
14
|
+
var _stream = require("./stream");
|
|
13
15
|
|
|
14
|
-
var
|
|
16
|
+
var io = _interopRequireWildcard(require("socket.io-client"));
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _tsEnvironmentDetect = require("@techsee/techsee-common/lib/helpers/ts-environment-detect");
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var _constants = require("./constants");
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _helper = require("./helper");
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
|
-
var
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
29
|
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
31
|
|
|
32
32
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
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); } }
|
|
35
|
+
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
37
|
+
|
|
38
|
+
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); }
|
|
39
|
+
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
+
|
|
42
|
+
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); }; }
|
|
43
|
+
|
|
44
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
45
|
+
|
|
46
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
47
|
|
|
36
|
-
function
|
|
48
|
+
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; } }
|
|
49
|
+
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
51
|
|
|
38
52
|
var isIE11 = new _tsEnvironmentDetect.TsEnvironmentDetect().isIE11();
|
|
39
53
|
|
|
@@ -51,217 +65,238 @@ var _require = require('kurento-utils'),
|
|
|
51
65
|
*
|
|
52
66
|
* @see TsMediaSession
|
|
53
67
|
*/
|
|
54
|
-
var KMSWebRTCSession =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
var KMSWebRTCSession = /*#__PURE__*/function (_TsMediaSession) {
|
|
69
|
+
_inherits(KMSWebRTCSession, _TsMediaSession);
|
|
70
|
+
|
|
71
|
+
var _super = _createSuper(KMSWebRTCSession);
|
|
72
|
+
|
|
73
|
+
function KMSWebRTCSession(_ref) {
|
|
74
|
+
var _this;
|
|
75
|
+
|
|
76
|
+
var credentials = _ref.credentials,
|
|
77
|
+
isMobile = _ref.isMobile,
|
|
78
|
+
resolution = _ref.resolution,
|
|
79
|
+
deviceOpts = _ref.deviceOpts;
|
|
80
|
+
|
|
81
|
+
_classCallCheck(this, KMSWebRTCSession);
|
|
82
|
+
|
|
83
|
+
_this = _super.call(this);
|
|
84
|
+
_this._credentials = credentials;
|
|
85
|
+
_this._isMobile = isMobile;
|
|
86
|
+
_this._resolution = resolution;
|
|
87
|
+
_this._deviceOpts = deviceOpts;
|
|
88
|
+
var iceServers = credentials.ice.map(function (item) {
|
|
89
|
+
return {
|
|
90
|
+
urls: item.url,
|
|
91
|
+
username: item.login,
|
|
92
|
+
credential: item.password
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
_this._configuration = {
|
|
96
|
+
iceServers: iceServers,
|
|
97
|
+
iceTransportPolicy: 'relay'
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Socket.io connection to the signaling server
|
|
101
|
+
*
|
|
102
|
+
* @private
|
|
103
|
+
* @member { Object }
|
|
104
|
+
*/
|
|
82
105
|
|
|
83
|
-
|
|
84
|
-
|
|
106
|
+
_this._socket = null;
|
|
107
|
+
/**
|
|
108
|
+
* RTCPeerConnection to the media server.
|
|
109
|
+
*
|
|
110
|
+
* For now kurento-utils is used for connection establishment.
|
|
111
|
+
*
|
|
112
|
+
* @private
|
|
113
|
+
* @member { Object }
|
|
114
|
+
*/
|
|
85
115
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_this._pc = null;
|
|
103
|
-
return _this;
|
|
116
|
+
_this._pc = null;
|
|
117
|
+
return _this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Id of the session.
|
|
121
|
+
*
|
|
122
|
+
* @member { String }
|
|
123
|
+
*
|
|
124
|
+
* @type { String }
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
_createClass(KMSWebRTCSession, [{
|
|
129
|
+
key: "id",
|
|
130
|
+
get: function get() {
|
|
131
|
+
return this._credentials.sessionId;
|
|
104
132
|
}
|
|
105
|
-
|
|
106
133
|
/**
|
|
107
|
-
*
|
|
134
|
+
* PipelineType of the session.
|
|
108
135
|
*
|
|
109
136
|
* @member { String }
|
|
110
137
|
*
|
|
111
138
|
* @type { String }
|
|
112
139
|
*/
|
|
113
140
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
socket.once('connect', function () {
|
|
129
|
-
return done();
|
|
130
|
-
});
|
|
131
|
-
//
|
|
132
|
-
// errorOccured is ts-media-client signal
|
|
133
|
-
//
|
|
134
|
-
socket.on(_constants.SOCKET_EVENTS.INCOMING.ERROR, done);
|
|
135
|
-
//
|
|
136
|
-
// And these 2 are socket.io connection failed events
|
|
137
|
-
//
|
|
138
|
-
socket.on('connect_error', done);
|
|
139
|
-
socket.on('connect_timeout', done);
|
|
140
|
-
|
|
141
|
-
_this2._socket = socket;
|
|
141
|
+
}, {
|
|
142
|
+
key: "pipelineType",
|
|
143
|
+
get: function get() {
|
|
144
|
+
return this._credentials.pipelineType || _constants.PIPELINE_TYPES.AUDIO_VIDEO_TO_SUBSCRIBERS;
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "_connectSocket",
|
|
148
|
+
value: function _connectSocket(url) {
|
|
149
|
+
var _this2 = this;
|
|
150
|
+
|
|
151
|
+
return new Promise(function (resolve, reject) {
|
|
152
|
+
var socket = io.connect(url, {
|
|
153
|
+
forceNew: true
|
|
142
154
|
});
|
|
143
|
-
};
|
|
144
155
|
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
var done = _.once(function (err) {
|
|
157
|
+
err ? reject(err) : resolve();
|
|
158
|
+
}); //
|
|
159
|
+
// When connection is established
|
|
160
|
+
//
|
|
147
161
|
|
|
148
|
-
var uid = _jsCookie2.default.get(_constants.COOKIES.UID);
|
|
149
|
-
var clientType = this._isMobile ? _constants.CLIENT_TYPES.PUBLISHER : _constants.CLIENT_TYPES.SUBSCRIBER;
|
|
150
162
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
163
|
+
socket.once('connect', function () {
|
|
164
|
+
return done();
|
|
165
|
+
}); //
|
|
166
|
+
// errorOccured is ts-media-client signal
|
|
167
|
+
//
|
|
154
168
|
|
|
155
|
-
|
|
156
|
-
|
|
169
|
+
socket.on(_constants.SOCKET_EVENTS.INCOMING.ERROR, done); //
|
|
170
|
+
// And these 2 are socket.io connection failed events
|
|
171
|
+
//
|
|
157
172
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
socket.on('connect_error', done);
|
|
174
|
+
socket.on('connect_timeout', done);
|
|
175
|
+
_this2._socket = socket;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "_setupConnection",
|
|
180
|
+
value: function _setupConnection(pc, sessionId) {
|
|
181
|
+
var _this3 = this;
|
|
162
182
|
|
|
163
|
-
|
|
164
|
-
if (error) {
|
|
165
|
-
return reject(error);
|
|
166
|
-
}
|
|
183
|
+
var uid = _jsCookie["default"].get(_constants.COOKIES.UID);
|
|
167
184
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
185
|
+
var clientType = this._isMobile ? _constants.CLIENT_TYPES.PUBLISHER : _constants.CLIENT_TYPES.SUBSCRIBER;
|
|
186
|
+
return new Promise(function (resolve, reject) {
|
|
187
|
+
_this3._socket.on(_constants.SOCKET_EVENTS.INCOMING.PIPELINE_DESTROYED, function () {
|
|
188
|
+
_this3.destroyed = true;
|
|
172
189
|
|
|
173
|
-
|
|
174
|
-
sdpOffer: offer
|
|
175
|
-
});
|
|
190
|
+
_this3._socket.off();
|
|
176
191
|
|
|
177
|
-
|
|
178
|
-
|
|
192
|
+
_this3._socket.disconnect();
|
|
193
|
+
|
|
194
|
+
_this3.emit(_session.EVENTS.DISCONNECTED, {
|
|
195
|
+
reason: 'Client disconnected'
|
|
196
|
+
});
|
|
179
197
|
});
|
|
180
|
-
};
|
|
181
198
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return
|
|
185
|
-
|
|
199
|
+
pc.generateOffer(function (error, offer) {
|
|
200
|
+
if (error) {
|
|
201
|
+
return reject(error);
|
|
202
|
+
}
|
|
186
203
|
|
|
187
|
-
|
|
188
|
-
|
|
204
|
+
_this3._socket.emit(_constants.SOCKET_EVENTS.OUTGOING.JOIN_PIPELINE, {
|
|
205
|
+
uid: uid,
|
|
206
|
+
sessionId: sessionId,
|
|
207
|
+
clientType: clientType,
|
|
208
|
+
pipelineType: _this3.pipelineType,
|
|
209
|
+
sdpOffer: offer
|
|
210
|
+
});
|
|
189
211
|
|
|
190
|
-
|
|
191
|
-
|
|
212
|
+
resolve();
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "_getPeerType",
|
|
218
|
+
value: function _getPeerType(constraints, isMobile) {
|
|
219
|
+
if (isMobile || constraints.audio) {
|
|
220
|
+
return _constants.PEER_CONNECTION_TYPES.SEND_RECV;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return _constants.PEER_CONNECTION_TYPES.RECV_ONLY;
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: "_connectRTCPeer",
|
|
227
|
+
value: function _connectRTCPeer(_ref2) {
|
|
228
|
+
var _this4 = this;
|
|
229
|
+
|
|
230
|
+
var constraints = _ref2.constraints,
|
|
231
|
+
configuration = _ref2.configuration,
|
|
232
|
+
sessionId = _ref2.sessionId,
|
|
233
|
+
isMobile = _ref2.isMobile;
|
|
234
|
+
return new Promise(function (resolve, reject) {
|
|
235
|
+
var done = _.once(function (err) {
|
|
236
|
+
err ? reject(err) : resolve();
|
|
237
|
+
});
|
|
192
238
|
|
|
193
|
-
var
|
|
194
|
-
configuration = _ref2.configuration,
|
|
195
|
-
sessionId = _ref2.sessionId,
|
|
196
|
-
isMobile = _ref2.isMobile;
|
|
239
|
+
var peerConnectionType = _this4._getPeerType(constraints, isMobile);
|
|
197
240
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
241
|
+
var pc = WebRtcPeer[peerConnectionType]({
|
|
242
|
+
configuration: configuration,
|
|
243
|
+
mediaConstraints: constraints,
|
|
244
|
+
onicecandidate: function onicecandidate(candidate) {
|
|
245
|
+
_this4._socket.emit(_constants.SOCKET_EVENTS.OUTGOING.ICE_CANDIDATE, {
|
|
246
|
+
sessionId: sessionId,
|
|
247
|
+
candidate: candidate,
|
|
248
|
+
clientType: isMobile ? _constants.CLIENT_TYPES.PUBLISHER : _constants.CLIENT_TYPES.SUBSCRIBER
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}, function (error) {
|
|
252
|
+
if (error) {
|
|
253
|
+
return done(error);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
_this4._socket.on(_constants.SOCKET_EVENTS.INCOMING.JOIN_RESPONSE, function (_ref3) {
|
|
257
|
+
var sdpAnswer = _ref3.sdpAnswer,
|
|
258
|
+
uid = _ref3.uid;
|
|
259
|
+
|
|
260
|
+
_jsCookie["default"].set(_constants.COOKIES.UID, uid);
|
|
261
|
+
|
|
262
|
+
pc.processAnswer(sdpAnswer, function (error) {
|
|
263
|
+
if (error) {
|
|
264
|
+
return done(error);
|
|
265
|
+
}
|
|
201
266
|
});
|
|
202
|
-
var peerConnectionType = _this4._getPeerType(constraints, isMobile);
|
|
203
|
-
|
|
204
|
-
var pc = WebRtcPeer[peerConnectionType]({
|
|
205
|
-
configuration: configuration,
|
|
206
|
-
|
|
207
|
-
mediaConstraints: constraints,
|
|
208
|
-
onicecandidate: function onicecandidate(candidate) {
|
|
209
|
-
_this4._socket.emit(_constants.SOCKET_EVENTS.OUTGOING.ICE_CANDIDATE, {
|
|
210
|
-
sessionId: sessionId,
|
|
211
|
-
|
|
212
|
-
candidate: candidate,
|
|
213
|
-
clientType: isMobile ? _constants.CLIENT_TYPES.PUBLISHER : _constants.CLIENT_TYPES.SUBSCRIBER
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}, function (error) {
|
|
217
|
-
if (error) {
|
|
218
|
-
return done(error);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
_this4._socket.on(_constants.SOCKET_EVENTS.INCOMING.JOIN_RESPONSE, function (_ref3) {
|
|
222
|
-
var sdpAnswer = _ref3.sdpAnswer,
|
|
223
|
-
uid = _ref3.uid;
|
|
224
|
-
|
|
225
|
-
_jsCookie2.default.set(_constants.COOKIES.UID, uid);
|
|
226
267
|
|
|
227
|
-
|
|
228
|
-
if (error) {
|
|
229
|
-
return done(error);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
268
|
+
_this4.emit(_session.EVENTS.CONNECTED);
|
|
232
269
|
|
|
233
|
-
|
|
270
|
+
_this4._socket.off(_constants.SOCKET_EVENTS.INCOMING.ERROR);
|
|
234
271
|
|
|
235
|
-
|
|
236
|
-
_this4._socket.off('connect_error');
|
|
237
|
-
_this4._socket.off('connect_timeout');
|
|
272
|
+
_this4._socket.off('connect_error');
|
|
238
273
|
|
|
239
|
-
|
|
240
|
-
});
|
|
274
|
+
_this4._socket.off('connect_timeout');
|
|
241
275
|
|
|
242
|
-
|
|
243
|
-
|
|
276
|
+
return done();
|
|
277
|
+
});
|
|
244
278
|
|
|
245
|
-
|
|
246
|
-
|
|
279
|
+
_this4._socket.on(_constants.SOCKET_EVENTS.INCOMING.ICE_CANDIDATE, function (_ref4) {
|
|
280
|
+
var candidate = _ref4.candidate;
|
|
281
|
+
pc.addIceCandidate(candidate);
|
|
282
|
+
});
|
|
247
283
|
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
_this4._pc = pc;
|
|
284
|
+
_this4._setupConnection(pc, sessionId).then(done)["catch"](done);
|
|
252
285
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
286
|
+
_this4._pc = pc;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}, {
|
|
290
|
+
key: "_setTrackStateTo",
|
|
291
|
+
value: function _setTrackStateTo(state) {
|
|
292
|
+
return function (track) {
|
|
293
|
+
if (track.setEnabled) {
|
|
294
|
+
track.setEnabled(state);
|
|
295
|
+
} else {
|
|
296
|
+
track.enabled = state;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
265
300
|
/**
|
|
266
301
|
* Establish socket and peer connection to the media server.
|
|
267
302
|
*
|
|
@@ -271,44 +306,42 @@ var KMSWebRTCSession = exports.KMSWebRTCSession = function (_TsMediaSession) {
|
|
|
271
306
|
* @fires SESSION_EVENTS#CONNECTED
|
|
272
307
|
*/
|
|
273
308
|
|
|
309
|
+
}, {
|
|
310
|
+
key: "connect",
|
|
311
|
+
value: function connect() {
|
|
312
|
+
var _this5 = this;
|
|
274
313
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (!_this5._isMobile && constraints.video) {
|
|
287
|
-
delete constraints.video;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return _this5._connectRTCPeer({
|
|
291
|
-
constraints: constraints,
|
|
292
|
-
|
|
293
|
-
configuration: _this5._configuration,
|
|
294
|
-
sessionId: _this5._credentials.sessionId,
|
|
295
|
-
isMobile: _this5._isMobile
|
|
296
|
-
});
|
|
297
|
-
}).then(function () {
|
|
298
|
-
_this5._pc.peerConnection.getLocalStreams().forEach(function (stream) {
|
|
299
|
-
stream.getTracks().forEach(_this5._setTrackStateTo(false));
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
_this5._pc.peerConnection.onaddstream = function (_ref5) {
|
|
303
|
-
var stream = _ref5.stream;
|
|
304
|
-
|
|
305
|
-
var tsStream = new _stream.TsWebRTCStream(_this5, stream);
|
|
314
|
+
return this._connectSocket(this._credentials.url).then(function () {
|
|
315
|
+
return (0, _helper.getMediaConstraints)({
|
|
316
|
+
resolution: _this5._resolution,
|
|
317
|
+
deviceOpts: _this5._deviceOpts
|
|
318
|
+
});
|
|
319
|
+
}).then(function (constraints) {
|
|
320
|
+
// streaming from dashboard is not supported and we
|
|
321
|
+
// don't want to access the camera without a reason
|
|
322
|
+
if (!_this5._isMobile && constraints.video) {
|
|
323
|
+
delete constraints.video;
|
|
324
|
+
}
|
|
306
325
|
|
|
307
|
-
|
|
308
|
-
|
|
326
|
+
return _this5._connectRTCPeer({
|
|
327
|
+
constraints: constraints,
|
|
328
|
+
configuration: _this5._configuration,
|
|
329
|
+
sessionId: _this5._credentials.sessionId,
|
|
330
|
+
isMobile: _this5._isMobile
|
|
331
|
+
});
|
|
332
|
+
}).then(function () {
|
|
333
|
+
_this5._pc.peerConnection.getLocalStreams().forEach(function (stream) {
|
|
334
|
+
stream.getTracks().forEach(_this5._setTrackStateTo(false));
|
|
309
335
|
});
|
|
310
|
-
};
|
|
311
336
|
|
|
337
|
+
_this5._pc.peerConnection.onaddstream = function (_ref5) {
|
|
338
|
+
var stream = _ref5.stream;
|
|
339
|
+
var tsStream = new _stream.TsWebRTCStream(_this5, stream);
|
|
340
|
+
|
|
341
|
+
_this5.emit(_session.EVENTS.STREAM_CREATED, tsStream);
|
|
342
|
+
};
|
|
343
|
+
});
|
|
344
|
+
}
|
|
312
345
|
/**
|
|
313
346
|
* Close all media streams, disconnect RTCPeerConnection and socket.io
|
|
314
347
|
*
|
|
@@ -318,30 +351,33 @@ var KMSWebRTCSession = exports.KMSWebRTCSession = function (_TsMediaSession) {
|
|
|
318
351
|
* @fires SESSION_EVENTS#DISCONNECTED
|
|
319
352
|
*/
|
|
320
353
|
|
|
354
|
+
}, {
|
|
355
|
+
key: "disconnect",
|
|
356
|
+
value: function disconnect() {
|
|
357
|
+
var _this6 = this;
|
|
321
358
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (_this6.destroyed) {
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
359
|
+
return Promise.resolve().then(function () {
|
|
360
|
+
if (_this6.destroyed) {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
329
363
|
|
|
330
|
-
|
|
364
|
+
_this6._pc.peerConnection.close();
|
|
331
365
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
_this6._socket.disconnect();
|
|
366
|
+
_this6._socket.emit(_constants.SOCKET_EVENTS.OUTGOING.DESTROY_PIPELINE, {
|
|
367
|
+
sessionId: _this6._credentials.sessionId
|
|
368
|
+
});
|
|
336
369
|
|
|
337
|
-
|
|
370
|
+
_this6._socket.disconnect();
|
|
338
371
|
|
|
339
|
-
|
|
372
|
+
var event = {
|
|
373
|
+
reason: 'disconnected'
|
|
374
|
+
};
|
|
340
375
|
|
|
341
|
-
|
|
342
|
-
});
|
|
343
|
-
};
|
|
376
|
+
_this6.emit(_session.EVENTS.DISCONNECTED, event);
|
|
344
377
|
|
|
378
|
+
return event;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
345
381
|
/**
|
|
346
382
|
* Create new TsMediaPublisher instance
|
|
347
383
|
*
|
|
@@ -362,54 +398,48 @@ var KMSWebRTCSession = exports.KMSWebRTCSession = function (_TsMediaSession) {
|
|
|
362
398
|
* @see TsMediaPublisher
|
|
363
399
|
*/
|
|
364
400
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
videoWidth: tsstream.videoDimensions.width,
|
|
403
|
-
|
|
404
|
-
_target: target
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
tsstream.publisher = publisher;
|
|
408
|
-
|
|
409
|
-
return publisher;
|
|
401
|
+
}, {
|
|
402
|
+
key: "createPublisher",
|
|
403
|
+
value: function createPublisher(target, params) {
|
|
404
|
+
var _this7 = this;
|
|
405
|
+
|
|
406
|
+
if (!params) {
|
|
407
|
+
params = target;
|
|
408
|
+
target = null;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return Promise.resolve().then(function () {
|
|
412
|
+
//
|
|
413
|
+
// Get media streams that were created on session initialization
|
|
414
|
+
//
|
|
415
|
+
var mediaStream = _this7._pc.peerConnection.getLocalStreams()[0]; //
|
|
416
|
+
// Get tracks that are related to the publisher (audio or video)
|
|
417
|
+
//
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
var tracks = _this7._pc.peerConnection.getLocalStreams().reduce(function (result, mediaStream) {
|
|
421
|
+
mediaStream.getTracks().filter(function (track) {
|
|
422
|
+
return track.kind === 'video' && params.videoDevice || track.kind === 'audio' && params.audioDevice;
|
|
423
|
+
}).forEach(function (track) {
|
|
424
|
+
return result.push(track);
|
|
425
|
+
});
|
|
426
|
+
return result;
|
|
427
|
+
}, []);
|
|
428
|
+
|
|
429
|
+
var tsstream = new _stream.TsWebRTCStream(_this7, mediaStream, params.name);
|
|
430
|
+
tsstream.remote = false;
|
|
431
|
+
var publisher = new _publisher.TsMediaPublisher(_this7, {
|
|
432
|
+
stream: tsstream,
|
|
433
|
+
tracks: tracks,
|
|
434
|
+
videoParams: params.videoParams,
|
|
435
|
+
videoHeight: tsstream.videoDimensions.height,
|
|
436
|
+
videoWidth: tsstream.videoDimensions.width,
|
|
437
|
+
_target: target
|
|
410
438
|
});
|
|
411
|
-
|
|
412
|
-
|
|
439
|
+
tsstream.publisher = publisher;
|
|
440
|
+
return publisher;
|
|
441
|
+
});
|
|
442
|
+
}
|
|
413
443
|
/**
|
|
414
444
|
* Publish stream from previously create TsMediaPublisher instance.
|
|
415
445
|
*
|
|
@@ -428,77 +458,80 @@ var KMSWebRTCSession = exports.KMSWebRTCSession = function (_TsMediaSession) {
|
|
|
428
458
|
* @see TsMediaPublisher#publish
|
|
429
459
|
*/
|
|
430
460
|
|
|
461
|
+
}, {
|
|
462
|
+
key: "publish",
|
|
463
|
+
value: function publish(publisher) {
|
|
464
|
+
var _this8 = this;
|
|
431
465
|
|
|
432
|
-
|
|
433
|
-
|
|
466
|
+
return Promise.resolve().then(function () {
|
|
467
|
+
publisher.emit(_publisher.EVENTS.STREAM_CREATED, publisher.stream);
|
|
434
468
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
value: publisher.stream.hasVideo
|
|
441
|
-
});
|
|
442
|
-
_this8.emit(_session.EVENTS.STREAM_PROPERTY_CHANGED, {
|
|
443
|
-
stream: publisher.stream,
|
|
444
|
-
property: 'hasAudio',
|
|
445
|
-
value: publisher.stream.hasAudio
|
|
446
|
-
});
|
|
469
|
+
_this8.emit(_session.EVENTS.STREAM_PROPERTY_CHANGED, {
|
|
470
|
+
stream: publisher.stream,
|
|
471
|
+
property: 'hasVideo',
|
|
472
|
+
value: publisher.stream.hasVideo
|
|
473
|
+
});
|
|
447
474
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
var video = document.createElement('video');
|
|
453
|
-
|
|
454
|
-
if (!isIE11) {
|
|
455
|
-
video.src = URL.createObjectURL(publisher.stream._mediaStream);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
video.playsInline = true;
|
|
459
|
-
video.autoplay = true;
|
|
460
|
-
|
|
461
|
-
if (isIE11) {
|
|
462
|
-
publisher._target.appendChild(video);
|
|
463
|
-
publisher._element = attachMediaStream(video, publisher.stream._mediaStream);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
var params = _.assign({}, {
|
|
467
|
-
fitMode: 'contain',
|
|
468
|
-
insertMode: 'append',
|
|
469
|
-
mirror: false,
|
|
470
|
-
resolution: '480x640',
|
|
471
|
-
width: '100%',
|
|
472
|
-
height: '100%'
|
|
473
|
-
}, publisher.videoParams);
|
|
474
|
-
|
|
475
|
-
var elementHeight = typeof params.height === 'string' ? params.height : params.height + 'px';
|
|
476
|
-
var elementWidth = typeof params.width === 'string' ? params.width : params.width + 'px';
|
|
477
|
-
|
|
478
|
-
_.assign((isIE11 ? publisher._element : video).style, {
|
|
479
|
-
height: elementHeight,
|
|
480
|
-
width: elementWidth,
|
|
481
|
-
|
|
482
|
-
position: 'relative',
|
|
483
|
-
'object-fit': params.fitMode
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
if (!isIE11) {
|
|
487
|
-
publisher._target.appendChild(video);
|
|
488
|
-
publisher._element = video;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
publisher.stream.setupDimensionsListener(video);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
//
|
|
495
|
-
// Enable (unpause) all media tracks related to publisher.
|
|
496
|
-
// They are sending data to the server from this moment.
|
|
497
|
-
//
|
|
498
|
-
publisher.tracks.forEach(_this8._setTrackStateTo(true));
|
|
475
|
+
_this8.emit(_session.EVENTS.STREAM_PROPERTY_CHANGED, {
|
|
476
|
+
stream: publisher.stream,
|
|
477
|
+
property: 'hasAudio',
|
|
478
|
+
value: publisher.stream.hasAudio
|
|
499
479
|
});
|
|
500
|
-
};
|
|
501
480
|
|
|
481
|
+
if (publisher._target) {
|
|
482
|
+
//
|
|
483
|
+
// New video element where publishing video stream will be rendered
|
|
484
|
+
//
|
|
485
|
+
var video = document.createElement('video');
|
|
486
|
+
|
|
487
|
+
if (!isIE11) {
|
|
488
|
+
video.src = URL.createObjectURL(publisher.stream._mediaStream);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
video.playsInline = true;
|
|
492
|
+
video.autoplay = true;
|
|
493
|
+
|
|
494
|
+
if (isIE11) {
|
|
495
|
+
publisher._target.appendChild(video);
|
|
496
|
+
|
|
497
|
+
publisher._element = attachMediaStream(video, publisher.stream._mediaStream);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
var params = _.assign({}, {
|
|
501
|
+
fitMode: 'contain',
|
|
502
|
+
insertMode: 'append',
|
|
503
|
+
mirror: false,
|
|
504
|
+
resolution: '480x640',
|
|
505
|
+
width: '100%',
|
|
506
|
+
height: '100%'
|
|
507
|
+
}, publisher.videoParams);
|
|
508
|
+
|
|
509
|
+
var elementHeight = typeof params.height === 'string' ? params.height : params.height + 'px';
|
|
510
|
+
var elementWidth = typeof params.width === 'string' ? params.width : params.width + 'px';
|
|
511
|
+
|
|
512
|
+
_.assign((isIE11 ? publisher._element : video).style, {
|
|
513
|
+
height: elementHeight,
|
|
514
|
+
width: elementWidth,
|
|
515
|
+
position: 'relative',
|
|
516
|
+
'object-fit': params.fitMode
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
if (!isIE11) {
|
|
520
|
+
publisher._target.appendChild(video);
|
|
521
|
+
|
|
522
|
+
publisher._element = video;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
publisher.stream.setupDimensionsListener(video);
|
|
526
|
+
} //
|
|
527
|
+
// Enable (unpause) all media tracks related to publisher.
|
|
528
|
+
// They are sending data to the server from this moment.
|
|
529
|
+
//
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
publisher.tracks.forEach(_this8._setTrackStateTo(true));
|
|
533
|
+
});
|
|
534
|
+
}
|
|
502
535
|
/**
|
|
503
536
|
* Unpublish stream and destroy publisher's view.
|
|
504
537
|
*
|
|
@@ -515,44 +548,26 @@ var KMSWebRTCSession = exports.KMSWebRTCSession = function (_TsMediaSession) {
|
|
|
515
548
|
* @see TsMediaPublisher#destroy
|
|
516
549
|
*/
|
|
517
550
|
|
|
551
|
+
}, {
|
|
552
|
+
key: "destroyPublisher",
|
|
553
|
+
value: function destroyPublisher(publisher) {
|
|
554
|
+
var _this9 = this;
|
|
518
555
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
return new Promise(function (resolve) {
|
|
523
|
-
publisher.tracks.forEach(_this9._setTrackStateTo(false));
|
|
524
|
-
|
|
525
|
-
if (publisher._element) {
|
|
526
|
-
publisher._element.remove();
|
|
527
|
-
}
|
|
556
|
+
return new Promise(function (resolve) {
|
|
557
|
+
publisher.tracks.forEach(_this9._setTrackStateTo(false));
|
|
528
558
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return resolve();
|
|
532
|
-
});
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
_createClass(KMSWebRTCSession, [{
|
|
536
|
-
key: 'id',
|
|
537
|
-
get: function get() {
|
|
538
|
-
return this._credentials.sessionId;
|
|
559
|
+
if (publisher._element) {
|
|
560
|
+
publisher._element.remove();
|
|
539
561
|
}
|
|
540
562
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
* @type { String }
|
|
547
|
-
*/
|
|
548
|
-
|
|
549
|
-
}, {
|
|
550
|
-
key: 'pipelineType',
|
|
551
|
-
get: function get() {
|
|
552
|
-
return this._credentials.pipelineType || _constants.PIPELINE_TYPES.AUDIO_VIDEO_TO_SUBSCRIBERS;
|
|
553
|
-
}
|
|
554
|
-
}]);
|
|
563
|
+
publisher.emit(_publisher.EVENTS.DESTROYED);
|
|
564
|
+
return resolve();
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}]);
|
|
555
568
|
|
|
556
|
-
|
|
569
|
+
return KMSWebRTCSession;
|
|
557
570
|
}(_session.TsMediaSession);
|
|
571
|
+
|
|
572
|
+
exports.KMSWebRTCSession = KMSWebRTCSession;
|
|
558
573
|
//# sourceMappingURL=session-kms.js.map
|