openvidu-browser 2.21.0-beta1 → 2.21.0

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 (242) hide show
  1. package/config/replace_for_ts44.sh +7 -0
  2. package/config/tsconfig.json +20 -0
  3. package/generate-docs.sh +1 -1
  4. package/lib/OpenVidu/Connection.d.ts +1 -1
  5. package/lib/OpenVidu/Connection.js +1 -1
  6. package/lib/OpenVidu/EventDispatcher.d.ts +8 -3
  7. package/lib/OpenVidu/EventDispatcher.js +18 -20
  8. package/lib/OpenVidu/EventDispatcher.js.map +1 -1
  9. package/lib/OpenVidu/Filter.js +11 -11
  10. package/lib/OpenVidu/Filter.js.map +1 -1
  11. package/lib/OpenVidu/LocalRecorder.d.ts +17 -7
  12. package/lib/OpenVidu/LocalRecorder.js +50 -47
  13. package/lib/OpenVidu/LocalRecorder.js.map +1 -1
  14. package/lib/OpenVidu/OpenVidu.d.ts +18 -4
  15. package/lib/OpenVidu/OpenVidu.js +143 -106
  16. package/lib/OpenVidu/OpenVidu.js.map +1 -1
  17. package/lib/OpenVidu/Publisher.d.ts +9 -14
  18. package/lib/OpenVidu/Publisher.js +59 -48
  19. package/lib/OpenVidu/Publisher.js.map +1 -1
  20. package/lib/OpenVidu/Session.d.ts +6 -29
  21. package/lib/OpenVidu/Session.js +93 -94
  22. package/lib/OpenVidu/Session.js.map +1 -1
  23. package/lib/OpenVidu/Stream.d.ts +2 -1
  24. package/lib/OpenVidu/Stream.js +80 -83
  25. package/lib/OpenVidu/Stream.js.map +1 -1
  26. package/lib/OpenVidu/StreamManager.d.ts +6 -15
  27. package/lib/OpenVidu/StreamManager.js +9 -32
  28. package/lib/OpenVidu/StreamManager.js.map +1 -1
  29. package/lib/OpenVidu/Subscriber.d.ts +1 -3
  30. package/lib/OpenVidu/Subscriber.js +4 -4
  31. package/lib/OpenVidu/Subscriber.js.map +1 -1
  32. package/lib/OpenViduInternal/Enums/LocalRecorderState.js +1 -1
  33. package/lib/OpenViduInternal/Enums/OpenViduError.js +1 -1
  34. package/lib/OpenViduInternal/Enums/TypeOfVideo.d.ts +6 -0
  35. package/lib/OpenViduInternal/Enums/TypeOfVideo.js +27 -0
  36. package/lib/OpenViduInternal/Enums/TypeOfVideo.js.map +1 -0
  37. package/lib/OpenViduInternal/Enums/VideoInsertMode.js +1 -1
  38. package/lib/OpenViduInternal/Events/ConnectionEvent.d.ts +3 -3
  39. package/lib/OpenViduInternal/Events/ConnectionEvent.js +6 -4
  40. package/lib/OpenViduInternal/Events/ConnectionEvent.js.map +1 -1
  41. package/lib/OpenViduInternal/Events/ConnectionPropertyChangedEvent.d.ts +2 -10
  42. package/lib/OpenViduInternal/Events/ConnectionPropertyChangedEvent.js +5 -11
  43. package/lib/OpenViduInternal/Events/ConnectionPropertyChangedEvent.js.map +1 -1
  44. package/lib/OpenViduInternal/Events/Event.js +1 -1
  45. package/lib/OpenViduInternal/Events/EventMap/EventMap.d.ts +5 -0
  46. package/lib/OpenViduInternal/Events/EventMap/EventMap.js +19 -0
  47. package/lib/OpenViduInternal/Events/EventMap/EventMap.js.map +1 -0
  48. package/lib/OpenViduInternal/Events/EventMap/PublisherEventMap.d.ts +47 -0
  49. package/lib/OpenViduInternal/Events/EventMap/PublisherEventMap.js +19 -0
  50. package/lib/OpenViduInternal/Events/EventMap/PublisherEventMap.js.map +1 -0
  51. package/lib/OpenViduInternal/Events/EventMap/SessionEventMap.d.ts +139 -0
  52. package/lib/OpenViduInternal/Events/EventMap/SessionEventMap.js +19 -0
  53. package/lib/OpenViduInternal/Events/EventMap/SessionEventMap.js.map +1 -0
  54. package/lib/OpenViduInternal/Events/EventMap/StreamManagerEventMap.d.ts +56 -0
  55. package/lib/OpenViduInternal/Events/EventMap/StreamManagerEventMap.js +19 -0
  56. package/lib/OpenViduInternal/Events/EventMap/StreamManagerEventMap.js.map +1 -0
  57. package/lib/OpenViduInternal/Events/ExceptionEvent.d.ts +1 -4
  58. package/lib/OpenViduInternal/Events/ExceptionEvent.js +4 -5
  59. package/lib/OpenViduInternal/Events/ExceptionEvent.js.map +1 -1
  60. package/lib/OpenViduInternal/Events/FilterEvent.js +3 -1
  61. package/lib/OpenViduInternal/Events/FilterEvent.js.map +1 -1
  62. package/lib/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.d.ts +1 -4
  63. package/lib/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.js +4 -5
  64. package/lib/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.js.map +1 -1
  65. package/lib/OpenViduInternal/Events/PublisherSpeakingEvent.d.ts +3 -7
  66. package/lib/OpenViduInternal/Events/PublisherSpeakingEvent.js +6 -8
  67. package/lib/OpenViduInternal/Events/PublisherSpeakingEvent.js.map +1 -1
  68. package/lib/OpenViduInternal/Events/RecordingEvent.d.ts +3 -3
  69. package/lib/OpenViduInternal/Events/RecordingEvent.js +6 -4
  70. package/lib/OpenViduInternal/Events/RecordingEvent.js.map +1 -1
  71. package/lib/OpenViduInternal/Events/SessionDisconnectedEvent.d.ts +1 -1
  72. package/lib/OpenViduInternal/Events/SessionDisconnectedEvent.js +4 -2
  73. package/lib/OpenViduInternal/Events/SessionDisconnectedEvent.js.map +1 -1
  74. package/lib/OpenViduInternal/Events/SignalEvent.d.ts +1 -3
  75. package/lib/OpenViduInternal/Events/SignalEvent.js +4 -4
  76. package/lib/OpenViduInternal/Events/SignalEvent.js.map +1 -1
  77. package/lib/OpenViduInternal/Events/StreamEvent.d.ts +3 -3
  78. package/lib/OpenViduInternal/Events/StreamEvent.js +6 -4
  79. package/lib/OpenViduInternal/Events/StreamEvent.js.map +1 -1
  80. package/lib/OpenViduInternal/Events/StreamManagerEvent.d.ts +3 -9
  81. package/lib/OpenViduInternal/Events/StreamManagerEvent.js +6 -10
  82. package/lib/OpenViduInternal/Events/StreamManagerEvent.js.map +1 -1
  83. package/lib/OpenViduInternal/Events/StreamPropertyChangedEvent.d.ts +1 -3
  84. package/lib/OpenViduInternal/Events/StreamPropertyChangedEvent.js +4 -4
  85. package/lib/OpenViduInternal/Events/StreamPropertyChangedEvent.js.map +1 -1
  86. package/lib/OpenViduInternal/Events/VideoElementEvent.d.ts +3 -4
  87. package/lib/OpenViduInternal/Events/VideoElementEvent.js +6 -5
  88. package/lib/OpenViduInternal/Events/VideoElementEvent.js.map +1 -1
  89. package/lib/OpenViduInternal/Interfaces/Private/CustomMediaStreamConstraints.js +1 -1
  90. package/lib/OpenViduInternal/Interfaces/Private/IceServerProperties.d.ts +5 -0
  91. package/lib/OpenViduInternal/Interfaces/Private/IceServerProperties.js +3 -0
  92. package/lib/OpenViduInternal/Interfaces/Private/IceServerProperties.js.map +1 -0
  93. package/lib/OpenViduInternal/Interfaces/Private/InboundStreamOptions.d.ts +2 -1
  94. package/lib/OpenViduInternal/Interfaces/Private/InboundStreamOptions.js +1 -1
  95. package/lib/OpenViduInternal/Interfaces/Private/LocalConnectionOptions.d.ts +3 -0
  96. package/lib/OpenViduInternal/Interfaces/Private/LocalConnectionOptions.js +1 -1
  97. package/lib/OpenViduInternal/Interfaces/Private/OutboundStreamOptions.js +1 -1
  98. package/lib/OpenViduInternal/Interfaces/Private/RemoteConnectionOptions.js +1 -1
  99. package/lib/OpenViduInternal/Interfaces/Private/SessionOptions.js +1 -1
  100. package/lib/OpenViduInternal/Interfaces/Private/StreamOptionsServer.d.ts +2 -1
  101. package/lib/OpenViduInternal/Interfaces/Private/StreamOptionsServer.js +1 -1
  102. package/lib/OpenViduInternal/Interfaces/Public/Capabilities.js +1 -1
  103. package/lib/OpenViduInternal/Interfaces/Public/Device.js +1 -1
  104. package/lib/OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration.d.ts +3 -9
  105. package/lib/OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration.js +1 -1
  106. package/lib/OpenViduInternal/Interfaces/Public/PublisherProperties.d.ts +9 -0
  107. package/lib/OpenViduInternal/Interfaces/Public/PublisherProperties.js +1 -1
  108. package/lib/OpenViduInternal/Interfaces/Public/SignalOptions.js +1 -1
  109. package/lib/OpenViduInternal/Interfaces/Public/StreamManagerVideo.js +1 -1
  110. package/lib/OpenViduInternal/Interfaces/Public/SubscriberProperties.js +1 -1
  111. package/lib/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/jsonrpcclient.js +0 -3
  112. package/lib/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/jsonrpcclient.js.map +1 -1
  113. package/lib/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js +11 -6
  114. package/lib/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js.map +1 -1
  115. package/lib/OpenViduInternal/Logger/OpenViduLogger.js +13 -15
  116. package/lib/OpenViduInternal/Logger/OpenViduLogger.js.map +1 -1
  117. package/lib/OpenViduInternal/Utils/Platform.js.map +1 -1
  118. package/lib/OpenViduInternal/WebRtcPeer/WebRtcPeer.d.ts +5 -2
  119. package/lib/OpenViduInternal/WebRtcPeer/WebRtcPeer.js +187 -151
  120. package/lib/OpenViduInternal/WebRtcPeer/WebRtcPeer.js.map +1 -1
  121. package/lib/OpenViduInternal/WebRtcStats/WebRtcStats.js +6 -7
  122. package/lib/OpenViduInternal/WebRtcStats/WebRtcStats.js.map +1 -1
  123. package/lib/index.d.ts +7 -2
  124. package/lib/index.js +5 -1
  125. package/lib/index.js.map +1 -1
  126. package/package.json +19 -8
  127. package/src/OpenVidu/Connection.ts +4 -4
  128. package/src/OpenVidu/EventDispatcher.ts +23 -16
  129. package/src/OpenVidu/Filter.ts +11 -11
  130. package/src/OpenVidu/LocalRecorder.ts +52 -54
  131. package/src/OpenVidu/OpenVidu.ts +151 -110
  132. package/src/OpenVidu/Publisher.ts +67 -53
  133. package/src/OpenVidu/Session.ts +91 -97
  134. package/src/OpenVidu/Stream.ts +64 -67
  135. package/src/OpenVidu/StreamManager.ts +12 -35
  136. package/src/OpenVidu/Subscriber.ts +2 -4
  137. package/src/OpenViduInternal/Enums/LocalRecorderState.ts +1 -1
  138. package/src/OpenViduInternal/Enums/OpenViduError.ts +1 -1
  139. package/src/OpenViduInternal/Enums/TypeOfVideo.ts +23 -0
  140. package/src/OpenViduInternal/Enums/VideoInsertMode.ts +1 -1
  141. package/src/OpenViduInternal/Events/ConnectionEvent.ts +4 -4
  142. package/src/OpenViduInternal/Events/ConnectionPropertyChangedEvent.ts +5 -13
  143. package/src/OpenViduInternal/Events/Event.ts +1 -1
  144. package/src/OpenViduInternal/Events/EventMap/EventMap.ts +21 -0
  145. package/src/OpenViduInternal/Events/EventMap/PublisherEventMap.ts +71 -0
  146. package/src/OpenViduInternal/Events/EventMap/SessionEventMap.ts +174 -0
  147. package/src/OpenViduInternal/Events/EventMap/StreamManagerEventMap.ts +81 -0
  148. package/src/OpenViduInternal/Events/ExceptionEvent.ts +2 -5
  149. package/src/OpenViduInternal/Events/FilterEvent.ts +1 -1
  150. package/src/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.ts +2 -5
  151. package/src/OpenViduInternal/Events/PublisherSpeakingEvent.ts +4 -8
  152. package/src/OpenViduInternal/Events/RecordingEvent.ts +4 -4
  153. package/src/OpenViduInternal/Events/SessionDisconnectedEvent.ts +2 -2
  154. package/src/OpenViduInternal/Events/SignalEvent.ts +2 -4
  155. package/src/OpenViduInternal/Events/StreamEvent.ts +4 -4
  156. package/src/OpenViduInternal/Events/StreamManagerEvent.ts +4 -10
  157. package/src/OpenViduInternal/Events/StreamPropertyChangedEvent.ts +2 -4
  158. package/src/OpenViduInternal/Events/VideoElementEvent.ts +4 -5
  159. package/src/OpenViduInternal/Interfaces/Private/CustomMediaStreamConstraints.ts +1 -1
  160. package/src/OpenViduInternal/Interfaces/Private/IceServerProperties.ts +21 -0
  161. package/src/OpenViduInternal/Interfaces/Private/InboundStreamOptions.ts +3 -2
  162. package/src/OpenViduInternal/Interfaces/Private/LocalConnectionOptions.ts +5 -2
  163. package/src/OpenViduInternal/Interfaces/Private/OutboundStreamOptions.ts +1 -1
  164. package/src/OpenViduInternal/Interfaces/Private/RemoteConnectionOptions.ts +1 -1
  165. package/src/OpenViduInternal/Interfaces/Private/SessionOptions.ts +1 -1
  166. package/src/OpenViduInternal/Interfaces/Private/SignalOptions.ts +1 -1
  167. package/src/OpenViduInternal/Interfaces/Private/StreamOptionsServer.ts +3 -2
  168. package/src/OpenViduInternal/Interfaces/Public/Capabilities.ts +1 -1
  169. package/src/OpenViduInternal/Interfaces/Public/Device.ts +1 -1
  170. package/src/OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration.ts +5 -12
  171. package/src/OpenViduInternal/Interfaces/Public/PublisherProperties.ts +12 -2
  172. package/src/OpenViduInternal/Interfaces/Public/SignalOptions.ts +1 -1
  173. package/src/OpenViduInternal/Interfaces/Public/StreamManagerVideo.ts +1 -1
  174. package/src/OpenViduInternal/Interfaces/Public/SubscriberProperties.ts +1 -1
  175. package/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/jsonrpcclient.js +0 -5
  176. package/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/clients/transports/webSocketWithReconnection.js +13 -7
  177. package/src/OpenViduInternal/Logger/OpenViduLogger.ts +1 -3
  178. package/src/OpenViduInternal/Utils/Platform.ts +1 -1
  179. package/src/OpenViduInternal/WebRtcPeer/WebRtcPeer.ts +233 -177
  180. package/src/OpenViduInternal/WebRtcStats/WebRtcStats.ts +2 -2
  181. package/src/index.ts +8 -2
  182. package/static/js/openvidu-browser-2.21.0.js +13140 -0
  183. package/static/js/openvidu-browser-2.21.0.min.js +1 -0
  184. package/static/js/openvidu-browser-2.21.0.min.js.map +1 -0
  185. package/ts4.4/lib/OpenVidu/Connection.d.ts +84 -0
  186. package/ts4.4/lib/OpenVidu/EventDispatcher.d.ts +43 -0
  187. package/ts4.4/lib/OpenVidu/Filter.d.ts +73 -0
  188. package/ts4.4/lib/OpenVidu/LocalRecorder.d.ts +97 -0
  189. package/ts4.4/lib/OpenVidu/OpenVidu.d.ts +256 -0
  190. package/ts4.4/lib/OpenVidu/Publisher.d.ts +138 -0
  191. package/ts4.4/lib/OpenVidu/Session.d.ts +381 -0
  192. package/ts4.4/lib/OpenVidu/Stream.d.ts +372 -0
  193. package/ts4.4/lib/OpenVidu/StreamManager.d.ts +154 -0
  194. package/ts4.4/lib/OpenVidu/Subscriber.d.ts +28 -0
  195. package/ts4.4/lib/OpenViduInternal/Enums/LocalRecorderState.d.ts +6 -0
  196. package/ts4.4/lib/OpenViduInternal/Enums/OpenViduError.d.ts +99 -0
  197. package/ts4.4/lib/OpenViduInternal/Enums/TypeOfVideo.d.ts +6 -0
  198. package/ts4.4/lib/OpenViduInternal/Enums/VideoInsertMode.d.ts +25 -0
  199. package/ts4.4/lib/OpenViduInternal/Events/ConnectionEvent.d.ts +34 -0
  200. package/ts4.4/lib/OpenViduInternal/Events/ConnectionPropertyChangedEvent.d.ts +34 -0
  201. package/ts4.4/lib/OpenViduInternal/Events/Event.d.ts +48 -0
  202. package/ts4.4/lib/OpenViduInternal/Events/EventMap/EventMap.d.ts +5 -0
  203. package/ts4.4/lib/OpenViduInternal/Events/EventMap/PublisherEventMap.d.ts +47 -0
  204. package/ts4.4/lib/OpenViduInternal/Events/EventMap/SessionEventMap.d.ts +138 -0
  205. package/ts4.4/lib/OpenViduInternal/Events/EventMap/StreamManagerEventMap.d.ts +56 -0
  206. package/ts4.4/lib/OpenViduInternal/Events/ExceptionEvent.d.ts +93 -0
  207. package/ts4.4/lib/OpenViduInternal/Events/FilterEvent.d.ts +19 -0
  208. package/ts4.4/lib/OpenViduInternal/Events/NetworkQualityLevelChangedEvent.d.ts +28 -0
  209. package/ts4.4/lib/OpenViduInternal/Events/PublisherSpeakingEvent.d.ts +27 -0
  210. package/ts4.4/lib/OpenViduInternal/Events/RecordingEvent.d.ts +40 -0
  211. package/ts4.4/lib/OpenViduInternal/Events/SessionDisconnectedEvent.d.ts +28 -0
  212. package/ts4.4/lib/OpenViduInternal/Events/SignalEvent.d.ts +34 -0
  213. package/ts4.4/lib/OpenViduInternal/Events/StreamEvent.d.ts +38 -0
  214. package/ts4.4/lib/OpenViduInternal/Events/StreamManagerEvent.d.ts +25 -0
  215. package/ts4.4/lib/OpenViduInternal/Events/StreamPropertyChangedEvent.d.ts +41 -0
  216. package/ts4.4/lib/OpenViduInternal/Events/VideoElementEvent.d.ts +21 -0
  217. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/CustomMediaStreamConstraints.d.ts +5 -0
  218. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/IceServerProperties.d.ts +5 -0
  219. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/InboundStreamOptions.d.ts +19 -0
  220. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/LocalConnectionOptions.d.ts +22 -0
  221. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/OutboundStreamOptions.d.ts +5 -0
  222. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/RemoteConnectionOptions.d.ts +7 -0
  223. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/SessionOptions.d.ts +5 -0
  224. package/ts4.4/lib/OpenViduInternal/Interfaces/Private/StreamOptionsServer.d.ts +14 -0
  225. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/Capabilities.d.ts +21 -0
  226. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/Device.d.ts +17 -0
  227. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/OpenViduAdvancedConfiguration.d.ts +50 -0
  228. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/PublisherProperties.d.ts +73 -0
  229. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/SignalOptions.d.ts +20 -0
  230. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/StreamManagerVideo.d.ts +35 -0
  231. package/ts4.4/lib/OpenViduInternal/Interfaces/Public/SubscriberProperties.d.ts +21 -0
  232. package/ts4.4/lib/OpenViduInternal/Logger/ConsoleLogger.d.ts +29 -0
  233. package/ts4.4/lib/OpenViduInternal/Logger/OpenViduLogger.d.ts +52 -0
  234. package/ts4.4/lib/OpenViduInternal/Logger/OpenViduLoggerConfiguration.d.ts +5 -0
  235. package/ts4.4/lib/OpenViduInternal/Utils/Platform.d.ts +98 -0
  236. package/ts4.4/lib/OpenViduInternal/WebRtcPeer/WebRtcPeer.d.ts +81 -0
  237. package/ts4.4/lib/OpenViduInternal/WebRtcStats/WebRtcStats.d.ts +70 -0
  238. package/ts4.4/lib/index.d.ts +39 -0
  239. package/config/typedoc.js +0 -30
  240. package/static/js/openvidu-browser-2.21.0-beta1.js +0 -12185
  241. package/static/js/openvidu-browser-2.21.0-beta1.min.js +0 -1
  242. package/static/js/openvidu-browser-2.21.0-beta1.min.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * (C) Copyright 2017-2020 OpenVidu (https://openvidu.io)
3
+ * (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@ var __extends = (this && this.__extends) || (function () {
23
23
  return extendStatics(d, b);
24
24
  };
25
25
  return function (d, b) {
26
+ if (typeof b !== "function" && b !== null)
27
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
28
  extendStatics(d, b);
27
29
  function __() { this.constructor = d; }
28
30
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -83,6 +85,14 @@ var OpenViduError_1 = require("../OpenViduInternal/Enums/OpenViduError");
83
85
  var VideoInsertMode_1 = require("../OpenViduInternal/Enums/VideoInsertMode");
84
86
  var OpenViduLogger_1 = require("../OpenViduInternal/Logger/OpenViduLogger");
85
87
  var Platform_1 = require("../OpenViduInternal/Utils/Platform");
88
+ /**
89
+ * @hidden
90
+ */
91
+ var semverMajor = require("semver/functions/major");
92
+ /**
93
+ * @hidden
94
+ */
95
+ var semverMinor = require("semver/functions/minor");
86
96
  /**
87
97
  * @hidden
88
98
  */
@@ -96,24 +106,7 @@ var platform;
96
106
  * Participants who publish their videos to a session can be seen by the rest of users connected to that specific session.
97
107
  * Initialized with [[OpenVidu.initSession]] method.
98
108
  *
99
- * ### Available event listeners (and events dispatched)
100
- *
101
- * - connectionCreated ([[ConnectionEvent]])
102
- * - connectionDestroyed ([[ConnectionEvent]])
103
- * - connectionPropertyChanged ([[ConnectionPropertyChangedEvent]]) <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
104
- * - sessionDisconnected ([[SessionDisconnectedEvent]])
105
- * - streamCreated ([[StreamEvent]])
106
- * - streamDestroyed ([[StreamEvent]])
107
- * - streamPropertyChanged ([[StreamPropertyChangedEvent]])
108
- * - publisherStartSpeaking ([[PublisherSpeakingEvent]])
109
- * - publisherStopSpeaking ([[PublisherSpeakingEvent]])
110
- * - signal ([[SignalEvent]])
111
- * - recordingStarted ([[RecordingEvent]])
112
- * - recordingStopped ([[RecordingEvent]])
113
- * - networkQualityLevelChanged ([[NetworkQualityLevelChangedEvent]])
114
- * - reconnecting
115
- * - reconnected
116
- * - exception ([[ExceptionEvent]])
109
+ * See available event listeners at [[SessionEventMap]].
117
110
  */
118
111
  var Session = /** @class */ (function (_super) {
119
112
  __extends(Session, _super);
@@ -177,14 +170,12 @@ var Session = /** @class */ (function (_super) {
177
170
  participantId: token,
178
171
  metadata: !!metadata ? _this.stringClientMetadata(metadata) : ''
179
172
  };
180
- _this.connectAux(token).then(function () {
181
- resolve();
182
- }).catch(function (error) {
183
- reject(error);
184
- });
173
+ _this.connectAux(token)
174
+ .then(function () { return resolve(); })
175
+ .catch(function (error) { return reject(error); });
185
176
  }
186
177
  else {
187
- reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.BROWSER_NOT_SUPPORTED, 'Browser ' + platform.getName() + ' (version ' + platform.getVersion() + ') for ' + platform.getFamily() + ' is not supported in OpenVidu'));
178
+ return reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.BROWSER_NOT_SUPPORTED, 'Browser ' + platform.getName() + ' (version ' + platform.getVersion() + ') for ' + platform.getFamily() + ' is not supported in OpenVidu'));
188
179
  }
189
180
  });
