@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
|
@@ -10384,6 +10384,9 @@ var getSession = function getSession(id) {
|
|
|
10384
10384
|
* @param {Object=} options.sipOptions Sip configuration
|
|
10385
10385
|
* @param {Object=} options.mediaOptions Media connection configuration
|
|
10386
10386
|
* @param {Integer=} options.timeout Connection timeout in milliseconds
|
|
10387
|
+
* @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
|
|
10388
|
+
* @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
|
|
10389
|
+
* @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
|
|
10387
10390
|
* @returns {Session} Created session
|
|
10388
10391
|
* @throws {Error} Error if API is not initialized
|
|
10389
10392
|
* @throws {TypeError} Error if options.urlServer is not specified
|
|
@@ -10410,6 +10413,8 @@ var createSession = function createSession(options) {
|
|
|
10410
10413
|
var mediaOptions = options.mediaOptions;
|
|
10411
10414
|
var keepAlive = options.keepAlive;
|
|
10412
10415
|
var timeout = options.timeout;
|
|
10416
|
+
var wsPingSender = new WSPingSender(options.pingInterval || 0);
|
|
10417
|
+
var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
|
|
10413
10418
|
var connectionTimeout;
|
|
10414
10419
|
var cConfig; //SIP config
|
|
10415
10420
|
|
|
@@ -10527,7 +10532,7 @@ var createSession = function createSession(options) {
|
|
|
10527
10532
|
mediaProviders: Object.keys(MediaProvider),
|
|
10528
10533
|
keepAlive: keepAlive,
|
|
10529
10534
|
authToken: authToken,
|
|
10530
|
-
clientVersion: "2.0.
|
|
10535
|
+
clientVersion: "2.0.209",
|
|
10531
10536
|
clientOSVersion: window.navigator.appVersion,
|
|
10532
10537
|
clientBrowserVersion: window.navigator.userAgent,
|
|
10533
10538
|
msePacketizationVersion: 2,
|
|
@@ -10540,7 +10545,11 @@ var createSession = function createSession(options) {
|
|
|
10540
10545
|
|
|
10541
10546
|
|
|
10542
10547
|
send("connection", cConfig);
|
|
10543
|
-
logger.setConnection(wsConnection);
|
|
10548
|
+
logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
|
|
10549
|
+
|
|
10550
|
+
wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
|
|
10551
|
+
|
|
10552
|
+
wsPingReceiver.start();
|
|
10544
10553
|
};
|
|
10545
10554
|
|
|
10546
10555
|
wsConnection.onmessage = function (event) {
|
|
@@ -10556,6 +10565,7 @@ var createSession = function createSession(options) {
|
|
|
10556
10565
|
switch (data.message) {
|
|
10557
10566
|
case 'ping':
|
|
10558
10567
|
send("pong", null);
|
|
10568
|
+
wsPingReceiver.success();
|
|
10559
10569
|
break;
|
|
10560
10570
|
|
|
10561
10571
|
case 'getUserData':
|
|
@@ -10715,7 +10725,11 @@ var createSession = function createSession(options) {
|
|
|
10715
10725
|
sessionStatus = newStatus;
|
|
10716
10726
|
|
|
10717
10727
|
if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
|
|
10718
|
-
//
|
|
10728
|
+
// Stop pinging server #WCS-3410
|
|
10729
|
+
wsPingSender.stop(); // Stop checking pings received #WCS-3410
|
|
10730
|
+
|
|
10731
|
+
wsPingReceiver.stop(); //remove streams
|
|
10732
|
+
|
|
10719
10733
|
for (var prop in streamRefreshHandlers) {
|
|
10720
10734
|
if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
|
|
10721
10735
|
streamRefreshHandlers[prop]({
|
|
@@ -10731,6 +10745,73 @@ var createSession = function createSession(options) {
|
|
|
10731
10745
|
if (callbacks[sessionStatus]) {
|
|
10732
10746
|
callbacks[sessionStatus](session, obj);
|
|
10733
10747
|
}
|
|
10748
|
+
} // Websocket periodic ping sender
|
|
10749
|
+
|
|
10750
|
+
|
|
10751
|
+
function WSPingSender(interval) {
|
|
10752
|
+
this.interval = interval || 0;
|
|
10753
|
+
this.intervalId = null;
|
|
10754
|
+
|
|
10755
|
+
this.start = function () {
|
|
10756
|
+
if (this.interval > 0) {
|
|
10757
|
+
this.intervalId = setInterval(function () {
|
|
10758
|
+
send("ping", null);
|
|
10759
|
+
}, this.interval);
|
|
10760
|
+
}
|
|
10761
|
+
};
|
|
10762
|
+
|
|
10763
|
+
this.stop = function () {
|
|
10764
|
+
if (this.intervalId) {
|
|
10765
|
+
clearInterval(this.intervalId);
|
|
10766
|
+
}
|
|
10767
|
+
};
|
|
10768
|
+
|
|
10769
|
+
return this;
|
|
10770
|
+
} // Websocket ping receive prober
|
|
10771
|
+
|
|
10772
|
+
|
|
10773
|
+
function WSPingReceiver(receiveProbes, probesInterval) {
|
|
10774
|
+
this.maxPings = receiveProbes || 0;
|
|
10775
|
+
this.interval = probesInterval || 0;
|
|
10776
|
+
this.intervalId = null;
|
|
10777
|
+
this.pingsMissing = 0;
|
|
10778
|
+
|
|
10779
|
+
this.start = function () {
|
|
10780
|
+
if (this.maxPings > 0 && this.interval > 0) {
|
|
10781
|
+
var receiver = this;
|
|
10782
|
+
this.intervalId = setInterval(function () {
|
|
10783
|
+
receiver.checkPingsReceived();
|
|
10784
|
+
}, this.interval);
|
|
10785
|
+
}
|
|
10786
|
+
};
|
|
10787
|
+
|
|
10788
|
+
this.stop = function () {
|
|
10789
|
+
if (this.intervalId) {
|
|
10790
|
+
clearInterval(this.intervalId);
|
|
10791
|
+
}
|
|
10792
|
+
|
|
10793
|
+
this.pingsMissing = 0;
|
|
10794
|
+
};
|
|
10795
|
+
|
|
10796
|
+
this.checkPingsReceived = function () {
|
|
10797
|
+
this.pingsMissing++;
|
|
10798
|
+
|
|
10799
|
+
if (this.pingsMissing >= this.maxPings) {
|
|
10800
|
+
this.failure();
|
|
10801
|
+
}
|
|
10802
|
+
};
|
|
10803
|
+
|
|
10804
|
+
this.success = function () {
|
|
10805
|
+
this.pingsMissing = 0;
|
|
10806
|
+
};
|
|
10807
|
+
|
|
10808
|
+
this.failure = function () {
|
|
10809
|
+
logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
|
|
10810
|
+
onSessionStatusChange(SESSION_STATUS.FAILED);
|
|
10811
|
+
wsConnection.close();
|
|
10812
|
+
};
|
|
10813
|
+
|
|
10814
|
+
return this;
|
|
10734
10815
|
}
|
|
10735
10816
|
/**
|
|
10736
10817
|
* @callback sdpHook
|