@flashphoner/websdk 2.0.218 → 2.0.219

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashphoner/websdk",
3
- "version": "2.0.218",
3
+ "version": "2.0.219",
4
4
  "description": "Official Flashphoner WebCallServer WebSDK package",
5
5
  "main": "./src/flashphoner-core.js",
6
6
  "types": "./src/flashphoner-core.d.ts",
package/src/constants.js CHANGED
@@ -147,12 +147,14 @@ const STREAM_STATUS = Object.freeze({
147
147
  */
148
148
  PLAYBACK_PROBLEM: 'PLAYBACK_PROBLEM',
149
149
  /**
150
+ * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
150
151
  * Fires if playing {@link Stream} picture resizing.
151
152
  * @event RESIZE
152
153
  * @memberof Flashphoner.constants.STREAM_STATUS
153
154
  */
154
155
  RESIZE: 'RESIZE',
155
156
  /**
157
+ * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
156
158
  * Fires when {@link Stream} snapshot becomes available.
157
159
  * Snapshot is base64 encoded png available through {@link Stream.getInfo}
158
160
  * @event SNAPSHOT_COMPLETE
@@ -160,6 +162,7 @@ const STREAM_STATUS = Object.freeze({
160
162
  */
161
163
  SNAPSHOT_COMPLETE: 'SNAPSHOT_COMPLETE',
162
164
  /**
165
+ * @deprecated WCS-3228 moved to {@link STREAM_EVENT_TYPE}
163
166
  * Fires on playing {@link Stream} if bitrate is higher than available network bandwidth.
164
167
  * @event NOT_ENOUGH_BANDWIDTH
165
168
  * @memberof Flashphoner.constants.NOT_ENOUGH_BANDWIDTH
@@ -775,7 +778,31 @@ const STREAM_EVENT_TYPE = Object.freeze({
775
778
  * @see Stream
776
779
  * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
777
780
  */
778
- DATA: 'data'
781
+ DATA: 'data',
782
+ /**
783
+ * Stream snapshot is completed
784
+ * @see Stream
785
+ * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
786
+ */
787
+ SNAPSHOT_COMPLETED: 'snapshotCompleted',
788
+ /**
789
+ * Stream snapshot is failed
790
+ * @see Stream
791
+ * @memberOf Flashphoner.constants.STREAM_EVENT_TYPE
792
+ */
793
+ SNAPSHOT_FAILED: 'snapshotFailed',
794
+ /**
795
+ * Fires if playing {@link Stream} picture resizing.
796
+ * @event RESIZE
797
+ * @memberof Flashphoner.constants.STREAM_STATUS
798
+ */
799
+ RESIZE: 'resize',
800
+ /**
801
+ * Fires on playing {@link Stream} if bitrate is higher than available network bandwidth.
802
+ * @event NOT_ENOUGH_BANDWIDTH
803
+ * @memberof Flashphoner.constants.NOT_ENOUGH_BANDWIDTH
804
+ */
805
+ NOT_ENOUGH_BANDWIDTH: 'notEnoughBandwidth'
779
806
  });
780
807
 
781
808
  /**
@@ -561,7 +561,7 @@ var createSession = function (options) {
561
561
  mediaProviders: Object.keys(MediaProvider),
562
562
  keepAlive: keepAlive,
563
563
  authToken:authToken,
564
- clientVersion: "2.0.218",
564
+ clientVersion: "2.0",
565
565
  clientOSVersion: window.navigator.appVersion,
566
566
  clientBrowserVersion: window.navigator.userAgent,
567
567
  msePacketizationVersion: 2,
@@ -1721,6 +1721,14 @@ var createSession = function (options) {
1721
1721
  var stream = {};
1722
1722
 
1723
1723
  streamEventRefreshHandlers[id_] = function (streamEvent) {
1724
+ if (streamEvent.type == STREAM_EVENT_TYPE.NOT_ENOUGH_BANDWIDTH) {
1725
+ var info = streamEvent.payload.info.split("/");
1726
+ remoteBitrate = info[0];
1727
+ networkBandwidth = info[1];
1728
+ } else if (streamEvent.type == STREAM_EVENT_TYPE.RESIZE) {
1729
+ resolution.width = streamEvent.payload.streamerVideoWidth;
1730
+ resolution.height = streamEvent.payload.streamerVideoHeight;
1731
+ }
1724
1732
  if (callbacks[STREAM_EVENT]) {
1725
1733
  callbacks[STREAM_EVENT](streamEvent);
1726
1734
  }
@@ -1757,6 +1765,7 @@ var createSession = function (options) {
1757
1765
  return;
1758
1766
  }
1759
1767
 
1768
+ //Depricated. WCS-3228: RESIZE, SNAPSHOT_COMPLETE and NOT_ENOUGH_BANDWIDTH moved to STREAM_EVENT
1760
1769
  if (event == STREAM_STATUS.RESIZE) {
1761
1770
  resolution.width = streamInfo.streamerVideoWidth;
1762
1771
  resolution.height = streamInfo.streamerVideoHeight;