190
181
  };
@@ -285,15 +276,15 @@ var Session = /** @class */ (function (_super) {
285
276
  var _this = this;
286
277
  return new Promise(function (resolve, reject) {
287
278
  if (!_this.sessionConnected()) {
288
- reject(_this.notConnectedError());
279
+ return reject(_this.notConnectedError());
289
280
  }
290
281
  var subscriber;
291
282
  var callback = function (error) {
292
283
  if (!!error) {
293
- reject(error);
284
+ return reject(error);
294
285
  }
295
286
  else {
296
- resolve(subscriber);
287
+ return resolve(subscriber);
297
288
  }
298
289
  };
299
290
  if (!!properties) {
@@ -318,7 +309,7 @@ var Session = /** @class */ (function (_super) {
318
309
  var _this = this;
319
310
  return new Promise(function (resolve, reject) {
320
311
  if (!_this.sessionConnected()) {
321
- reject(_this.notConnectedError());
312
+ return reject(_this.notConnectedError());
322
313
  }
323
314
  else {
324
315
  var connectionId_1 = subscriber.stream.connection.connectionId;
@@ -326,14 +317,14 @@ var Session = /** @class */ (function (_super) {
326
317
  _this.openvidu.sendRequest('unsubscribeFromVideo', { sender: subscriber.stream.connection.connectionId }, function (error, response) {
327
318
  if (error) {
328
319
  logger.error('Error unsubscribing from ' + connectionId_1);
329
- reject(error);
320
+ return reject(error);
330
321
  }
331
322
  else {
332
323
  logger.info('Unsubscribed correctly from ' + connectionId_1);
333
324
  subscriber.stream.streamManager.removeAllVideos();
334
325
  subscriber.stream.disposeWebRtcPeer();
335
326
  subscriber.stream.disposeMediaStream();
336
- resolve();
327
+ return resolve();
337
328
  }
338
329
  });
339
330
  }
@@ -356,7 +347,7 @@ var Session = /** @class */ (function (_super) {
356
347
  var _this = this;
357
348
  return new Promise(function (resolve, reject) {
358
349
  if (!_this.sessionConnected()) {
359
- reject(_this.notConnectedError());
350
+ return reject(_this.notConnectedError());
360
351
  }
361
352
  publisher.session = _this;
362
353
  publisher.stream.session = _this;
@@ -366,11 +357,9 @@ var Session = /** @class */ (function (_super) {
366
357
  publisher.stream.publish()
367
358
  .then(function () {
368
359
  _this.sendVideoData(publisher, 8, true, 5);
369
- resolve();
360
+ return resolve();
370
361
  })
371
- .catch(function (error) {
372
- reject(error);
373
- });
362
+ .catch(function (error) { return reject(error); });
374
363
  }
375
364
  else {
376
365
  // 'Session.unpublish(Publisher)' has been called. Must initialize again Publisher
@@ -381,14 +370,10 @@ var Session = /** @class */ (function (_super) {
381
370
  publisher.stream.publish()
382
371
  .then(function () {
383
372
  _this.sendVideoData(publisher, 8, true, 5);
384
- resolve();
373
+ return resolve();
385
374
  })
386
- .catch(function (error) {
387
- reject(error);
388
- });
389
- }).catch(function (error) {
390
- reject(error);
391
- });
375
+ .catch(function (error) { return reject(error); });
376
+ }).catch(function (error) { return reject(error); });
392
377
  }
393
378
  });
394
379
  };
@@ -419,17 +404,17 @@ var Session = /** @class */ (function (_super) {
419
404
  }
420
405
  var stream = publisher.stream;
421
406
  if (!stream.connection) {
422
- reject(new Error('The associated Connection object of this Publisher is null'));
407
+ return reject(new Error('The associated Connection object of this Publisher is null'));
423
408
  }
424
409
  else if (stream.connection !== _this.connection) {
425
- reject(new Error('The associated Connection object of this Publisher is not your local Connection.' +
410
+ return reject(new Error('The associated Connection object of this Publisher is not your local Connection.' +
426
411
  "Only moderators can force unpublish on remote Streams via 'forceUnpublish' method"));
427
412
  }
428
413
  else {
429
414
  logger.info('Unpublishing local media (' + stream.connection.connectionId + ')');
430
415
  _this.openvidu.sendRequest('unpublishVideo', function (error, response) {
431
416
  if (error) {
432
- reject(error);
417
+ return reject(error);
433
418
  }
434
419
  else {
435
420
  logger.info('Media unpublished correctly');
@@ -441,7 +426,7 @@ var Session = /** @class */ (function (_super) {
441
426
  var streamEvent = new StreamEvent_1.StreamEvent(true, publisher, 'streamDestroyed', publisher.stream, 'unpublish');
442
427
  publisher.emitEvent('streamDestroyed', [streamEvent]);
443
428
  streamEvent.callDefaultBehavior();
444
- resolve();
429
+ return resolve();
445
430
  }
446
431
  });
447
432
  }
@@ -468,22 +453,22 @@ var Session = /** @class */ (function (_super) {
468
453
  var _this = this;
469
454
  return new Promise(function (resolve, reject) {
470
455
  if (!_this.sessionConnected()) {
471
- reject(_this.notConnectedError());
456
+ return reject(_this.notConnectedError());
472
457
  }
473
458
  logger.info('Forcing disconnect for connection ' + connection.connectionId);
474
459
  _this.openvidu.sendRequest('forceDisconnect', { connectionId: connection.connectionId }, function (error, response) {
475
460
  if (error) {
476
461
  logger.error('Error forcing disconnect for Connection ' + connection.connectionId, error);
477
462
  if (error.code === 401) {
478
- reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to force a disconnection"));
463
+ return reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to force a disconnection"));
479
464
  }
480
465
  else {
481
- reject(error);
466
+ return reject(error);
482
467
  }
483
468
  }
484
469
  else {
485
470
  logger.info('Forcing disconnect correctly for Connection ' + connection.connectionId);
486
- resolve();
471
+ return resolve();
487
472
  }
488
473
  });
489
474
  });
@@ -507,22 +492,22 @@ var Session = /** @class */ (function (_super) {
507
492
  var _this = this;
508
493
  return new Promise(function (resolve, reject) {
509
494
  if (!_this.sessionConnected()) {
510
- reject(_this.notConnectedError());
495
+ return reject(_this.notConnectedError());
511
496
  }
512
497
  logger.info('Forcing unpublish for stream ' + stream.streamId);
513
498
  _this.openvidu.sendRequest('forceUnpublish', { streamId: stream.streamId }, function (error, response) {
514
499
  if (error) {
515
500
  logger.error('Error forcing unpublish for Stream ' + stream.streamId, error);
516
501
  if (error.code === 401) {
517
- reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to force an unpublishing"));
502
+ return reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.OPENVIDU_PERMISSION_DENIED, "You don't have permissions to force an unpublishing"));
518
503
  }
519
504
  else {
520
- reject(error);
505
+ return reject(error);
521
506
  }
522
507
  }
523
508
  else {
524
509
  logger.info('Forcing unpublish correctly for Stream ' + stream.streamId);
525
- resolve();
510
+ return resolve();
526
511
  }
527
512
  });
528
513
  });
@@ -543,7 +528,7 @@ var Session = /** @class */ (function (_super) {
543
528
  var _this = this;
544
529
  return new Promise(function (resolve, reject) {
545
530
  if (!_this.sessionConnected()) {
546
- reject(_this.notConnectedError());
531
+ return reject(_this.notConnectedError());
547
532
  }
548
533
  var signalMessage = {};
549
534
  if (signal.to && signal.to.length > 0) {
@@ -570,10 +555,10 @@ var Session = /** @class */ (function (_super) {
570
555
  message: JSON.stringify(signalMessage)
571
556
  }, function (error, response) {
572
557
  if (!!error) {
573
- reject(error);
558
+ return reject(error);
574
559
  }
575
560
  else {
576
- resolve();
561
+ return resolve();
577
562
  }
578
563
  });
579
564
  });
@@ -653,7 +638,7 @@ var Session = /** @class */ (function (_super) {
653
638
  Session.prototype.off = function (type, handler) {
654
639
  var _this = this;
655
640
  var _a, _b, _c, _d;
656
- _super.prototype.off.call(this, type, handler);
641
+ _super.prototype.offAux.call(this, type, handler);
657
642
  if (type === 'publisherStartSpeaking') {
658
643
  // Check if Session object still has some listener for the event
659
644
  if (!this.anySpeechEventListenerEnabled('publisherStartSpeaking', false)) {
@@ -937,28 +922,19 @@ var Session = /** @class */ (function (_super) {
937
922
  * @hidden
938
923
  */
939
924
  Session.prototype.recvIceCandidate = function (event) {
940
- var candidate = {
925
+ // The event contains fields that can be used to obtain a proper candidate,
926
+ // using the RTCIceCandidate constructor:
927
+ // https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-constructor
928
+ var candidateInit = {
941
929
  candidate: event.candidate,
942
- sdpMid: event.sdpMid,
943
930
  sdpMLineIndex: event.sdpMLineIndex,
944
- component: null,
945
- foundation: null,
946
- port: null,
947
- priority: null,
948
- protocol: null,
949
- relatedAddress: null,
950
- relatedPort: null,
951
- tcpType: null,
952
- usernameFragment: null,
953
- type: null,
954
- toJSON: function () {
955
- return { candidate: event.candidate };
956
- }
931
+ sdpMid: event.sdpMid,
957
932
  };
958
- this.getConnection(event.senderConnectionId, 'Connection not found for connectionId ' + event.senderConnectionId + ' owning endpoint ' + event.endpointName + '. Ice candidate will be ignored: ' + candidate)
933
+ var iceCandidate = new RTCIceCandidate(candidateInit);
934
+ this.getConnection(event.senderConnectionId, 'Connection not found for connectionId ' + event.senderConnectionId + ' owning endpoint ' + event.endpointName + '. Ice candidate will be ignored: ' + iceCandidate)
959
935
  .then(function (connection) {
960
936
  var stream = connection.stream;
961
- stream.getWebRtcPeer().addIceCandidate(candidate).catch(function (error) {
937
+ stream.getWebRtcPeer().addIceCandidate(iceCandidate).catch(function (error) {
962
938
  logger.error('Error adding candidate for ' + stream.streamId
963
939
  + ' stream of endpoint ' + event.endpointName + ': ' + error);
964
940
  });
@@ -1058,7 +1034,7 @@ var Session = /** @class */ (function (_super) {
1058
1034
  // of the subscriber was already taking place. Always use the last one to retry the re-subscription
1059
1035
  // process, as that SDP offer will be the only one available at the server side. Ignore previous ones
1060
1036
  stream_1.reconnectionEventEmitter['onForciblyReconnectSubscriberLastEvent'] = event;
1061
- reject('Ongoing forced subscriber reconnection');
1037
+ return reject('Ongoing forced subscriber reconnection');
1062
1038
  }
1063
1039
  else {
1064
1040
  // One onForciblyReconnectSubscriber even has been received while a reconnection process
@@ -1081,17 +1057,17 @@ var Session = /** @class */ (function (_super) {
1081
1057
  }
1082
1058
  stream_1.completeWebRtcPeerReceive(true, true, event.sdpOffer)
1083
1059
  .then(function () { return stream_1.finalResolveForSubscription(true, resolve); })
1084
- .catch(function (error) { return stream_1.finalRejectForSubscription(true, "Error while forcibly reconnecting remote stream " + event.streamId + ": " + error.toString(), reject); });
1060
+ .catch(function (error) { return stream_1.finalRejectForSubscription(true, "Error while forcibly reconnecting remote stream ".concat(event.streamId, ": ").concat(error.toString()), reject); });
1085
1061
  }
1086
1062
  else {
1087
1063
  var errMsg = "No stream with streamId '" + event.streamId + "' found for connection '" + event.connectionId + "' on 'streamPropertyChanged' event";
1088
1064
  logger.error(errMsg);
1089
- reject(errMsg);
1065
+ return reject(errMsg);
1090
1066
  }
1091
1067
  })
1092
1068
  .catch(function (openViduError) {
1093
1069
  logger.error(openViduError);
1094
- reject(openViduError);
1070
+ return reject(openViduError);
1095
1071
  });
1096
1072
  });
1097
1073
  };
@@ -1137,7 +1113,7 @@ var Session = /** @class */ (function (_super) {
1137
1113
  if (!this.connection.disposed && !forced) {
1138
1114
  this.openvidu.sendRequest('leaveRoom', function (error, response) {
1139
1115
  if (error) {
1140
- logger.error("leaveRoom error: " + JSON.stringify(error));
1116
+ logger.error("leaveRoom error: ".concat(JSON.stringify(error)));
1141
1117
  }
1142
1118
  _this.openvidu.closeWs();
1143
1119
  });
@@ -1166,6 +1142,7 @@ var Session = /** @class */ (function (_super) {
1166
1142
  token: (!!token) ? token : '',
1167
1143
  session: this.sessionId,
1168
1144
  platform: !!platform.getDescription() ? platform.getDescription() : 'unknown',
1145
+ sdkVersion: this.openvidu.libraryVersion,
1169
1146
  metadata: !!this.options.metadata ? this.options.metadata : '',
1170
1147
  secret: this.openvidu.getSecret(),
1171
1148
  recorder: this.openvidu.getRecorder()
@@ -1290,13 +1267,13 @@ var Session = /** @class */ (function (_super) {
1290
1267
  return new Promise(function (resolve, reject) {
1291
1268
  _this.openvidu.startWs(function (error) {
1292
1269
  if (!!error) {
1293
- reject(error);
1270
+ return reject(error);
1294
1271
  }
1295
1272
  else {
1296
1273
  var joinParams = _this.initializeParams(token);
1297
1274
  _this.openvidu.sendRequest('joinRoom', joinParams, function (error, response) {
1298
1275
  if (!!error) {
1299
- reject(error);
1276
+ return reject(error);
1300
1277
  }
1301
1278
  else {
1302
1279
  // Process join room response
@@ -1330,7 +1307,7 @@ var Session = /** @class */ (function (_super) {
1330
1307
  events_1.streams.forEach(function (stream) {
1331
1308
  _this.ee.emitEvent('streamCreated', [new StreamEvent_1.StreamEvent(false, _this, 'streamCreated', stream, '')]);
1332
1309
  });
1333
- resolve();
1310
+ return resolve();
1334
1311
  }
1335
1312
  });
1336
1313
  }
@@ -1365,16 +1342,16 @@ var Session = /** @class */ (function (_super) {
1365
1342
  var connection = _this.remoteConnections.get(connectionId);
1366
1343
  if (!!connection) {
1367
1344
  // Resolve remote connection
1368
- resolve(connection);
1345
+ return resolve(connection);
1369
1346
  }
1370
1347
  else {
1371
1348
  if (_this.connection.connectionId === connectionId) {
1372
1349
  // Resolve local connection
1373
- resolve(_this.connection);
1350
+ return resolve(_this.connection);
1374
1351
  }
1375
1352
  else {
1376
1353
  // Connection not found. Reject with OpenViduError
1377
- reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.GENERIC_ERROR, errorMessage));
1354
+ return reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.GENERIC_ERROR, errorMessage));
1378
1355
  }
1379
1356
  }
1380
1357
  });
@@ -1385,13 +1362,13 @@ var Session = /** @class */ (function (_super) {
1385
1362
  var connection = _this.remoteConnections.get(connectionId);
1386
1363
  if (!!connection) {
1387
1364
  // Resolve remote connection
1388
- resolve(connection);
1365
+ return resolve(connection);
1389
1366
  }
1390
1367
  else {
1391
1368
  // Remote connection not found. Reject with OpenViduError
1392
1369
  var errorMessage = 'Remote connection ' + connectionId + " unknown when '" + operation + "'. " +
1393
1370
  'Existing remote connections: ' + JSON.stringify(_this.remoteConnections.keys());
1394
- reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.GENERIC_ERROR, errorMessage));
1371
+ return reject(new OpenViduError_1.OpenViduError(OpenViduError_1.OpenViduErrorName.GENERIC_ERROR, errorMessage));
1395
1372
  }
1396
1373
  });
1397
1374
  };
@@ -1443,7 +1420,23 @@ var Session = /** @class */ (function (_super) {
1443
1420
  };
1444
1421
  Session.prototype.processJoinRoomResponse = function (opts) {
1445
1422
  this.sessionId = opts.session;
1446
- if (opts.coturnIp != null && opts.coturnPort != null && opts.turnUsername != null && opts.turnCredential != null) {
1423
+ if (opts.customIceServers != null && opts.customIceServers.length > 0) {
1424
+ this.openvidu.iceServers = [];
1425
+ for (var _i = 0, _a = opts.customIceServers; _i < _a.length; _i++) {
1426
+ var iceServer = _a[_i];
1427
+ var rtcIceServer = {
1428
+ urls: [iceServer.url]
1429
+ };
1430
+ logger.log("STUN/TURN server IP: " + iceServer.url);
1431
+ if (iceServer.username != null && iceServer.credential != null) {
1432
+ rtcIceServer.username = iceServer.username;
1433
+ rtcIceServer.credential = iceServer.credential;
1434
+ logger.log('TURN credentials [' + iceServer.username + ':' + iceServer.credential + ']');
1435
+ }
1436
+ this.openvidu.iceServers.push(rtcIceServer);
1437
+ }
1438
+ }
1439
+ else if (opts.coturnIp != null && opts.coturnPort != null && opts.turnUsername != null && opts.turnCredential != null) {
1447
1440
  var turnUrl1 = 'turn:' + opts.coturnIp + ':' + opts.coturnPort;
1448
1441
  this.openvidu.iceServers = [
1449
1442
  { urls: [turnUrl1], username: opts.turnUsername, credential: opts.turnCredential }
@@ -1454,6 +1447,7 @@ var Session = /** @class */ (function (_super) {
1454
1447
  this.openvidu.role = opts.role;
1455
1448
  this.openvidu.finalUserId = opts.finalUserId;
1456
1449
  this.openvidu.mediaServer = opts.mediaServer;
1450
+ this.openvidu.videoSimulcast = opts.videoSimulcast;
1457
1451
  this.capabilities = {
1458
1452
  subscribe: true,
1459
1453
  publish: this.openvidu.role !== 'SUBSCRIBER',
@@ -1464,10 +1458,15 @@ var Session = /** @class */ (function (_super) {
1464
1458
  if (opts.life != null) {
1465
1459
  this.openvidu.life = opts.life;
1466
1460
  }
1467
- if (opts.version !== this.openvidu.libraryVersion) {
1468
- logger.warn('OpenVidu Server (' + opts.version +
1469
- ') and OpenVidu Browser (' + this.openvidu.libraryVersion +
1470
- ') versions do NOT match. There may be incompatibilities');
1461
+ var minorDifference = semverMinor(opts.version) - semverMinor(this.openvidu.libraryVersion);
1462
+ if ((semverMajor(opts.version) !== semverMajor(this.openvidu.libraryVersion)) || !(minorDifference == 0 || minorDifference == 1)) {
1463
+ logger.error("openvidu-browser (".concat(this.openvidu.libraryVersion, ") and openvidu-server (").concat(opts.version, ") versions are incompatible. ")
1464
+ + 'Errors are likely to occur. openvidu-browser SDK is only compatible with the same version or the immediately following minor version of an OpenVidu deployment');
1465
+ }
1466
+ else if (minorDifference == 1) {
1467
+ logger.warn("openvidu-browser version ".concat(this.openvidu.libraryVersion, " does not match openvidu-server version ").concat(opts.version, ". ")
1468
+ + "These versions are still compatible with each other, but openvidu-browser version must be updated as soon as possible to ".concat(semverMajor(opts.version), ".").concat(semverMinor(opts.version), ".x. ")
1469
+ + "This client using openvidu-browser ".concat(this.openvidu.libraryVersion, " will become incompatible with the next release of openvidu-server"));
1471
1470
  }
1472
1471
  };
1473
1472
  return Session;