@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-no-flash.js
CHANGED
|
@@ -10001,6 +10001,9 @@ var getSession = function getSession(id) {
|
|
|
10001
10001
|
* @param {Object=} options.sipOptions Sip configuration
|
|
10002
10002
|
* @param {Object=} options.mediaOptions Media connection configuration
|
|
10003
10003
|
* @param {Integer=} options.timeout Connection timeout in milliseconds
|
|
10004
|
+
* @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
|
|
10005
|
+
* @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
|
|
10006
|
+
* @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
|
|
10004
10007
|
* @returns {Session} Created session
|
|
10005
10008
|
* @throws {Error} Error if API is not initialized
|
|
10006
10009
|
* @throws {TypeError} Error if options.urlServer is not specified
|
|
@@ -10027,6 +10030,8 @@ var createSession = function createSession(options) {
|
|
|
10027
10030
|
var mediaOptions = options.mediaOptions;
|
|
10028
10031
|
var keepAlive = options.keepAlive;
|
|
10029
10032
|
var timeout = options.timeout;
|
|
10033
|
+
var wsPingSender = new WSPingSender(options.pingInterval || 0);
|
|
10034
|
+
var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
|
|
10030
10035
|
var connectionTimeout;
|
|
10031
10036
|
var cConfig; //SIP config
|
|
10032
10037
|
|
|
@@ -10144,7 +10149,7 @@ var createSession = function createSession(options) {
|
|
|
10144
10149
|
mediaProviders: Object.keys(MediaProvider),
|
|
10145
10150
|
keepAlive: keepAlive,
|
|
10146
10151
|
authToken: authToken,
|
|
10147
|
-
clientVersion: "2.0.
|
|
10152
|
+
clientVersion: "2.0.209",
|
|
10148
10153
|
clientOSVersion: window.navigator.appVersion,
|
|
10149
10154
|
clientBrowserVersion: window.navigator.userAgent,
|
|
10150
10155
|
msePacketizationVersion: 2,
|
|
@@ -10157,7 +10162,11 @@ var createSession = function createSession(options) {
|
|
|
10157
10162
|
|
|
10158
10163
|
|
|
10159
10164
|
send("connection", cConfig);
|
|
10160
|
-
logger.setConnection(wsConnection);
|
|
10165
|
+
logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
|
|
10166
|
+
|
|
10167
|
+
wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
|
|
10168
|
+
|
|
10169
|
+
wsPingReceiver.start();
|
|
10161
10170
|
};
|
|
10162
10171
|
|
|
10163
10172
|
wsConnection.onmessage = function (event) {
|
|
@@ -10173,6 +10182,7 @@ var createSession = function createSession(options) {
|
|
|
10173
10182
|
switch (data.message) {
|
|
10174
10183
|
case 'ping':
|
|
10175
10184
|
send("pong", null);
|
|
10185
|
+
wsPingReceiver.success();
|
|
10176
10186
|
break;
|
|
10177
10187
|
|
|
10178
10188
|
case 'getUserData':
|
|
@@ -10332,7 +10342,11 @@ var createSession = function createSession(options) {
|
|
|
10332
10342
|
sessionStatus = newStatus;
|
|
10333
10343
|
|
|
10334
10344
|
if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
|
|
10335
|
-
//
|
|
10345
|
+
// Stop pinging server #WCS-3410
|
|
10346
|
+
wsPingSender.stop(); // Stop checking pings received #WCS-3410
|
|
10347
|
+
|
|
10348
|
+
wsPingReceiver.stop(); //remove streams
|
|
10349
|
+
|
|
10336
10350
|
for (var prop in streamRefreshHandlers) {
|
|
10337
10351
|
if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
|
|
10338
10352
|
streamRefreshHandlers[prop]({
|
|
@@ -10348,6 +10362,73 @@ var createSession = function createSession(options) {
|
|
|
10348
10362
|
if (callbacks[sessionStatus]) {
|
|
10349
10363
|
callbacks[sessionStatus](session, obj);
|
|
10350
10364
|
}
|
|
10365
|
+
} // Websocket periodic ping sender
|
|
10366
|
+
|
|
10367
|
+
|
|
10368
|
+
function WSPingSender(interval) {
|
|
10369
|
+
this.interval = interval || 0;
|
|
10370
|
+
this.intervalId = null;
|
|
10371
|
+
|
|
10372
|
+
this.start = function () {
|
|
10373
|
+
if (this.interval > 0) {
|
|
10374
|
+
this.intervalId = setInterval(function () {
|
|
10375
|
+
send("ping", null);
|
|
10376
|
+
}, this.interval);
|
|
10377
|
+
}
|
|
10378
|
+
};
|
|
10379
|
+
|
|
10380
|
+
this.stop = function () {
|
|
10381
|
+
if (this.intervalId) {
|
|
10382
|
+
clearInterval(this.intervalId);
|
|
10383
|
+
}
|
|
10384
|
+
};
|
|
10385
|
+
|
|
10386
|
+
return this;
|
|
10387
|
+
} // Websocket ping receive prober
|
|
10388
|
+
|
|
10389
|
+
|
|
10390
|
+
function WSPingReceiver(receiveProbes, probesInterval) {
|
|
10391
|
+
this.maxPings = receiveProbes || 0;
|
|
10392
|
+
this.interval = probesInterval || 0;
|
|
10393
|
+
this.intervalId = null;
|
|
10394
|
+
this.pingsMissing = 0;
|
|
10395
|
+
|
|
10396
|
+
this.start = function () {
|
|
10397
|
+
if (this.maxPings > 0 && this.interval > 0) {
|
|
10398
|
+
var receiver = this;
|
|
10399
|
+
this.intervalId = setInterval(function () {
|
|
10400
|
+
receiver.checkPingsReceived();
|
|
10401
|
+
}, this.interval);
|
|
10402
|
+
}
|
|
10403
|
+
};
|
|
10404
|
+
|
|
10405
|
+
this.stop = function () {
|
|
10406
|
+
if (this.intervalId) {
|
|
10407
|
+
clearInterval(this.intervalId);
|
|
10408
|
+
}
|
|
10409
|
+
|
|
10410
|
+
this.pingsMissing = 0;
|
|
10411
|
+
};
|
|
10412
|
+
|
|
10413
|
+
this.checkPingsReceived = function () {
|
|
10414
|
+
this.pingsMissing++;
|
|
10415
|
+
|
|
10416
|
+
if (this.pingsMissing >= this.maxPings) {
|
|
10417
|
+
this.failure();
|
|
10418
|
+
}
|
|
10419
|
+
};
|
|
10420
|
+
|
|
10421
|
+
this.success = function () {
|
|
10422
|
+
this.pingsMissing = 0;
|
|
10423
|
+
};
|
|
10424
|
+
|
|
10425
|
+
this.failure = function () {
|
|
10426
|
+
logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
|
|
10427
|
+
onSessionStatusChange(SESSION_STATUS.FAILED);
|
|
10428
|
+
wsConnection.close();
|
|
10429
|
+
};
|
|
10430
|
+
|
|
10431
|
+
return this;
|
|
10351
10432
|
}
|
|
10352
10433
|
/**
|
|
10353
10434
|
* @callback sdpHook
|