@flashphoner/websdk 2.0.208 → 2.0.212

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.
Files changed (38) hide show
  1. package/docTemplate/README.md +1 -1
  2. package/examples/demo/streaming/2players/2players.js +0 -5
  3. package/examples/demo/streaming/canvas_streaming/canvas_streaming.js +0 -12
  4. package/examples/demo/streaming/conference/conference.html +6 -0
  5. package/examples/demo/streaming/conference/conference.js +83 -23
  6. package/examples/demo/streaming/embed_player/player.js +127 -198
  7. package/examples/demo/streaming/firewall-traversal-streaming/firewall-traversal-streaming.js +0 -12
  8. package/examples/demo/streaming/mcu_client/mcu_client.js +0 -8
  9. package/examples/demo/streaming/media_devices_manager/manager.js +0 -12
  10. package/examples/demo/streaming/player/player.js +10 -9
  11. package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.html +77 -1
  12. package/examples/demo/streaming/stream-auto-restore/stream-auto-restore.js +472 -84
  13. package/examples/demo/streaming/stream-diagnostic/stream-diagnostic.js +0 -8
  14. package/examples/demo/streaming/stream-local-snapshot/stream-local-snapshot.js +0 -6
  15. package/examples/demo/streaming/stream-snapshot/stream-snapshot.js +0 -6
  16. package/examples/demo/streaming/stream_recording/recording.js +0 -6
  17. package/examples/demo/streaming/streamer/streamer.js +0 -8
  18. package/examples/demo/streaming/two_way_streaming/two_way_streaming.js +0 -11
  19. package/examples/demo/streaming/webrtc-as-rtmp-republishing/webrtc-as-rtmp-republishing.js +0 -6
  20. package/flashphoner-no-flash.js +118 -14
  21. package/flashphoner-no-flash.min.js +2 -2
  22. package/flashphoner-no-webrtc.js +89 -5
  23. package/flashphoner-no-webrtc.min.js +1 -1
  24. package/flashphoner-no-wsplayer.js +118 -14
  25. package/flashphoner-no-wsplayer.min.js +2 -2
  26. package/flashphoner-room-api.js +104 -9
  27. package/flashphoner-room-api.min.js +2 -2
  28. package/flashphoner-temasys-flash-websocket-without-adapterjs.js +89 -5
  29. package/flashphoner-temasys-flash-websocket.js +89 -5
  30. package/flashphoner-temasys-flash-websocket.min.js +1 -1
  31. package/flashphoner-webrtc-only.js +118 -14
  32. package/flashphoner-webrtc-only.min.js +1 -1
  33. package/flashphoner.js +118 -14
  34. package/flashphoner.min.js +2 -2
  35. package/package.json +1 -1
  36. package/src/flashphoner-core.d.ts +22 -5
  37. package/src/flashphoner-core.js +79 -3
  38. package/src/webrtc-media-provider.js +25 -6
