@flashphoner/websdk 2.0.208 → 2.0.209
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/docTemplate/README.md +1 -1
- package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.html +77 -1
- package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.js +472 -84
- package/flashphoner-no-flash.js +84 -3
- package/flashphoner-no-flash.min.js +1 -1
- package/flashphoner-no-webrtc.js +84 -3
- package/flashphoner-no-webrtc.min.js +1 -1
- package/flashphoner-no-wsplayer.js +84 -3
- package/flashphoner-no-wsplayer.min.js +1 -1
- package/flashphoner-room-api.js +74 -1
- package/flashphoner-room-api.min.js +1 -1
- package/flashphoner-temasys-flash-websocket-without-adapterjs.js +84 -3
- package/flashphoner-temasys-flash-websocket.js +84 -3
- package/flashphoner-temasys-flash-websocket.min.js +1 -1
- package/flashphoner-webrtc-only.js +84 -3
- package/flashphoner-webrtc-only.min.js +1 -1
- package/flashphoner.js +84 -3
- package/flashphoner.min.js +1 -1
- package/package.json +1 -1
- package/src/flashphoner-core.d.ts +4 -1
- package/src/flashphoner-core.js +74 -1
package/flashphoner-room-api.js
CHANGED
|
@@ -10035,6 +10035,9 @@ var getSession = function (id) {
|
|
|
10035
10035
|
* @param {Object=} options.sipOptions Sip configuration
|
|
10036
10036
|
* @param {Object=} options.mediaOptions Media connection configuration
|
|
10037
10037
|
* @param {Integer=} options.timeout Connection timeout in milliseconds
|
|
10038
|
+
* @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
|
|
10039
|
+
* @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
|
|
10040
|
+
* @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
|
|
10038
10041
|
* @returns {Session} Created session
|
|
10039
10042
|
* @throws {Error} Error if API is not initialized
|
|
10040
10043
|
* @throws {TypeError} Error if options.urlServer is not specified
|
|
@@ -10059,6 +10062,8 @@ var createSession = function (options) {
|
|
|
10059
10062
|
var mediaOptions = options.mediaOptions;
|
|
10060
10063
|
var keepAlive = options.keepAlive;
|
|
10061
10064
|
var timeout = options.timeout;
|
|
10065
|
+
var wsPingSender = new WSPingSender(options.pingInterval || 0);
|
|
10066
|
+
var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
|
|
10062
10067
|
var connectionTimeout;
|
|
10063
10068
|
|
|
10064
10069
|
var cConfig;
|
|
@@ -10166,7 +10171,7 @@ var createSession = function (options) {
|
|
|
10166
10171
|
mediaProviders: Object.keys(MediaProvider),
|
|
10167
10172
|
keepAlive: keepAlive,
|
|
10168
10173
|
authToken:authToken,
|
|
10169
|
-
clientVersion: "2.0.
|
|
10174
|
+
clientVersion: "2.0.209",
|
|
10170
10175
|
clientOSVersion: window.navigator.appVersion,
|
|
10171
10176
|
clientBrowserVersion: window.navigator.userAgent,
|
|
10172
10177
|
msePacketizationVersion: 2,
|
|
@@ -10178,6 +10183,10 @@ var createSession = function (options) {
|
|
|
10178
10183
|
//connect to REST App
|
|
10179
10184
|
send("connection", cConfig);
|
|
10180
10185
|
logger.setConnection(wsConnection);
|
|
10186
|
+
// Send ping messages to server to check if connection is still alive #WCS-3410
|
|
10187
|
+
wsPingSender.start();
|
|
10188
|
+
// Check subsequintel pings received from server to check if connection is still alive #WCS-3410
|
|
10189
|
+
wsPingReceiver.start();
|
|
10181
10190
|
};
|
|
10182
10191
|
wsConnection.onmessage = function (event) {
|
|
10183
10192
|
var data = {};
|
|
@@ -10190,6 +10199,7 @@ var createSession = function (options) {
|
|
|
10190
10199
|
switch (data.message) {
|
|
10191
10200
|
case 'ping':
|
|
10192
10201
|
send("pong", null);
|
|
10202
|
+
wsPingReceiver.success();
|
|
10193
10203
|
break;
|
|
10194
10204
|
case 'getUserData':
|
|
10195
10205
|
authToken = obj.authToken;
|
|
@@ -10316,6 +10326,10 @@ var createSession = function (options) {
|
|
|
10316
10326
|
function onSessionStatusChange(newStatus, obj) {
|
|
10317
10327
|
sessionStatus = newStatus;
|
|
10318
10328
|
if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
|
|
10329
|
+
// Stop pinging server #WCS-3410
|
|
10330
|
+
wsPingSender.stop();
|
|
10331
|
+
// Stop checking pings received #WCS-3410
|
|
10332
|
+
wsPingReceiver.stop();
|
|
10319
10333
|
//remove streams
|
|
10320
10334
|
for (var prop in streamRefreshHandlers) {
|
|
10321
10335
|
if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
|
|
@@ -10330,6 +10344,65 @@ var createSession = function (options) {
|
|
|
10330
10344
|
}
|
|
10331
10345
|
}
|
|
10332
10346
|
|
|
10347
|
+
// Websocket periodic ping sender
|
|
10348
|
+
function WSPingSender(interval) {
|
|
10349
|
+
this.interval = interval || 0;
|
|
10350
|
+
this.intervalId = null;
|
|
10351
|
+
this.start = function() {
|
|
10352
|
+
if (this.interval > 0) {
|
|
10353
|
+
this.intervalId = setInterval(function() {
|
|
10354
|
+
send("ping", null);
|
|
10355
|
+
}, this.interval);
|
|
10356
|
+
}
|
|
10357
|
+
};
|
|
10358
|
+
this.stop = function() {
|
|
10359
|
+
if (this.intervalId) {
|
|
10360
|
+
clearInterval(this.intervalId);
|
|
10361
|
+
}
|
|
10362
|
+
};
|
|
10363
|
+
|
|
10364
|
+
return(this);
|
|
10365
|
+
}
|
|
10366
|
+
|
|
10367
|
+
// Websocket ping receive prober
|
|
10368
|
+
function WSPingReceiver(receiveProbes, probesInterval) {
|
|
10369
|
+
this.maxPings = receiveProbes || 0;
|
|
10370
|
+
this.interval = probesInterval || 0;
|
|
10371
|
+
this.intervalId = null;
|
|
10372
|
+
this.pingsMissing = 0;
|
|
10373
|
+
this.start = function() {
|
|
10374
|
+
if (this.maxPings > 0 && this.interval > 0) {
|
|
10375
|
+
let receiver = this;
|
|
10376
|
+
this.intervalId = setInterval(function() {
|
|
10377
|
+
receiver.checkPingsReceived();
|
|
10378
|
+
}, this.interval);
|
|
10379
|
+
}
|
|
10380
|
+
};
|
|
10381
|
+
this.stop = function() {
|
|
10382
|
+
if (this.intervalId) {
|
|
10383
|
+
clearInterval(this.intervalId);
|
|
10384
|
+
}
|
|
10385
|
+
this.pingsMissing = 0;
|
|
10386
|
+
};
|
|
10387
|
+
this.checkPingsReceived = function() {
|
|
10388
|
+
this.pingsMissing++;
|
|
10389
|
+
if (this.pingsMissing >= this.maxPings) {
|
|
10390
|
+
this.failure();
|
|
10391
|
+
}
|
|
10392
|
+
};
|
|
10393
|
+
this.success = function() {
|
|
10394
|
+
this.pingsMissing = 0;
|
|
10395
|
+
};
|
|
10396
|
+
this.failure = function() {
|
|
10397
|
+
logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
|
|
10398
|
+
onSessionStatusChange(SESSION_STATUS.FAILED);
|
|
10399
|
+
wsConnection.close();
|
|
10400
|
+
};
|
|
10401
|
+
|
|
10402
|
+
return(this);
|
|
10403
|
+
}
|
|
10404
|
+
|
|
10405
|
+
|
|
10333
10406
|
/**
|
|
10334
10407
|
* @callback sdpHook
|
|
10335
10408
|
* @param {Object} sdp Callback options
|