twilio-video 2.34.0 → 2.35.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 (410) hide show
  1. package/.release.json +1 -2
  2. package/CHANGELOG.md +11 -0
  3. package/README.md +9 -10
  4. package/dist/twilio-video.js +29836 -32994
  5. package/dist/twilio-video.min.js +2 -23
  6. package/es5/cancelableroompromise.js +4 -4
  7. package/es5/cancelableroompromise.js.map +1 -1
  8. package/es5/connect.js +86 -90
  9. package/es5/connect.js.map +1 -1
  10. package/es5/createlocaltrack.js +7 -7
  11. package/es5/createlocaltrack.js.map +1 -1
  12. package/es5/createlocaltracks.js +111 -195
  13. package/es5/createlocaltracks.js.map +1 -1
  14. package/es5/data/receiver.js +16 -34
  15. package/es5/data/receiver.js.map +1 -1
  16. package/es5/data/sender.js +28 -47
  17. package/es5/data/sender.js.map +1 -1
  18. package/es5/data/transceiver.js +6 -24
  19. package/es5/data/transceiver.js.map +1 -1
  20. package/es5/data/transport.js +18 -37
  21. package/es5/data/transport.js.map +1 -1
  22. package/es5/encodingparameters.js +14 -33
  23. package/es5/encodingparameters.js.map +1 -1
  24. package/es5/eventemitter.js +2 -2
  25. package/es5/eventemitter.js.map +1 -1
  26. package/es5/eventtarget.js +12 -40
  27. package/es5/eventtarget.js.map +1 -1
  28. package/es5/index.js +21 -32
  29. package/es5/index.js.map +1 -1
  30. package/es5/insights/applicationmonitor.js +16 -18
  31. package/es5/insights/applicationmonitor.js.map +1 -1
  32. package/es5/insights/computepressuremonitor.js +33 -79
  33. package/es5/insights/computepressuremonitor.js.map +1 -1
  34. package/es5/insights/events/application.js +9 -10
  35. package/es5/insights/events/application.js.map +1 -1
  36. package/es5/insights/events/getusermedia.js +9 -10
  37. package/es5/insights/events/getusermedia.js.map +1 -1
  38. package/es5/insights/events/network.js +14 -16
  39. package/es5/insights/events/network.js.map +1 -1
  40. package/es5/insights/events/peerconnection.js +31 -44
  41. package/es5/insights/events/peerconnection.js.map +1 -1
  42. package/es5/insights/events/quality.js +13 -14
  43. package/es5/insights/events/quality.js.map +1 -1
  44. package/es5/insights/events/room.js +12 -13
  45. package/es5/insights/events/room.js.map +1 -1
  46. package/es5/insights/events/system.js +6 -7
  47. package/es5/insights/events/system.js.map +1 -1
  48. package/es5/insights/events/track.js +15 -18
  49. package/es5/insights/events/track.js.map +1 -1
  50. package/es5/insights/monitorregistry.js +10 -12
  51. package/es5/insights/monitorregistry.js.map +1 -1
  52. package/es5/insights/networkmonitor.js +17 -18
  53. package/es5/insights/networkmonitor.js.map +1 -1
  54. package/es5/insights/resourcemonitor.js +15 -17
  55. package/es5/insights/resourcemonitor.js.map +1 -1
  56. package/es5/insights/statsmonitor.js +100 -172
  57. package/es5/insights/statsmonitor.js.map +1 -1
  58. package/es5/insights/telemetry.js +40 -47
  59. package/es5/insights/telemetry.js.map +1 -1
  60. package/es5/localparticipant.js +122 -148
  61. package/es5/localparticipant.js.map +1 -1
  62. package/es5/media/track/audiotrack.js +11 -28
  63. package/es5/media/track/audiotrack.js.map +1 -1
  64. package/es5/media/track/capturevideoframes.js +21 -37
  65. package/es5/media/track/capturevideoframes.js.map +1 -1
  66. package/es5/media/track/es5/localaudiotrack.js +3 -3
  67. package/es5/media/track/es5/localaudiotrack.js.map +1 -1
  68. package/es5/media/track/es5/localdatatrack.js +3 -3
  69. package/es5/media/track/es5/localdatatrack.js.map +1 -1
  70. package/es5/media/track/es5/localvideotrack.js +3 -3
  71. package/es5/media/track/es5/localvideotrack.js.map +1 -1
  72. package/es5/media/track/index.js +17 -36
  73. package/es5/media/track/index.js.map +1 -1
  74. package/es5/media/track/localaudiotrack.js +80 -105
  75. package/es5/media/track/localaudiotrack.js.map +1 -1
  76. package/es5/media/track/localaudiotrackpublication.js +8 -25
  77. package/es5/media/track/localaudiotrackpublication.js.map +1 -1
  78. package/es5/media/track/localdatatrack.js +11 -30
  79. package/es5/media/track/localdatatrack.js.map +1 -1
  80. package/es5/media/track/localdatatrackpublication.js +8 -25
  81. package/es5/media/track/localdatatrackpublication.js.map +1 -1
  82. package/es5/media/track/localmediatrack.js +104 -129
  83. package/es5/media/track/localmediatrack.js.map +1 -1
  84. package/es5/media/track/localtrackpublication.js +24 -82
  85. package/es5/media/track/localtrackpublication.js.map +1 -1
  86. package/es5/media/track/localvideotrack.js +87 -112
  87. package/es5/media/track/localvideotrack.js.map +1 -1
  88. package/es5/media/track/localvideotrackpublication.js +8 -25
  89. package/es5/media/track/localvideotrackpublication.js.map +1 -1
  90. package/es5/media/track/mediatrack.js +71 -95
  91. package/es5/media/track/mediatrack.js.map +1 -1
  92. package/es5/media/track/noisecancellationimpl.js +63 -129
  93. package/es5/media/track/noisecancellationimpl.js.map +1 -1
  94. package/es5/media/track/receiver.js +5 -22
  95. package/es5/media/track/receiver.js.map +1 -1
  96. package/es5/media/track/remoteaudiotrack.js +16 -33
  97. package/es5/media/track/remoteaudiotrack.js.map +1 -1
  98. package/es5/media/track/remoteaudiotrackpublication.js +8 -25
  99. package/es5/media/track/remoteaudiotrackpublication.js.map +1 -1
  100. package/es5/media/track/remotedatatrack.js +18 -61
  101. package/es5/media/track/remotedatatrack.js.map +1 -1
  102. package/es5/media/track/remotedatatrackpublication.js +8 -25
  103. package/es5/media/track/remotedatatrackpublication.js.map +1 -1
  104. package/es5/media/track/remotemediatrack.js +36 -80
  105. package/es5/media/track/remotemediatrack.js.map +1 -1
  106. package/es5/media/track/remotetrackpublication.js +30 -48
  107. package/es5/media/track/remotetrackpublication.js.map +1 -1
  108. package/es5/media/track/remotevideotrack.js +94 -133
  109. package/es5/media/track/remotevideotrack.js.map +1 -1
  110. package/es5/media/track/remotevideotrackpublication.js +8 -25
  111. package/es5/media/track/remotevideotrackpublication.js.map +1 -1
  112. package/es5/media/track/sender.js +46 -83
  113. package/es5/media/track/sender.js.map +1 -1
  114. package/es5/media/track/trackpublication.js +17 -35
  115. package/es5/media/track/trackpublication.js.map +1 -1
  116. package/es5/media/track/transceiver.js +12 -30
  117. package/es5/media/track/transceiver.js.map +1 -1
  118. package/es5/media/track/videoprocessoreventobserver.js +47 -65
  119. package/es5/media/track/videoprocessoreventobserver.js.map +1 -1
  120. package/es5/media/track/videotrack.js +103 -124
  121. package/es5/media/track/videotrack.js.map +1 -1
  122. package/es5/networkqualityconfiguration.js +12 -48
  123. package/es5/networkqualityconfiguration.js.map +1 -1
  124. package/es5/noisecancellationadapter.js +72 -120
  125. package/es5/noisecancellationadapter.js.map +1 -1
  126. package/es5/participant.js +126 -179
  127. package/es5/participant.js.map +1 -1
  128. package/es5/preflight/getCombinedConnectionStats.js +44 -95
  129. package/es5/preflight/getCombinedConnectionStats.js.map +1 -1
  130. package/es5/preflight/getturncredentials.js +13 -13
  131. package/es5/preflight/getturncredentials.js.map +1 -1
  132. package/es5/preflight/makestat.js +4 -29
  133. package/es5/preflight/makestat.js.map +1 -1
  134. package/es5/preflight/mos.js +5 -5
  135. package/es5/preflight/mos.js.map +1 -1
  136. package/es5/preflight/preflighttest.js +240 -381
  137. package/es5/preflight/preflighttest.js.map +1 -1
  138. package/es5/preflight/syntheticaudio.js +8 -8
  139. package/es5/preflight/syntheticaudio.js.map +1 -1
  140. package/es5/preflight/syntheticvideo.js +13 -14
  141. package/es5/preflight/syntheticvideo.js.map +1 -1
  142. package/es5/preflight/timer.js +9 -10
  143. package/es5/preflight/timer.js.map +1 -1
  144. package/es5/queueingeventemitter.js +16 -60
  145. package/es5/queueingeventemitter.js.map +1 -1
  146. package/es5/remoteparticipant.js +33 -76
  147. package/es5/remoteparticipant.js.map +1 -1
  148. package/es5/room.js +89 -169
  149. package/es5/room.js.map +1 -1
  150. package/es5/signaling/index.js +36 -55
  151. package/es5/signaling/index.js.map +1 -1
  152. package/es5/signaling/localparticipant.js +18 -37
  153. package/es5/signaling/localparticipant.js.map +1 -1
  154. package/es5/signaling/localtrackpublication.js +28 -51
  155. package/es5/signaling/localtrackpublication.js.map +1 -1
  156. package/es5/signaling/participant.js +37 -63
  157. package/es5/signaling/participant.js.map +1 -1
  158. package/es5/signaling/recording.js +11 -29
  159. package/es5/signaling/recording.js.map +1 -1
  160. package/es5/signaling/remoteparticipant.js +6 -24
  161. package/es5/signaling/remoteparticipant.js.map +1 -1
  162. package/es5/signaling/remotetrackpublication.js +27 -53
  163. package/es5/signaling/remotetrackpublication.js.map +1 -1
  164. package/es5/signaling/room.js +40 -59
  165. package/es5/signaling/room.js.map +1 -1
  166. package/es5/signaling/track.js +52 -90
  167. package/es5/signaling/track.js.map +1 -1
  168. package/es5/signaling/v2/cancelableroomsignalingpromise.js +46 -46
  169. package/es5/signaling/v2/cancelableroomsignalingpromise.js.map +1 -1
  170. package/es5/signaling/v2/dominantspeakersignaling.js +18 -40
  171. package/es5/signaling/v2/dominantspeakersignaling.js.map +1 -1
  172. package/es5/signaling/v2/icebox.js +12 -13
  173. package/es5/signaling/v2/icebox.js.map +1 -1
  174. package/es5/signaling/v2/iceconnectionmonitor.js +28 -32
  175. package/es5/signaling/v2/iceconnectionmonitor.js.map +1 -1
  176. package/es5/signaling/v2/index.js +12 -31
  177. package/es5/signaling/v2/index.js.map +1 -1
  178. package/es5/signaling/v2/localparticipant.js +65 -85
  179. package/es5/signaling/v2/localparticipant.js.map +1 -1
  180. package/es5/signaling/v2/localtrackpublication.js +21 -39
  181. package/es5/signaling/v2/localtrackpublication.js.map +1 -1
  182. package/es5/signaling/v2/mediasignaling.js +25 -48
  183. package/es5/signaling/v2/mediasignaling.js.map +1 -1
  184. package/es5/signaling/v2/networkqualitymonitor.js +50 -97
  185. package/es5/signaling/v2/networkqualitymonitor.js.map +1 -1
  186. package/es5/signaling/v2/networkqualitysignaling.js +56 -88
  187. package/es5/signaling/v2/networkqualitysignaling.js.map +1 -1
  188. package/es5/signaling/v2/peerconnection.js +523 -648
  189. package/es5/signaling/v2/peerconnection.js.map +1 -1
  190. package/es5/signaling/v2/peerconnectionmanager.js +111 -167
  191. package/es5/signaling/v2/peerconnectionmanager.js.map +1 -1
  192. package/es5/signaling/v2/publisherhintsignaling.js +22 -42
  193. package/es5/signaling/v2/publisherhintsignaling.js.map +1 -1
  194. package/es5/signaling/v2/recording.js +8 -26
  195. package/es5/signaling/v2/recording.js.map +1 -1
  196. package/es5/signaling/v2/remoteparticipant.js +25 -43
  197. package/es5/signaling/v2/remoteparticipant.js.map +1 -1
  198. package/es5/signaling/v2/remotetrackpublication.js +7 -24
  199. package/es5/signaling/v2/remotetrackpublication.js.map +1 -1
  200. package/es5/signaling/v2/renderhintssignaling.js +40 -61
  201. package/es5/signaling/v2/renderhintssignaling.js.map +1 -1
  202. package/es5/signaling/v2/room.js +216 -280
  203. package/es5/signaling/v2/room.js.map +1 -1
  204. package/es5/signaling/v2/trackprioritysignaling.js +11 -29
  205. package/es5/signaling/v2/trackprioritysignaling.js.map +1 -1
  206. package/es5/signaling/v2/trackswitchoffsignaling.js +10 -28
  207. package/es5/signaling/v2/trackswitchoffsignaling.js.map +1 -1
  208. package/es5/signaling/v2/transcriptionsignaling.js +8 -26
  209. package/es5/signaling/v2/transcriptionsignaling.js.map +1 -1
  210. package/es5/signaling/v2/twilioconnectiontransport.js +62 -82
  211. package/es5/signaling/v2/twilioconnectiontransport.js.map +1 -1
  212. package/es5/statemachine.js +75 -121
  213. package/es5/statemachine.js.map +1 -1
  214. package/es5/stats/average.js +2 -2
  215. package/es5/stats/average.js.map +1 -1
  216. package/es5/stats/icereport.js +11 -12
  217. package/es5/stats/icereport.js.map +1 -1
  218. package/es5/stats/icereportfactory.js +8 -9
  219. package/es5/stats/icereportfactory.js.map +1 -1
  220. package/es5/stats/localaudiotrackstats.js +6 -24
  221. package/es5/stats/localaudiotrackstats.js.map +1 -1
  222. package/es5/stats/localtrackstats.js +6 -24
  223. package/es5/stats/localtrackstats.js.map +1 -1
  224. package/es5/stats/localvideotrackstats.js +9 -27
  225. package/es5/stats/localvideotrackstats.js.map +1 -1
  226. package/es5/stats/networkqualityaudiostats.js +5 -22
  227. package/es5/stats/networkqualityaudiostats.js.map +1 -1
  228. package/es5/stats/networkqualitybandwidthstats.js +3 -5
  229. package/es5/stats/networkqualitybandwidthstats.js.map +1 -1
  230. package/es5/stats/networkqualityfractionloststats.js +3 -5
  231. package/es5/stats/networkqualityfractionloststats.js.map +1 -1
  232. package/es5/stats/networkqualitylatencystats.js +3 -5
  233. package/es5/stats/networkqualitylatencystats.js.map +1 -1
  234. package/es5/stats/networkqualitymediastats.js +5 -7
  235. package/es5/stats/networkqualitymediastats.js.map +1 -1
  236. package/es5/stats/networkqualityrecvstats.js +5 -22
  237. package/es5/stats/networkqualityrecvstats.js.map +1 -1
  238. package/es5/stats/networkqualitysendorrecvstats.js +6 -8
  239. package/es5/stats/networkqualitysendorrecvstats.js.map +1 -1
  240. package/es5/stats/networkqualitysendstats.js +5 -22
  241. package/es5/stats/networkqualitysendstats.js.map +1 -1
  242. package/es5/stats/networkqualitystats.js +5 -7
  243. package/es5/stats/networkqualitystats.js.map +1 -1
  244. package/es5/stats/networkqualityvideostats.js +5 -22
  245. package/es5/stats/networkqualityvideostats.js.map +1 -1
  246. package/es5/stats/peerconnectionreport.js +13 -14
  247. package/es5/stats/peerconnectionreport.js.map +1 -1
  248. package/es5/stats/peerconnectionreportfactory.js +89 -185
  249. package/es5/stats/peerconnectionreportfactory.js.map +1 -1
  250. package/es5/stats/receiverreport.js +28 -46
  251. package/es5/stats/receiverreport.js.map +1 -1
  252. package/es5/stats/receiverreportfactory.js +11 -29
  253. package/es5/stats/receiverreportfactory.js.map +1 -1
  254. package/es5/stats/remoteaudiotrackstats.js +6 -24
  255. package/es5/stats/remoteaudiotrackstats.js.map +1 -1
  256. package/es5/stats/remotetrackstats.js +6 -24
  257. package/es5/stats/remotetrackstats.js.map +1 -1
  258. package/es5/stats/remotevideotrackstats.js +7 -25
  259. package/es5/stats/remotevideotrackstats.js.map +1 -1
  260. package/es5/stats/senderorreceiverreport.js +3 -4
  261. package/es5/stats/senderorreceiverreport.js.map +1 -1
  262. package/es5/stats/senderorreceiverreportfactory.js +3 -4
  263. package/es5/stats/senderorreceiverreportfactory.js.map +1 -1
  264. package/es5/stats/senderreport.js +20 -38
  265. package/es5/stats/senderreport.js.map +1 -1
  266. package/es5/stats/senderreportfactory.js +11 -29
  267. package/es5/stats/senderreportfactory.js.map +1 -1
  268. package/es5/stats/statsreport.js +11 -12
  269. package/es5/stats/statsreport.js.map +1 -1
  270. package/es5/stats/sum.js +1 -1
  271. package/es5/stats/sum.js.map +1 -1
  272. package/es5/stats/trackstats.js +3 -4
  273. package/es5/stats/trackstats.js.map +1 -1
  274. package/es5/transceiver.js +8 -26
  275. package/es5/transceiver.js.map +1 -1
  276. package/es5/twilioconnection.js +166 -223
  277. package/es5/twilioconnection.js.map +1 -1
  278. package/es5/util/asyncvar.js +12 -14
  279. package/es5/util/asyncvar.js.map +1 -1
  280. package/es5/util/backoff.js +14 -16
  281. package/es5/util/backoff.js.map +1 -1
  282. package/es5/util/browserdetection.js +19 -35
  283. package/es5/util/browserdetection.js.map +1 -1
  284. package/es5/util/cancelablepromise.js +30 -57
  285. package/es5/util/cancelablepromise.js.map +1 -1
  286. package/es5/util/constants.js +13 -13
  287. package/es5/util/constants.js.map +1 -1
  288. package/es5/util/detectsilentaudio.js +10 -10
  289. package/es5/util/detectsilentaudio.js.map +1 -1
  290. package/es5/util/detectsilentvideo.js +12 -12
  291. package/es5/util/detectsilentvideo.js.map +1 -1
  292. package/es5/util/documentvisibilitymonitor.js +34 -41
  293. package/es5/util/documentvisibilitymonitor.js.map +1 -1
  294. package/es5/util/dynamicimport.js +4 -4
  295. package/es5/util/dynamicimport.js.map +1 -1
  296. package/es5/util/eventobserver.js +19 -39
  297. package/es5/util/eventobserver.js.map +1 -1
  298. package/es5/util/filter.js +11 -12
  299. package/es5/util/filter.js.map +1 -1
  300. package/es5/util/index.js +96 -165
  301. package/es5/util/index.js.map +1 -1
  302. package/es5/util/insightspublisher/index.js +48 -78
  303. package/es5/util/insightspublisher/index.js.map +1 -1
  304. package/es5/util/insightspublisher/null.js +9 -10
  305. package/es5/util/insightspublisher/null.js.map +1 -1
  306. package/es5/util/localmediarestartdeferreds.js +10 -11
  307. package/es5/util/localmediarestartdeferreds.js.map +1 -1
  308. package/es5/util/log.js +44 -70
  309. package/es5/util/log.js.map +1 -1
  310. package/es5/util/movingaveragedelta.js +12 -13
  311. package/es5/util/movingaveragedelta.js.map +1 -1
  312. package/es5/util/networkmonitor.js +26 -30
  313. package/es5/util/networkmonitor.js.map +1 -1
  314. package/es5/util/nullobserver.js +22 -48
  315. package/es5/util/nullobserver.js.map +1 -1
  316. package/es5/util/sdp/index.js +109 -134
  317. package/es5/util/sdp/index.js.map +1 -1
  318. package/es5/util/sdp/issue8329.js +56 -57
  319. package/es5/util/sdp/issue8329.js.map +1 -1
  320. package/es5/util/sdp/simulcast.js +55 -73
  321. package/es5/util/sdp/simulcast.js.map +1 -1
  322. package/es5/util/sdp/trackmatcher.js +14 -15
  323. package/es5/util/sdp/trackmatcher.js.map +1 -1
  324. package/es5/util/sid.js +5 -5
  325. package/es5/util/sid.js.map +1 -1
  326. package/es5/util/support.js +13 -16
  327. package/es5/util/support.js.map +1 -1
  328. package/es5/util/timeout.js +28 -39
  329. package/es5/util/timeout.js.map +1 -1
  330. package/es5/util/timeoutpromise.js +38 -84
  331. package/es5/util/timeoutpromise.js.map +1 -1
  332. package/es5/util/twilio-video-errors.js +277 -457
  333. package/es5/util/twilio-video-errors.js.map +1 -1
  334. package/es5/util/twilioerror.js +13 -57
  335. package/es5/util/twilioerror.js.map +1 -1
  336. package/es5/util/twiliowarning.js +1 -1
  337. package/es5/util/twiliowarning.js.map +1 -1
  338. package/es5/util/validate.js +13 -15
  339. package/es5/util/validate.js.map +1 -1
  340. package/es5/vendor/inherits.js +3 -5
  341. package/es5/vendor/inherits.js.map +1 -1
  342. package/es5/webaudio/audiocontext.js +8 -9
  343. package/es5/webaudio/audiocontext.js.map +1 -1
  344. package/es5/webaudio/detectsilence.js +9 -9
  345. package/es5/webaudio/detectsilence.js.map +1 -1
  346. package/es5/webaudio/workaround180748.js +15 -13
  347. package/es5/webaudio/workaround180748.js.map +1 -1
  348. package/es5/webrtc/getstats.js +242 -448
  349. package/es5/webrtc/getstats.js.map +1 -1
  350. package/es5/webrtc/getusermedia.js +1 -2
  351. package/es5/webrtc/getusermedia.js.map +1 -1
  352. package/es5/webrtc/index.js +1 -17
  353. package/es5/webrtc/index.js.map +1 -1
  354. package/es5/webrtc/rtcpeerconnection/chrome.js +102 -295
  355. package/es5/webrtc/rtcpeerconnection/chrome.js.map +1 -1
  356. package/es5/webrtc/rtcpeerconnection/firefox.js +69 -146
  357. package/es5/webrtc/rtcpeerconnection/firefox.js.map +1 -1
  358. package/es5/webrtc/rtcpeerconnection/index.js +1 -1
  359. package/es5/webrtc/rtcpeerconnection/index.js.map +1 -1
  360. package/es5/webrtc/rtcpeerconnection/safari.js +110 -192
  361. package/es5/webrtc/rtcpeerconnection/safari.js.map +1 -1
  362. package/es5/webrtc/rtcrtpsender.js +3 -4
  363. package/es5/webrtc/rtcrtpsender.js.map +1 -1
  364. package/es5/webrtc/util/index.js +28 -63
  365. package/es5/webrtc/util/index.js.map +1 -1
  366. package/es5/webrtc/util/latch.js +21 -28
  367. package/es5/webrtc/util/latch.js.map +1 -1
  368. package/es5/webrtc/util/sdp.js +41 -211
  369. package/es5/webrtc/util/sdp.js.map +1 -1
  370. package/lib/connect.js +0 -1
  371. package/lib/createlocaltracks.ts +2 -2
  372. package/lib/localparticipant.js +0 -1
  373. package/lib/media/track/mediatrack.js +0 -2
  374. package/lib/media/track/noisecancellationimpl.ts +2 -2
  375. package/lib/noisecancellationadapter.ts +2 -2
  376. package/lib/preflight/getCombinedConnectionStats.ts +1 -1
  377. package/lib/preflight/getturncredentials.ts +2 -2
  378. package/lib/preflight/preflighttest.ts +3 -3
  379. package/lib/signaling/v2/peerconnection.js +2 -4
  380. package/lib/util/sdp/index.js +1 -2
  381. package/lib/util/sdp/issue8329.js +0 -2
  382. package/lib/util/support.js +4 -7
  383. package/lib/webrtc/getstats.js +6 -21
  384. package/lib/webrtc/index.js +0 -16
  385. package/lib/webrtc/rtcpeerconnection/chrome.js +13 -123
  386. package/lib/webrtc/rtcpeerconnection/firefox.js +5 -6
  387. package/lib/webrtc/rtcpeerconnection/safari.js +9 -19
  388. package/lib/webrtc/util/sdp.js +13 -194
  389. package/package.json +16 -11
  390. package/rollup.config.mjs +85 -0
  391. package/tsconfig.json +5 -5
  392. package/es5/webrtc/mediastream.js +0 -11
  393. package/es5/webrtc/mediastream.js.map +0 -1
  394. package/es5/webrtc/mediastreamtrack.js +0 -11
  395. package/es5/webrtc/mediastreamtrack.js.map +0 -1
  396. package/es5/webrtc/rtcicecandidate.js +0 -11
  397. package/es5/webrtc/rtcicecandidate.js.map +0 -1
  398. package/es5/webrtc/rtcsessiondescription/chrome.js +0 -43
  399. package/es5/webrtc/rtcsessiondescription/chrome.js.map +0 -1
  400. package/es5/webrtc/rtcsessiondescription/firefox.js +0 -4
  401. package/es5/webrtc/rtcsessiondescription/firefox.js.map +0 -1
  402. package/es5/webrtc/rtcsessiondescription/index.js +0 -22
  403. package/es5/webrtc/rtcsessiondescription/index.js.map +0 -1
  404. package/lib/webrtc/mediastream.js +0 -10
  405. package/lib/webrtc/mediastreamtrack.js +0 -10
  406. package/lib/webrtc/rtcicecandidate.js +0 -10
  407. package/lib/webrtc/rtcsessiondescription/chrome.js +0 -39
  408. package/lib/webrtc/rtcsessiondescription/firefox.js +0 -4
  409. package/lib/webrtc/rtcsessiondescription/index.js +0 -21
  410. package/src/twilio-video.js +0 -16