@@ -11487,6 +11487,9 @@ var getSession = function getSession(id) {
11487
11487
  * @param {Object=} options.sipOptions Sip configuration
11488
11488
  * @param {Object=} options.mediaOptions Media connection configuration
11489
11489
  * @param {Integer=} options.timeout Connection timeout in milliseconds
11490
+ * @param {Integer=} options.pingInterval Server ping interval in milliseconds [0]
11491
+ * @param {Integer=} options.receiveProbes A maximum subsequental pings received missing count [0]
11492
+ * @param {Integer=} options.probesInterval Interval to check subsequental pings received [0]
11490
11493
  * @returns {Session} Created session
11491
11494
  * @throws {Error} Error if API is not initialized
11492
11495
  * @throws {TypeError} Error if options.urlServer is not specified
@@ -11513,6 +11516,8 @@ var createSession = function createSession(options) {
11513
11516
  var mediaOptions = options.mediaOptions;
11514
11517
  var keepAlive = options.keepAlive;
11515
11518
  var timeout = options.timeout;
11519
+ var wsPingSender = new WSPingSender(options.pingInterval || 0);
11520
+ var wsPingReceiver = new WSPingReceiver(options.receiveProbes || 0, options.probesInterval || 0);
11516
11521
  var connectionTimeout;
11517
11522
  var cConfig; //SIP config
11518
11523
 
@@ -11630,7 +11635,7 @@ var createSession = function createSession(options) {
11630
11635
  mediaProviders: Object.keys(MediaProvider),
11631
11636
  keepAlive: keepAlive,
11632
11637
  authToken: authToken,
11633
- clientVersion: "2.0.208",
11638
+ clientVersion: "2.0.212",
11634
11639
  clientOSVersion: window.navigator.appVersion,
11635
11640
  clientBrowserVersion: window.navigator.userAgent,
11636
11641
  msePacketizationVersion: 2,
@@ -11643,7 +11648,11 @@ var createSession = function createSession(options) {
11643
11648
 
11644
11649
 
11645
11650
  send("connection", cConfig);
11646
- logger.setConnection(wsConnection);
11651
+ logger.setConnection(wsConnection); // Send ping messages to server to check if connection is still alive #WCS-3410
11652
+
11653
+ wsPingSender.start(); // Check subsequintel pings received from server to check if connection is still alive #WCS-3410
11654
+
11655
+ wsPingReceiver.start();
11647
11656
  };
11648
11657
 
11649
11658
  wsConnection.onmessage = function (event) {
@@ -11659,6 +11668,7 @@ var createSession = function createSession(options) {
11659
11668
  switch (data.message) {
11660
11669
  case 'ping':
11661
11670
  send("pong", null);
11671
+ wsPingReceiver.success();
11662
11672
  break;
11663
11673
 
11664
11674
  case 'getUserData':
@@ -11818,7 +11828,11 @@ var createSession = function createSession(options) {
11818
11828
  sessionStatus = newStatus;
11819
11829
 
11820
11830
  if (sessionStatus == SESSION_STATUS.DISCONNECTED || sessionStatus == SESSION_STATUS.FAILED) {
11821
- //remove streams
11831
+ // Stop pinging server #WCS-3410
11832
+ wsPingSender.stop(); // Stop checking pings received #WCS-3410
11833
+
11834
+ wsPingReceiver.stop(); //remove streams
11835
+
11822
11836
  for (var prop in streamRefreshHandlers) {
11823
11837
  if (streamRefreshHandlers.hasOwnProperty(prop) && typeof streamRefreshHandlers[prop] === 'function') {
11824
11838
  streamRefreshHandlers[prop]({
@@ -11834,6 +11848,73 @@ var createSession = function createSession(options) {
11834
11848
  if (callbacks[sessionStatus]) {
11835
11849
  callbacks[sessionStatus](session, obj);
11836
11850
  }
11851
+ } // Websocket periodic ping sender
11852
+
11853
+
11854
+ function WSPingSender(interval) {
11855
+ this.interval = interval || 0;
11856
+ this.intervalId = null;
11857
+
11858
+ this.start = function () {
11859
+ if (this.interval > 0) {
11860
+ this.intervalId = setInterval(function () {
11861
+ send("ping", null);
11862
+ }, this.interval);
11863
+ }
11864
+ };
11865
+
11866
+ this.stop = function () {
11867
+ if (this.intervalId) {
11868
+ clearInterval(this.intervalId);
11869
+ }
11870
+ };
11871
+
11872
+ return this;
11873
+ } // Websocket ping receive prober
11874
+
11875
+
11876
+ function WSPingReceiver(receiveProbes, probesInterval) {
11877
+ this.maxPings = receiveProbes || 0;
11878
+ this.interval = probesInterval || 0;
11879
+ this.intervalId = null;
11880
+ this.pingsMissing = 0;
11881
+
11882
+ this.start = function () {
11883
+ if (this.maxPings > 0 && this.interval > 0) {
11884
+ var receiver = this;
11885
+ this.intervalId = setInterval(function () {
11886
+ receiver.checkPingsReceived();
11887
+ }, this.interval);
11888
+ }
11889
+ };
11890
+
11891
+ this.stop = function () {
11892
+ if (this.intervalId) {
11893
+ clearInterval(this.intervalId);
11894
+ }
11895
+
11896
+ this.pingsMissing = 0;
11897
+ };
11898
+
11899
+ this.checkPingsReceived = function () {
11900
+ this.pingsMissing++;
11901
+
11902
+ if (this.pingsMissing >= this.maxPings) {
11903
+ this.failure();
11904
+ }
11905
+ };
11906
+
11907
+ this.success = function () {
11908
+ this.pingsMissing = 0;
11909
+ };
11910
+
11911
+ this.failure = function () {
11912
+ logger.info(LOG_PREFIX, "Missing " + this.pingsMissing + " pings from server, connection seems to be down");
11913
+ onSessionStatusChange(SESSION_STATUS.FAILED);
11914
+ wsConnection.close();
11915
+ };
11916
+
11917
+ return this;
11837
11918
  }
11838
11919
  /**
11839
11920
  * @callback sdpHook
@@ -12698,7 +12779,7 @@ var createSession = function createSession(options) {
12698
12779
  * @param {HTMLElement} options.display Div element stream should be displayed in
12699
12780
  * @param {Object=} options.custom User provided custom object that will be available in REST App code
12700
12781
  * @param {Integer} [options.flashBufferTime=0] Specifies how long to buffer messages before starting to display the stream (Flash-only)
12701
- * @param {String=} options.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
12782
+ * @param {string=} options.stripCodecs Comma separated string of codecs which should be stripped from WebRTC SDP (ex. "H264,PCMA,PCMU,G722")
12702
12783
  * @param {string=} options.rtmpUrl Rtmp url stream should be forwarded to
12703
12784
  * @param {Object=} options.mediaConnectionConstraints Stream specific constraints for underlying RTCPeerConnection
12704
12785
  * @param {Boolean=} options.flashShowFullScreenButton Show full screen button in flash
@@ -12707,6 +12788,7 @@ var createSession = function createSession(options) {
12707
12788
  * @param {Integer=} options.playoutDelay Time delay between network reception of media and playout
12708
12789
  * @param {string=} options.useCanvasMediaStream EXPERIMENTAL: when publish bind browser's media stream to the canvas. It can be useful for image filtering
12709
12790
  * @param {string=} options.videoContentHint Video content hint for browser ('detail' by default to maintain resolution), {@link Flashphoner.constants.CONTENT_HINT_TYPE}
12791
+ * @param {Boolean=} options.unmutePlayOnStart Unmute playback on start. May be used after user gesture only, so set 'unmutePlayOnStart: false' for autoplay
12710
12792
  * @param {sdpHook} sdpHook The callback that handles sdp from the server
12711
12793
  * @returns {Stream} Stream
12712
12794
  * @throws {TypeError} Error if no options provided
@@ -12818,6 +12900,7 @@ var createSession = function createSession(options) {
12818
12900
  var playoutDelay = options.playoutDelay;
12819
12901
  var useCanvasMediaStream = options.useCanvasMediaStream;
12820
12902
  var videoContentHint = options.videoContentHint;
12903
+ var unmutePlayOnStart = options.unmutePlayOnStart;
12821
12904
  var audioState_;
12822
12905
  var videoState_;
12823
12906
  var connectionQuality;
@@ -12994,7 +13077,8 @@ var createSession = function createSession(options) {
12994
13077
  connectionConstraints: mediaConnectionConstraints,
12995
13078
  audioOutputId: audioOutputId,
12996
13079
  remoteVideo: remoteVideo,
12997
- playoutDelay: playoutDelay
13080
+ playoutDelay: playoutDelay,
13081
+ unmutePlayOnStart: unmutePlayOnStart
12998
13082
  }, streamRefreshHandlers[id_]).then(function (newConnection) {
12999
13083
  mediaConnection = newConnection;
13000
13084