@@ -1,16 +1,11 @@
1
1
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
2
2
  'use strict';
3
3
 
4
- const ChromeRTCSessionDescription = require('../rtcsessiondescription/chrome');
5
4
  const EventTarget = require('../../eventtarget');
6
5
  const Latch = require('../util/latch');
7
- const MediaStream = require('../mediastream');
8
- const RTCRtpSenderShim = require('../rtcrtpsender');
9
- const { getSdpFormat, updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs } = require('../util/sdp');
6
+ const { updateTrackIdsToSSRCs } = require('../util/sdp');
10
7
  const { delegateMethods, interceptEvent, isIOSChrome, legacyPromise, proxyProperties } = require('../util');
11
8
 
12
- const isUnifiedPlan = getSdpFormat() === 'unified';
13
-
14
9
  // NOTE(mroberts): This class wraps Chrome's RTCPeerConnection implementation.
15
10
  // It provides some functionality not currently present in Chrome, namely the
16
11
  // abilities to
@@ -34,7 +29,6 @@ class ChromeRTCPeerConnection extends EventTarget {
34
29
 
35
30
  interceptEvent(this, 'datachannel');
36
31
  interceptEvent(this, 'signalingstatechange');
37
- const sdpFormat = getSdpFormat(newConfiguration.sdpSemantics);
38
32
  const peerConnection = new RTCPeerConnection(newConfiguration, constraints);
39
33
 
40
34
  Object.defineProperties(this, {
@@ -49,9 +43,6 @@ class ChromeRTCPeerConnection extends EventTarget {
49
43
  value: null,
50
44
  writable: true
51
45
  },
52
- _localStream: {
53
- value: new MediaStream()
54
- },
55
46
  _peerConnection: {
56
47
  value: peerConnection
57
48
  },
@@ -67,12 +58,6 @@ class ChromeRTCPeerConnection extends EventTarget {
67
58
  value: new Map(),
68
59
  writable: true
69
60
  },
70
- _sdpFormat: {
71
- value: sdpFormat
72
- },
73
- _senders: {
74
- value: new Map()
75
- },
76
61
  _signalingStateLatch: {
77
62
  value: new Latch()
78
63
  },
@@ -100,14 +85,6 @@ class ChromeRTCPeerConnection extends EventTarget {
100
85
  }
101
86
  });
102
87
 
103
- peerConnection.ontrack = () => {
104
- // NOTE(mroberts): adapter.js's "track" event shim only kicks off if we set
105
- // the ontrack property of the RTCPeerConnection.
106
- };
107
-
108
- if (typeof peerConnection.addTrack !== 'function') {
109
- peerConnection.addStream(this._localStream);
110
- }
111
88
  proxyProperties(RTCPeerConnection.prototype, this, peerConnection);
112
89
  }
113
90
 
@@ -128,72 +105,6 @@ class ChromeRTCPeerConnection extends EventTarget {
128
105
  return this._peerConnection.signalingState;
129
106
  }
130
107
 
131
- // NOTE(mmalavalli): This shim supports our limited case of adding
132
- // all MediaStreamTracks to one MediaStream. It has been implemented this
133
- // keeping in mind that this is to be maintained only until "addTrack" is
134
- // supported natively in Chrome.
135
- addTrack(track, ...rest) {
136
- if (typeof this._peerConnection.addTrack === 'function') {
137
- return this._peerConnection.addTrack(track, ...rest);
138
- }
139
- if (this._peerConnection.signalingState === 'closed') {
140
- throw new Error(`Cannot add MediaStreamTrack [${track.id},
141
- ${track.kind}]: RTCPeerConnection is closed`);
142
- }
143
-
144
- let sender = this._senders.get(track);
145
- if (sender && sender.track) {
146
- throw new Error(`Cannot add MediaStreamTrack ['${track.id},
147
- ${track.kind}]: RTCPeerConnection already has it`);
148
- }
149
- this._peerConnection.removeStream(this._localStream);
150
- this._localStream.addTrack(track);
151
- this._peerConnection.addStream(this._localStream);
152
- sender = new RTCRtpSenderShim(track);
153
- this._senders.set(track, sender);
154
- return sender;
155
- }
156
-
157
- // NOTE(mmalavalli): This shim supports our limited case of removing
158
- // MediaStreamTracks from one MediaStream. It has been implemented this
159
- // keeping in mind that this is to be maintained only until "removeTrack" is
160
- // supported natively in Chrome.
161
- removeTrack(sender) {
162
- if (this._peerConnection.signalingState === 'closed') {
163
- throw new Error('Cannot remove MediaStreamTrack: RTCPeerConnection is closed');
164
- }
165
- if (typeof this._peerConnection.addTrack === 'function') {
166
- try {
167
- return this._peerConnection.removeTrack(sender);
168
- } catch (e) {
169
- // NOTE(mhuynh): Do nothing. In Chrome, will throw if a 'sender was not
170
- // created by this peer connection'. This behavior does not seem to be
171
- // spec compliant, so a temporary shim is introduced. A bug has been filed,
172
- // and is tracked here:
173
- // https://bugs.chromium.org/p/chromium/issues/detail?id=860853
174
- }
175
- } else {
176
- const { track } = sender;
177
- if (!track) {
178
- return;
179
- }
180
- sender = this._senders.get(track);
181
- if (sender && sender.track) {
182
- sender.track = null;
183
- this._peerConnection.removeStream(this._localStream);
184
- this._localStream.removeTrack(track);
185
- this._peerConnection.addStream(this._localStream);
186
- }
187
- }
188
- }
189
-
190
- getSenders() {
191
- if (typeof this._peerConnection.addTrack === 'function') {
192
- return this._peerConnection.getSenders();
193
- }
194
- return Array.from(this._senders.values());
195
- }
196
-
197
108
  addIceCandidate(candidate, ...rest) {
198
109
  let promise;
199
110
 
@@ -246,9 +157,9 @@ class ChromeRTCPeerConnection extends EventTarget {
246
157
  // longer need to retain the rolled back tracks to SSRCs Map.
247
158
  this._rolledBackTracksToSSRCs.clear();
248
159
 
249
- return new ChromeRTCSessionDescription({
160
+ return new RTCSessionDescription({
250
161
  type: 'answer',
251
- sdp: updateTrackIdsToSSRCs(this._sdpFormat, this._tracksToSSRCs, answer.sdp)
162
+ sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, answer.sdp)
252
163
  });
253
164
  }, error => {
254
165
  this._pendingRemoteOffer = null;
@@ -260,9 +171,9 @@ class ChromeRTCPeerConnection extends EventTarget {
260
171
  // longer need to retain the rolled back tracks to SSRCs Map.
261
172
  this._rolledBackTracksToSSRCs.clear();
262
173
 
263
- return new ChromeRTCSessionDescription({
174
+ return new RTCSessionDescription({
264
175
  type: 'answer',
265
- sdp: updateTrackIdsToSSRCs(this._sdpFormat, this._tracksToSSRCs, answer.sdp)
176
+ sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, answer.sdp)
266
177
  });
267
178
  });
268
179
  }
@@ -278,24 +189,20 @@ class ChromeRTCPeerConnection extends EventTarget {
278
189
 
279
190
  if (isIOSChrome()) {
280
191
  // NOTE (joma): From SafariRTCPeerConnection in order to support iOS Chrome.
281
- if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
192
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !hasReceiversForTracksOfKind(this, 'audio')) {
282
193
  delete options.offerToReceiveAudio;
283
194
  try {
284
- this._audioTransceiver = isUnifiedPlan
285
- ? this.addTransceiver('audio', { direction: 'recvonly' })
286
- : this.addTransceiver('audio');
195
+ this._audioTransceiver = this.addTransceiver('audio', { direction: 'recvonly' });
287
196
  this._applyCodecPreferences(this._audioTransceiver);
288
197
  } catch (e) {
289
198
  return Promise.reject(e);
290
199
  }
291
200
  }
292
201
 
293
- if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
202
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !hasReceiversForTracksOfKind(this, 'video')) {
294
203
  delete options.offerToReceiveVideo;
295
204
  try {
296
- this._videoTransceiver = isUnifiedPlan
297
- ? this.addTransceiver('video', { direction: 'recvonly' })
298
- : this.addTransceiver('video');
205
+ this._videoTransceiver = this.addTransceiver('video', { direction: 'recvonly' });
299
206
  this._applyCodecPreferences(this._videoTransceiver);
300
207
  } catch (e) {
301
208
  return Promise.reject(e);
@@ -308,9 +215,9 @@ class ChromeRTCPeerConnection extends EventTarget {
308
215
  // longer need to retain the rolled back tracks to SSRCs Map.
309
216
  this._rolledBackTracksToSSRCs.clear();
310
217
 
311
- return new ChromeRTCSessionDescription({
218
+ return new RTCSessionDescription({
312
219
  type: offer.type,
313
- sdp: updateTrackIdsToSSRCs(this._sdpFormat, this._tracksToSSRCs, offer.sdp)
220
+ sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, offer.sdp)
314
221
  });
315
222
  });
316
223
 
@@ -466,10 +373,8 @@ function hasReceiversForTracksOfKind(peerConnection, kind) {
466
373
  }
467
374
 
468
375
  function unwrap(description) {
469
- if (description instanceof ChromeRTCSessionDescription) {
470
- if (description._description) {
471
- return description._description;
472
- }
376
+ if (description instanceof RTCSessionDescription) {
377
+ return description;
473
378
  }
474
379
  return new RTCSessionDescription(description);
475
380
  }
@@ -527,19 +432,4 @@ function shimDataChannel(dataChannel) {
527
432
  return dataChannel;
528
433
  }
529
434
 
530
- /**
531
- * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both
532
- * the Map from MediaStreamTrack IDs to SSRCs and the SDP itself. This method
533
- * ensures that SSRCs never change once announced.
534
- * @param {'planb'|'unified'} sdpFormat
535
- * @param {Map<string, Set<string>>} tracksToSSRCs
536
- * @param {string} sdp - an SDP whose format is determined by `sdpSemantics`
537
- * @returns {string} updatedSdp - updated SDP
538
- */
539
- function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
540
- return sdpFormat === 'unified'
541
- ? updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)
542
- : updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);
543
- }
544
-
545
435
  module.exports = ChromeRTCPeerConnection;
@@ -2,8 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  const EventTarget = require('../../eventtarget');
5
- const FirefoxRTCSessionDescription = require('../rtcsessiondescription/firefox');
6
- const { updateUnifiedPlanTrackIdsToSSRCs: updateTracksToSSRCs } = require('../util/sdp');
5
+ const { updateTrackIdsToSSRCs } = require('../util/sdp');
7
6
  const { delegateMethods, interceptEvent, legacyPromise, proxyProperties } = require('../util');
8
7
 
9
8
  // NOTE(mroberts): This class wraps Firefox's RTCPeerConnection implementation.
@@ -138,9 +137,9 @@ class FirefoxRTCPeerConnection extends EventTarget {
138
137
  }
139
138
 
140
139
  promise = promise.then(offer => {
141
- return new FirefoxRTCSessionDescription({
140
+ return new RTCSessionDescription({
142
141
  type: offer.type,
143
- sdp: updateTracksToSSRCs(this._tracksToSSRCs, offer.sdp)
142
+ sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, offer.sdp)
144
143
  });
145
144
  });
146
145
 
@@ -224,7 +223,7 @@ delegateMethods(
224
223
  function rollback(peerConnection, local, onceRolledBack) {
225
224
  const setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';
226
225
  peerConnection._rollingBack = true;
227
- return peerConnection._peerConnection[setLocalDescription](new FirefoxRTCSessionDescription({
226
+ return peerConnection._peerConnection[setLocalDescription](new RTCSessionDescription({
228
227
  type: 'rollback'
229
228
  })).then(onceRolledBack).then(result => {
230
229
  peerConnection._rollingBack = false;
@@ -283,7 +282,7 @@ function saveInitiallyNegotiatedDtlsRole(peerConnection, description, remote) {
283
282
  */
284
283
  function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
285
284
  if (description && description.type === 'answer' && dtlsRole) {
286
- return new FirefoxRTCSessionDescription({
285
+ return new RTCSessionDescription({
287
286
  type: description.type,
288
287
  sdp: description.sdp.replace(/a=setup:[a-z]+/g, 'a=setup:' + dtlsRole)
289
288
  });
@@ -3,15 +3,9 @@
3
3
 
4
4
  const EventTarget = require('../../eventtarget');
5
5
  const Latch = require('../util/latch');
6
- const { getSdpFormat, updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs } = require('../util/sdp');
6
+ const { updateTrackIdsToSSRCs } = require('../util/sdp');
7
7
  const { delegateMethods, interceptEvent, proxyProperties } = require('../util');
8
8
 
9
- const isUnifiedPlan = getSdpFormat() === 'unified';
10
-
11
- const updateTrackIdsToSSRCs = isUnifiedPlan
12
- ? updateUnifiedPlanTrackIdsToSSRCs
13
- : updatePlanBTrackIdsToSSRCs;
14
-
15
9
  class SafariRTCPeerConnection extends EventTarget {
16
10
  constructor(configuration, options = {}) {
17
11
  super();
@@ -143,24 +137,20 @@ class SafariRTCPeerConnection extends EventTarget {
143
137
 
144
138
  // NOTE(mroberts): In general, this is not the way to do this; however, it's
145
139
  // good enough for our application.
146
- if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
140
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !hasReceiversForTracksOfKind(this, 'audio')) {
147
141
  delete options.offerToReceiveAudio;
148
142
  try {
149
- this._audioTransceiver = isUnifiedPlan
150
- ? this.addTransceiver('audio', { direction: 'recvonly' })
151
- : this.addTransceiver('audio');
143
+ this._audioTransceiver = this.addTransceiver('audio', { direction: 'recvonly' });
152
144
  this._applyCodecPreferences(this._audioTransceiver);
153
145
  } catch (e) {
154
146
  return Promise.reject(e);
155
147
  }
156
148
  }
157
149
 
158
- if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
150
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !hasReceiversForTracksOfKind(this, 'video')) {
159
151
  delete options.offerToReceiveVideo;
160
152
  try {
161
- this._videoTransceiver = isUnifiedPlan
162
- ? this.addTransceiver('video', { direction: 'recvonly' })
163
- : this.addTransceiver('video');
153
+ this._videoTransceiver = this.addTransceiver('video', { direction: 'recvonly' });
164
154
  this._applyCodecPreferences(this._videoTransceiver);
165
155
  } catch (e) {
166
156
  return Promise.reject(e);
@@ -191,10 +181,10 @@ class SafariRTCPeerConnection extends EventTarget {
191
181
  // longer need to retain the rolled back tracks to SSRCs Map.
192
182
  this._rolledBackTracksToSSRCs.clear();
193
183
 
194
- return isUnifiedPlan ? new RTCSessionDescription({
184
+ return new RTCSessionDescription({
195
185
  type: answer.type,
196
186
  sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, answer.sdp)
197
- }) : answer;
187
+ });
198
188
  }, error => {
199
189
  this._pendingRemoteOffer = null;
200
190
  throw error;
@@ -206,10 +196,10 @@ class SafariRTCPeerConnection extends EventTarget {
206
196
  // longer need to retain the rolled back tracks to SSRCs Map.
207
197
  this._rolledBackTracksToSSRCs.clear();
208
198
 
209
- return isUnifiedPlan ? new RTCSessionDescription({
199
+ return new RTCSessionDescription({
210
200
  type: answer.type,
211
201
  sdp: updateTrackIdsToSSRCs(this._tracksToSSRCs, answer.sdp)
212
- }) : answer;
202
+ });
213
203
  });
214
204
  }
215
205
 
@@ -1,107 +1,6 @@
1
- /* globals RTCPeerConnection, RTCRtpTransceiver */
2
-
3
1
  'use strict';
4
2
 
5
- const { flatMap, guessBrowser } = require('./');
6
-
7
- // NOTE(mmalavalli): We cache Chrome's sdpSemantics support in order to prevent
8
- // instantiation of more than one RTCPeerConnection.
9
- let isSdpSemanticsSupported = null;
10
-
11
- /**
12
- * Check if Chrome supports specifying sdpSemantics for an RTCPeerConnection.
13
- * @return {boolean}
14
- */
15
- function checkIfSdpSemanticsIsSupported() {
16
- if (typeof isSdpSemanticsSupported === 'boolean') {
17
- return isSdpSemanticsSupported;
18
- }
19
- if (typeof RTCPeerConnection === 'undefined') {
20
- isSdpSemanticsSupported = false;
21
- return isSdpSemanticsSupported;
22
- }
23
- try {
24
- // eslint-disable-next-line no-new
25
- new RTCPeerConnection({ sdpSemantics: 'foo' });
26
- isSdpSemanticsSupported = false;
27
- } catch (e) {
28
- isSdpSemanticsSupported = true;
29
- }
30
- return isSdpSemanticsSupported;
31
- }
32
-
33
- // NOTE(mmalavalli): We cache Chrome's SDP format in order to prevent
34
- // instantiation of more than one RTCPeerConnection.
35
- let chromeSdpFormat = null;
36
-
37
- /**
38
- * Clear cached Chrome's SDP format
39
- */
40
- function clearChromeCachedSdpFormat() {
41
- chromeSdpFormat = null;
42
- }
43
-
44
- /**
45
- * Get Chrome's default SDP format.
46
- * @returns {'planb'|'unified'}
47
- */
48
- function getChromeDefaultSdpFormat() {
49
- if (!chromeSdpFormat) {
50
- if (typeof RTCPeerConnection !== 'undefined'
51
- && 'addTransceiver' in RTCPeerConnection.prototype) {
52
- const pc = new RTCPeerConnection();
53
- try {
54
- pc.addTransceiver('audio');
55
- chromeSdpFormat = 'unified';
56
- } catch (e) {
57
- chromeSdpFormat = 'planb';
58
- }
59
- pc.close();
60
- } else {
61
- chromeSdpFormat = 'planb';
62
- }
63
- }
64
- return chromeSdpFormat;
65
- }
66
-
67
- /**
68
- * Get Chrome's SDP format.
69
- * @param {'plan-b'|'unified-plan'} [sdpSemantics]
70
- * @returns {'planb'|'unified'}
71
- */
72
- function getChromeSdpFormat(sdpSemantics) {
73
- if (!sdpSemantics || !checkIfSdpSemanticsIsSupported()) {
74
- return getChromeDefaultSdpFormat();
75
- }
76
- return {
77
- 'plan-b': 'planb',
78
- 'unified-plan': 'unified'
79
- }[sdpSemantics];
80
- }
81
-
82
- /**
83
- * Get Safari's default SDP format.
84
- * @returns {'planb'|'unified'}
85
- */
86
- function getSafariSdpFormat() {
87
- return typeof RTCRtpTransceiver !== 'undefined'
88
- && 'currentDirection' in RTCRtpTransceiver.prototype
89
- ? 'unified'
90
- : 'planb';
91
- }
92
-
93
- /**
94
- * Get the browser's default SDP format.
95
- * @param {'plan-b'|'unified-plan'} [sdpSemantics]
96
- * @returns {'planb'|'unified'}
97
- */
98
- function getSdpFormat(sdpSemantics) {
99
- return {
100
- chrome: getChromeSdpFormat(sdpSemantics),
101
- firefox: 'unified',
102
- safari: getSafariSdpFormat()
103
- }[guessBrowser()] || null;
104
- }
3
+ const { flatMap } = require('./');
105
4
 
106
5
  /**
107
6
  * Match a pattern across lines, returning the first capture group for any
@@ -120,41 +19,11 @@ function getMatches(pattern, lines) {
120
19
 
121
20
  /**
122
21
  * Get a Set of MediaStreamTrack IDs from an SDP.
123
- * @param {string} pattern
124
- * @param {string} sdp
125
- * @returns {Set<string>}
126
- */
127
- function getTrackIds(pattern, sdp) {
128
- return getMatches(pattern, sdp);
129
- }
130
-
131
- /**
132
- * Get a Set of MediaStreamTrack IDs from a Plan B SDP.
133
- * @param {string} sdp - Plan B SDP
134
- * @returns {Set<string>} trackIds
135
- */
136
- function getPlanBTrackIds(sdp) {
137
- return getTrackIds('^a=ssrc:[0-9]+ +msid:.+ +(.+) *$', sdp);
138
- }
139
-
140
- /**
141
- * Get a Set of MediaStreamTrack IDs from a Unified Plan SDP.
142
- * @param {string} sdp - Unified Plan SDP
22
+ * @param {string} sdp - SDP
143
23
  * @returns {Set<string>} trackIds
144
24
  */
145
- function getUnifiedPlanTrackIds(sdp) {
146
- return getTrackIds('^a=msid:.+ +(.+) *$', sdp);
147
- }
148
-
149
- /**
150
- * Get a Set of SSRCs for a MediaStreamTrack from a Plan B SDP.
151
- * @param {string} sdp - Plan B SDP
152
- * @param {string} trackId - MediaStreamTrack ID
153
- * @returns {Set<string>}
154
- */
155
- function getPlanBSSRCs(sdp, trackId) {
156
- const pattern = `^a=ssrc:([0-9]+) +msid:[^ ]+ +${trackId} *$`;
157
- return getMatches(pattern, sdp);
25
+ function getTrackIds(sdp) {
26
+ return getMatches('^a=msid:.+ +(.+) *$', sdp);
158
27
  }
159
28
 
160
29
  /**
@@ -182,12 +51,12 @@ function getMediaSectionSSRCs(mediaSection) {
182
51
  }
183
52
 
184
53
  /**
185
- * Get a Set of SSRCs for a MediaStreamTrack from a Unified Plan SDP.
186
- * @param {string} sdp - Unified Plan SDP
54
+ * Get a Set of SSRCs for a MediaStreamTrack from an SDP.
55
+ * @param {string} sdp - SDP
187
56
  * @param {string} trackId - MediaStreamTrack ID
188
57
  * @returns {Set<string>}
189
58
  */
190
- function getUnifiedPlanSSRCs(sdp, trackId) {
59
+ function getSSRCs(sdp, trackId) {
191
60
  const mediaSections = getMediaSections(sdp);
192
61
 
193
62
  const msidAttrRegExp = new RegExp(`^a=msid:[^ ]+ +${trackId} *$`, 'gm');
@@ -198,43 +67,22 @@ function getUnifiedPlanSSRCs(sdp, trackId) {
198
67
 
199
68
  /**
200
69
  * Get a Map from MediaStreamTrack IDs to SSRCs from an SDP.
201
- * @param {function(string): Set<string>} getTrackIds
202
- * @param {function(string, string): Set<string>} getSSRCs
203
70
  * @param {string} sdp - SDP
204
71
  * @returns {Map<string, Set<string>>} trackIdsToSSRCs
205
72
  */
206
- function getTrackIdsToSSRCs(getTrackIds, getSSRCs, sdp) {
73
+ function getTrackIdsToSSRCs(sdp) {
207
74
  return new Map(Array.from(getTrackIds(sdp)).map(trackId => [trackId, getSSRCs(sdp, trackId)]));
208
75
  }
209
76
 
210
- /**
211
- * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.
212
- * @param {string} sdp - Plan B SDP
213
- * @returns {Map<string, Set<string>>} trackIdsToSSRCs
214
- */
215
- function getPlanBTrackIdsToSSRCs(sdp) {
216
- return getTrackIdsToSSRCs(getPlanBTrackIds, getPlanBSSRCs, sdp);
217
- }
218
-
219
- /**
220
- * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.
221
- * @param {string} sdp - Plan B SDP
222
- * @returns {Map<string, Set<string>>} trackIdsToSSRCs
223
- */
224
- function getUnifiedPlanTrackIdsToSSRCs(sdp) {
225
- return getTrackIdsToSSRCs(getUnifiedPlanTrackIds, getUnifiedPlanSSRCs, sdp);
226
- }
227
-
228
77
  /**
229
78
  * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both
230
79
  * the Map from MediaStreamTrack IDs to SSRCs and the SDP itself. This method
231
80
  * ensures that SSRCs never change once announced.
232
- * @param {function(string): Map<string, Set<string>>} getTrackIdsToSSRCs
233
81
  * @param {Map<string, Set<string>>} trackIdsToSSRCs
234
82
  * @param {string} sdp - SDP
235
- * @returns {strinng} updatedSdp - updated SDP
83
+ * @returns {string} updatedSdp - updated SDP
236
84
  */
237
- function updateTrackIdsToSSRCs(getTrackIdsToSSRCs, trackIdsToSSRCs, sdp) {
85
+ function updateTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {
238
86
  const newTrackIdsToSSRCs = getTrackIdsToSSRCs(sdp);
239
87
  const newSSRCsToOldSSRCs = new Map();
240
88
 
@@ -275,36 +123,7 @@ function updateTrackIdsToSSRCs(getTrackIdsToSSRCs, trackIdsToSSRCs, sdp) {
275
123
  return sdp;
276
124
  }
277
125
 
278
- /**
279
- * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both
280
- * the Map from MediaStreamTrack IDs to SSRCs and the Plan B SDP itself. This
281
- * method ensures that SSRCs never change once announced.
282
- * @param {Map<string, Set<string>>} trackIdsToSSRCs
283
- * @param {string} sdp - Plan B SDP
284
- * @returns {string} updatedSdp - updated Plan B SDP
285
- */
286
- function updatePlanBTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {
287
- return updateTrackIdsToSSRCs(getPlanBTrackIdsToSSRCs, trackIdsToSSRCs, sdp);
288
- }
289
-
290
- /**
291
- * Update the mappings from MediaStreamTrack IDs to SSRCs as indicated by both
292
- * the Map from MediaStreamTrack IDs to SSRCs and the Plan B SDP itself. This
293
- * method ensures that SSRCs never change once announced.
294
- * @param {Map<string, Set<string>>} trackIdsToSSRCs
295
- * @param {string} sdp - Plan B SDP
296
- * @returns {string} updatedSdp - updated Plan B SDP
297
- */
298
- function updateUnifiedPlanTrackIdsToSSRCs(trackIdsToSSRCs, sdp) {
299
- return updateTrackIdsToSSRCs(getUnifiedPlanTrackIdsToSSRCs, trackIdsToSSRCs, sdp);
300
- }
301
-
302
- exports.clearChromeCachedSdpFormat = clearChromeCachedSdpFormat;
303
- exports.getSdpFormat = getSdpFormat;
304
126
  exports.getMediaSections = getMediaSections;
305
- exports.getPlanBTrackIds = getPlanBTrackIds;
306
- exports.getUnifiedPlanTrackIds = getUnifiedPlanTrackIds;
307
- exports.getPlanBSSRCs = getPlanBSSRCs;
308
- exports.getUnifiedPlanSSRCs = getUnifiedPlanSSRCs;
309
- exports.updatePlanBTrackIdsToSSRCs = updatePlanBTrackIdsToSSRCs;
310
- exports.updateUnifiedPlanTrackIdsToSSRCs = updateUnifiedPlanTrackIdsToSSRCs;
127
+ exports.getTrackIds = getTrackIds;
128
+ exports.getSSRCs = getSSRCs;
129
+ exports.updateTrackIdsToSSRCs = updateTrackIdsToSSRCs;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "twilio-video",
3
3
  "title": "Twilio Video",
4
4
  "description": "Twilio Video JavaScript Library",
5
- "version": "2.34.0",
5
+ "version": "2.35.0",
6
6
  "homepage": "https://twilio.com",
7
7
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
8
8
  "contributors": [
@@ -76,19 +76,23 @@
76
76
  "node-http-server": "^8.1.2",
77
77
  "npm-run-all": "^4.1.5",
78
78
  "nyc": "^15.1.0",
79
+ "puppeteer": "19.2.2",
79
80
  "regex-replace": "^2.3.1",
80
81
  "requirejs": "^2.3.3",
81
82
  "rimraf": "^2.6.1",
82
83
  "simple-git": "^1.126.0",
83
84
  "sinon": "^4.0.1",
84
85
  "ts-node": "^10.9.2",
86
+ "rollup": "^4.41.0",
87
+ "@rollup/plugin-alias": "^5.1.1",
88
+ "@rollup/plugin-commonjs": "^28.0.6",
89
+ "@rollup/plugin-json": "^6.1.0",
90
+ "@rollup/plugin-node-resolve": "^16.0.3",
91
+ "@rollup/plugin-terser": "^0.4.4",
85
92
  "twilio": "^3.49.0",
86
93
  "twilio-release-tool": "^1.0.2",
87
94
  "typescript": "5.9.3",
88
- "uglify-js": "^2.8.22",
89
95
  "vinyl-fs": "^2.4.4",
90
- "vinyl-source-stream": "^1.1.0",
91
- "watchify": "^4.0.0",
92
96
  "webrtc-adapter": "^7.7.1"
93
97
  },
94
98
  "engines": {
@@ -108,7 +112,6 @@
108
112
  "test:serversiderender": "mocha --exit ./test/serversiderender/index.js",
109
113
  "test:integration:adapter": "node ./scripts/karma.js karma/integration.adapter.conf.js",
110
114
  "test:integration": "npm run build:es5 && node ./scripts/karma.js karma/integration.conf.js",
111
- "test:umd:install": "npm install puppeteer@19.2.2",
112
115
  "test:umd": "mocha --exit ./test/umd/index.js",
113
116
  "test:crossbrowser:build:clean": "rimraf ./test/crossbrowser/lib ./test/crossbrowser/src/browser/index.js",
114
117
  "test:crossbrowser:build:lint": "cd ./test/crossbrowser && eslint '**/*.ts'",
@@ -140,17 +143,19 @@
140
143
  "test:framework:install": "npm install chromedriver && npm install selenium-webdriver && npm install geckodriver && npm install puppeteer",
141
144
  "test:framework": "npm-run-all test:framework:install test:framework:no-framework test:framework:react",
142
145
  "test": "npm-run-all test:unit test:integration",
143
- "build:es5": "rimraf ./es5 && mkdir -p es5 && npm run patch-linkifyit-111 && tsc tsdef/twilio-video-tests.ts --noEmit --lib es2018,dom && tsc",
144
- "build:js": "node ./scripts/build.js ./src/twilio-video.js ./LICENSE.md ./dist/twilio-video.js",
145
- "build:min.js": "uglifyjs ./dist/twilio-video.js -o ./dist/twilio-video.min.js --comments \"/^! twilio-video.js/\" -b beautify=false,ascii_only=true",
146
- "build": "npm-run-all clean lint docs test:unit test:integration build:es5 build:js build:min.js test:umd",
147
- "build:quick": "npm-run-all clean lint docs build:es5 build:js build:min.js",
146
+ "typecheck": "npm run patch-linkifyit-111 && tsc tsdef/twilio-video-tests.ts --noEmit --lib es2018,dom && tsc --noEmit",
147
+ "build:es5": "npm run clean && npm run typecheck && tsc && rollup -c rollup.config.mjs",
148
+ "build": "npm-run-all clean lint docs test:unit test:integration build:es5 test:umd",
149
+ "build:quick": "npm-run-all clean lint docs build:es5",
148
150
  "docs": "node ./scripts/docs.js ./dist/docs",
149
- "watch": "tsc -w",
151
+ "watch:tsc": "tsc -w",
152
+ "watch:rollup": "rollup -c rollup.config.mjs --watch",
153
+ "watch": "npm-run-all -p watch:tsc watch:rollup",
150
154
  "clean": "rimraf ./coverage ./es5 ./dist"
151
155
  },
152
156
  "dependencies": {
153
157
  "events": "^3.3.0",
158
+ "tslib": "^2.8.1",
154
159
  "util": "^0.12.4",
155
160
  "ws": "^8.18.3"
156
161
  },