werift 0.19.3 → 0.19.5

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 (370) hide show
  1. package/lib/common/src/binary.d.ts +0 -1
  2. package/lib/common/src/binary.js +14 -14
  3. package/lib/common/src/binary.js.map +1 -1
  4. package/lib/common/src/network.d.ts +1 -2
  5. package/lib/common/src/network.js +4 -4
  6. package/lib/common/src/network.js.map +1 -1
  7. package/lib/common/src/number.js +10 -10
  8. package/lib/common/src/number.js.map +1 -1
  9. package/lib/dtls/src/cipher/create.d.ts +1 -1
  10. package/lib/dtls/src/cipher/create.js +2 -3
  11. package/lib/dtls/src/cipher/create.js.map +1 -1
  12. package/lib/dtls/src/cipher/ec.d.ts +0 -1
  13. package/lib/dtls/src/cipher/key-exchange.js +7 -7
  14. package/lib/dtls/src/cipher/key-exchange.js.map +1 -1
  15. package/lib/dtls/src/cipher/namedCurve.d.ts +1 -2
  16. package/lib/dtls/src/cipher/namedCurve.js +1 -2
  17. package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
  18. package/lib/dtls/src/cipher/prf.d.ts +1 -2
  19. package/lib/dtls/src/cipher/prf.js +11 -12
  20. package/lib/dtls/src/cipher/prf.js.map +1 -1
  21. package/lib/dtls/src/cipher/suites/abstract.d.ts +1 -2
  22. package/lib/dtls/src/cipher/suites/abstract.js.map +1 -1
  23. package/lib/dtls/src/cipher/suites/aead.d.ts +1 -2
  24. package/lib/dtls/src/cipher/suites/aead.js.map +1 -1
  25. package/lib/dtls/src/client.d.ts +1 -1
  26. package/lib/dtls/src/client.js.map +1 -1
  27. package/lib/dtls/src/context/cipher.d.ts +6 -7
  28. package/lib/dtls/src/context/cipher.js +5 -3
  29. package/lib/dtls/src/context/cipher.js.map +1 -1
  30. package/lib/dtls/src/context/dtls.d.ts +5 -6
  31. package/lib/dtls/src/context/dtls.js +1 -2
  32. package/lib/dtls/src/context/dtls.js.map +1 -1
  33. package/lib/dtls/src/context/transport.d.ts +1 -2
  34. package/lib/dtls/src/context/transport.js.map +1 -1
  35. package/lib/dtls/src/flight/client/flight1.d.ts +4 -4
  36. package/lib/dtls/src/flight/client/flight1.js.map +1 -1
  37. package/lib/dtls/src/flight/client/flight3.d.ts +3 -3
  38. package/lib/dtls/src/flight/client/flight3.js +6 -0
  39. package/lib/dtls/src/flight/client/flight3.js.map +1 -1
  40. package/lib/dtls/src/flight/client/flight5.d.ts +4 -4
  41. package/lib/dtls/src/flight/client/flight5.js.map +1 -1
  42. package/lib/dtls/src/flight/flight.d.ts +3 -4
  43. package/lib/dtls/src/flight/flight.js.map +1 -1
  44. package/lib/dtls/src/flight/server/flight2.d.ts +4 -4
  45. package/lib/dtls/src/flight/server/flight2.js +9 -2
  46. package/lib/dtls/src/flight/server/flight2.js.map +1 -1
  47. package/lib/dtls/src/flight/server/flight4.d.ts +5 -5
  48. package/lib/dtls/src/flight/server/flight4.js.map +1 -1
  49. package/lib/dtls/src/flight/server/flight6.d.ts +4 -4
  50. package/lib/dtls/src/flight/server/flight6.js.map +1 -1
  51. package/lib/dtls/src/handshake/extensions/ellipticCurves.d.ts +1 -2
  52. package/lib/dtls/src/handshake/extensions/ellipticCurves.js.map +1 -1
  53. package/lib/dtls/src/handshake/extensions/renegotiationIndication.d.ts +0 -1
  54. package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -2
  55. package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
  56. package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +1 -2
  57. package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
  58. package/lib/dtls/src/handshake/message/alert.d.ts +0 -1
  59. package/lib/dtls/src/handshake/message/alert.js.map +1 -1
  60. package/lib/dtls/src/handshake/message/certificate.d.ts +1 -2
  61. package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
  62. package/lib/dtls/src/handshake/message/changeCipherSpec.d.ts +0 -1
  63. package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +2 -3
  64. package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
  65. package/lib/dtls/src/handshake/message/client/hello.d.ts +1 -2
  66. package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
  67. package/lib/dtls/src/handshake/message/client/keyExchange.d.ts +1 -2
  68. package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
  69. package/lib/dtls/src/handshake/message/finished.d.ts +1 -2
  70. package/lib/dtls/src/handshake/message/finished.js.map +1 -1
  71. package/lib/dtls/src/handshake/message/server/certificateRequest.d.ts +2 -3
  72. package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
  73. package/lib/dtls/src/handshake/message/server/hello.d.ts +2 -3
  74. package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
  75. package/lib/dtls/src/handshake/message/server/helloDone.d.ts +1 -2
  76. package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
  77. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.d.ts +1 -2
  78. package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
  79. package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +2 -3
  80. package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
  81. package/lib/dtls/src/handshake/random.d.ts +0 -1
  82. package/lib/dtls/src/helper.d.ts +0 -1
  83. package/lib/dtls/src/helper.js +3 -3
  84. package/lib/dtls/src/helper.js.map +1 -1
  85. package/lib/dtls/src/record/builder.d.ts +2 -3
  86. package/lib/dtls/src/record/builder.js +2 -4
  87. package/lib/dtls/src/record/builder.js.map +1 -1
  88. package/lib/dtls/src/record/message/fragment.d.ts +1 -2
  89. package/lib/dtls/src/record/message/fragment.js.map +1 -1
  90. package/lib/dtls/src/record/message/header.d.ts +0 -1
  91. package/lib/dtls/src/record/message/plaintext.d.ts +0 -1
  92. package/lib/dtls/src/record/receive.d.ts +2 -3
  93. package/lib/dtls/src/record/receive.js.map +1 -1
  94. package/lib/dtls/src/server.d.ts +1 -1
  95. package/lib/dtls/src/server.js.map +1 -1
  96. package/lib/dtls/src/socket.d.ts +5 -6
  97. package/lib/dtls/src/socket.js +17 -23
  98. package/lib/dtls/src/socket.js.map +1 -1
  99. package/lib/dtls/src/transport.d.ts +1 -3
  100. package/lib/dtls/src/transport.js.map +1 -1
  101. package/lib/dtls/src/typings/domain.d.ts +2 -3
  102. package/lib/dtls/src/typings/domain.js.map +1 -1
  103. package/lib/dtls/src/util/binary.d.ts +0 -1
  104. package/lib/dtls/src/util/binary.js +1 -2
  105. package/lib/dtls/src/util/binary.js.map +1 -1
  106. package/lib/ice/src/candidate.js +3 -3
  107. package/lib/ice/src/candidate.js.map +1 -1
  108. package/lib/ice/src/dns/lookup.d.ts +1 -1
  109. package/lib/ice/src/dns/lookup.js +1 -0
  110. package/lib/ice/src/dns/lookup.js.map +1 -1
  111. package/lib/ice/src/exceptions.js.map +1 -1
  112. package/lib/ice/src/helper.d.ts +0 -1
  113. package/lib/ice/src/helper.js +5 -5
  114. package/lib/ice/src/helper.js.map +1 -1
  115. package/lib/ice/src/ice.d.ts +3 -2
  116. package/lib/ice/src/ice.js +25 -16
  117. package/lib/ice/src/ice.js.map +1 -1
  118. package/lib/ice/src/stun/attributes.d.ts +0 -1
  119. package/lib/ice/src/stun/attributes.js +5 -5
  120. package/lib/ice/src/stun/attributes.js.map +1 -1
  121. package/lib/ice/src/stun/message.d.ts +0 -1
  122. package/lib/ice/src/stun/message.js +2 -2
  123. package/lib/ice/src/stun/message.js.map +1 -1
  124. package/lib/ice/src/stun/protocol.d.ts +0 -1
  125. package/lib/ice/src/stun/transaction.d.ts +1 -1
  126. package/lib/ice/src/transport.d.ts +1 -4
  127. package/lib/ice/src/turn/protocol.d.ts +1 -2
  128. package/lib/ice/src/turn/protocol.js +5 -4
  129. package/lib/ice/src/turn/protocol.js.map +1 -1
  130. package/lib/ice/src/types/model.d.ts +0 -1
  131. package/lib/ice/src/utils.js +3 -4
  132. package/lib/ice/src/utils.js.map +1 -1
  133. package/lib/rtp/src/codec/av1.d.ts +1 -2
  134. package/lib/rtp/src/codec/av1.js +2 -2
  135. package/lib/rtp/src/codec/av1.js.map +1 -1
  136. package/lib/rtp/src/codec/base.d.ts +1 -2
  137. package/lib/rtp/src/codec/base.js.map +1 -1
  138. package/lib/rtp/src/codec/h264.d.ts +2 -3
  139. package/lib/rtp/src/codec/h264.js.map +1 -1
  140. package/lib/rtp/src/codec/index.d.ts +1 -2
  141. package/lib/rtp/src/codec/index.js +2 -2
  142. package/lib/rtp/src/codec/index.js.map +1 -1
  143. package/lib/rtp/src/codec/opus.d.ts +2 -3
  144. package/lib/rtp/src/codec/opus.js.map +1 -1
  145. package/lib/rtp/src/codec/vp8.d.ts +2 -3
  146. package/lib/rtp/src/codec/vp8.js +1 -1
  147. package/lib/rtp/src/codec/vp8.js.map +1 -1
  148. package/lib/rtp/src/codec/vp9.d.ts +2 -3
  149. package/lib/rtp/src/codec/vp9.js +1 -1
  150. package/lib/rtp/src/codec/vp9.js.map +1 -1
  151. package/lib/rtp/src/extra/container/mp4/h264.d.ts +0 -1
  152. package/lib/rtp/src/extra/container/mp4/h264.js +2 -2
  153. package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
  154. package/lib/rtp/src/extra/container/mp4/mp4box.d.ts +1 -1
  155. package/lib/rtp/src/extra/container/mp4/mp4box.js +3 -3
  156. package/lib/rtp/src/extra/container/mp4/mp4box.js.map +1 -1
  157. package/lib/rtp/src/extra/container/ogg/parser.d.ts +0 -1
  158. package/lib/rtp/src/extra/container/webm/container.d.ts +0 -1
  159. package/lib/rtp/src/extra/container/webm/container.js +2 -3
  160. package/lib/rtp/src/extra/container/webm/container.js.map +1 -1
  161. package/lib/rtp/src/extra/container/webm/ebml/typedArrayUtils.js +2 -2
  162. package/lib/rtp/src/extra/container/webm/ebml/typedArrayUtils.js.map +1 -1
  163. package/lib/rtp/src/extra/processor/depacketizer.d.ts +2 -3
  164. package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
  165. package/lib/rtp/src/extra/processor/depacketizerCallback.d.ts +1 -1
  166. package/lib/rtp/src/extra/processor/depacketizerCallback.js.map +1 -1
  167. package/lib/rtp/src/extra/processor/depacketizerTransformer.d.ts +2 -3
  168. package/lib/rtp/src/extra/processor/depacketizerTransformer.js.map +1 -1
  169. package/lib/rtp/src/extra/processor/dtx.d.ts +2 -3
  170. package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
  171. package/lib/rtp/src/extra/processor/dtxCallback.js.map +1 -1
  172. package/lib/rtp/src/extra/processor/interface.d.ts +2 -2
  173. package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +2 -2
  174. package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
  175. package/lib/rtp/src/extra/processor/jitterBufferCallback.d.ts +1 -1
  176. package/lib/rtp/src/extra/processor/jitterBufferCallback.js.map +1 -1
  177. package/lib/rtp/src/extra/processor/jitterBufferTransformer.d.ts +1 -2
  178. package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
  179. package/lib/rtp/src/extra/processor/lipsync.d.ts +3 -4
  180. package/lib/rtp/src/extra/processor/lipsync.js +2 -2
  181. package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
  182. package/lib/rtp/src/extra/processor/lipsyncCallback.d.ts +1 -1
  183. package/lib/rtp/src/extra/processor/lipsyncCallback.js.map +1 -1
  184. package/lib/rtp/src/extra/processor/mp4.d.ts +2 -3
  185. package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
  186. package/lib/rtp/src/extra/processor/mp4Callback.d.ts +2 -2
  187. package/lib/rtp/src/extra/processor/mp4Callback.js.map +1 -1
  188. package/lib/rtp/src/extra/processor/mute.d.ts +2 -3
  189. package/lib/rtp/src/extra/processor/mute.js.map +1 -1
  190. package/lib/rtp/src/extra/processor/muteCallback.d.ts +2 -2
  191. package/lib/rtp/src/extra/processor/muteCallback.js.map +1 -1
  192. package/lib/rtp/src/extra/processor/nack.d.ts +2 -2
  193. package/lib/rtp/src/extra/processor/nack.js.map +1 -1
  194. package/lib/rtp/src/extra/processor/nackHandlerCallback.js.map +1 -1
  195. package/lib/rtp/src/extra/processor/ntpTime.d.ts +2 -2
  196. package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
  197. package/lib/rtp/src/extra/processor/ntpTimeCallback.d.ts +1 -1
  198. package/lib/rtp/src/extra/processor/ntpTimeCallback.js.map +1 -1
  199. package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +2 -2
  200. package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
  201. package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -2
  202. package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
  203. package/lib/rtp/src/extra/processor/rtpStream.d.ts +2 -4
  204. package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
  205. package/lib/rtp/src/extra/processor/rtpTime.d.ts +2 -2
  206. package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
  207. package/lib/rtp/src/extra/processor/rtpTimeCallback.d.ts +1 -1
  208. package/lib/rtp/src/extra/processor/rtpTimeCallback.js.map +1 -1
  209. package/lib/rtp/src/extra/processor/webm.d.ts +2 -3
  210. package/lib/rtp/src/extra/processor/webm.js +2 -2
  211. package/lib/rtp/src/extra/processor/webm.js.map +1 -1
  212. package/lib/rtp/src/extra/processor/webmCallback.d.ts +2 -2
  213. package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
  214. package/lib/rtp/src/extra/processor/webmStream.d.ts +2 -3
  215. package/lib/rtp/src/extra/processor/webmStream.js.map +1 -1
  216. package/lib/rtp/src/helper.d.ts +0 -1
  217. package/lib/rtp/src/helper.js +6 -6
  218. package/lib/rtp/src/helper.js.map +1 -1
  219. package/lib/rtp/src/index.d.ts +0 -1
  220. package/lib/rtp/src/rtcp/header.d.ts +0 -1
  221. package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +0 -1
  222. package/lib/rtp/src/rtcp/psfb/index.d.ts +1 -2
  223. package/lib/rtp/src/rtcp/psfb/index.js.map +1 -1
  224. package/lib/rtp/src/rtcp/psfb/pictureLossIndication.d.ts +0 -1
  225. package/lib/rtp/src/rtcp/psfb/remb.d.ts +0 -1
  226. package/lib/rtp/src/rtcp/rr.d.ts +0 -1
  227. package/lib/rtp/src/rtcp/rtcp.d.ts +0 -1
  228. package/lib/rtp/src/rtcp/rtcp.js +2 -2
  229. package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
  230. package/lib/rtp/src/rtcp/rtpfb/index.d.ts +1 -2
  231. package/lib/rtp/src/rtcp/rtpfb/index.js.map +1 -1
  232. package/lib/rtp/src/rtcp/rtpfb/nack.d.ts +0 -1
  233. package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +0 -1
  234. package/lib/rtp/src/rtcp/rtpfb/twcc.js +1 -2
  235. package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
  236. package/lib/rtp/src/rtcp/sdes.d.ts +1 -2
  237. package/lib/rtp/src/rtcp/sdes.js.map +1 -1
  238. package/lib/rtp/src/rtcp/sr.d.ts +0 -1
  239. package/lib/rtp/src/rtp/headerExtension.d.ts +1 -2
  240. package/lib/rtp/src/rtp/headerExtension.js +12 -12
  241. package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
  242. package/lib/rtp/src/rtp/red/encoder.d.ts +0 -1
  243. package/lib/rtp/src/rtp/red/handler.d.ts +1 -1
  244. package/lib/rtp/src/rtp/red/handler.js.map +1 -1
  245. package/lib/rtp/src/rtp/red/packet.d.ts +0 -1
  246. package/lib/rtp/src/rtp/rtp.d.ts +0 -1
  247. package/lib/rtp/src/rtp/rtp.js.map +1 -1
  248. package/lib/rtp/src/rtp/rtx.js +2 -3
  249. package/lib/rtp/src/rtp/rtx.js.map +1 -1
  250. package/lib/rtp/src/srtp/cipher/ctr.d.ts +0 -1
  251. package/lib/rtp/src/srtp/cipher/gcm.d.ts +0 -1
  252. package/lib/rtp/src/srtp/cipher/index.d.ts +2 -3
  253. package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
  254. package/lib/rtp/src/srtp/context/context.d.ts +3 -5
  255. package/lib/rtp/src/srtp/context/context.js.map +1 -1
  256. package/lib/rtp/src/srtp/context/srtcp.d.ts +2 -3
  257. package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
  258. package/lib/rtp/src/srtp/context/srtp.d.ts +1 -2
  259. package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
  260. package/lib/rtp/src/srtp/session.d.ts +1 -2
  261. package/lib/rtp/src/srtp/session.js.map +1 -1
  262. package/lib/rtp/src/srtp/srtcp.d.ts +1 -2
  263. package/lib/rtp/src/srtp/srtcp.js.map +1 -1
  264. package/lib/rtp/src/srtp/srtp.d.ts +2 -3
  265. package/lib/rtp/src/srtp/srtp.js.map +1 -1
  266. package/lib/rtp/src/util.d.ts +0 -1
  267. package/lib/sctp/src/chunk.d.ts +0 -1
  268. package/lib/sctp/src/chunk.js +4 -4
  269. package/lib/sctp/src/chunk.js.map +1 -1
  270. package/lib/sctp/src/helper.js +2 -3
  271. package/lib/sctp/src/helper.js.map +1 -1
  272. package/lib/sctp/src/param.d.ts +0 -1
  273. package/lib/sctp/src/param.js.map +1 -1
  274. package/lib/sctp/src/sctp.d.ts +5 -6
  275. package/lib/sctp/src/sctp.js.map +1 -1
  276. package/lib/sctp/src/transport.d.ts +1 -3
  277. package/lib/sctp/src/transport.js.map +1 -1
  278. package/lib/webrtc/src/const.d.ts +1 -1
  279. package/lib/webrtc/src/const.js.map +1 -1
  280. package/lib/webrtc/src/dataChannel.d.ts +2 -3
  281. package/lib/webrtc/src/dataChannel.js.map +1 -1
  282. package/lib/webrtc/src/helper.d.ts +0 -1
  283. package/lib/webrtc/src/helper.js +3 -3
  284. package/lib/webrtc/src/helper.js.map +1 -1
  285. package/lib/webrtc/src/media/extension/rtcpFeedback.d.ts +1 -1
  286. package/lib/webrtc/src/media/extension/rtcpFeedback.js.map +1 -1
  287. package/lib/webrtc/src/media/extension/rtpExtension.js +7 -8
  288. package/lib/webrtc/src/media/extension/rtpExtension.js.map +1 -1
  289. package/lib/webrtc/src/media/parameters.d.ts +1 -1
  290. package/lib/webrtc/src/media/parameters.js.map +1 -1
  291. package/lib/webrtc/src/media/receiver/nack.d.ts +2 -2
  292. package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
  293. package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +1 -1
  294. package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
  295. package/lib/webrtc/src/media/receiver/statistics.d.ts +1 -1
  296. package/lib/webrtc/src/media/receiver/statistics.js.map +1 -1
  297. package/lib/webrtc/src/media/router.d.ts +4 -4
  298. package/lib/webrtc/src/media/router.js.map +1 -1
  299. package/lib/webrtc/src/media/rtpReceiver.d.ts +7 -7
  300. package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
  301. package/lib/webrtc/src/media/rtpSender.d.ts +5 -6
  302. package/lib/webrtc/src/media/rtpSender.js.map +1 -1
  303. package/lib/webrtc/src/media/rtpTransceiver.d.ts +6 -6
  304. package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
  305. package/lib/webrtc/src/media/sender/senderBWE.d.ts +1 -1
  306. package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
  307. package/lib/webrtc/src/media/track.d.ts +6 -5
  308. package/lib/webrtc/src/media/track.js +14 -1
  309. package/lib/webrtc/src/media/track.js.map +1 -1
  310. package/lib/webrtc/src/nonstandard/index.d.ts +2 -0
  311. package/lib/webrtc/src/nonstandard/index.js +2 -0
  312. package/lib/webrtc/src/nonstandard/index.js.map +1 -1
  313. package/lib/webrtc/src/nonstandard/navigator.d.ts +73 -0
  314. package/lib/webrtc/src/nonstandard/navigator.js +88 -0
  315. package/lib/webrtc/src/nonstandard/navigator.js.map +1 -0
  316. package/lib/webrtc/src/nonstandard/recorder/index.d.ts +23 -7
  317. package/lib/webrtc/src/nonstandard/recorder/index.js +30 -27
  318. package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
  319. package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +17 -5
  320. package/lib/webrtc/src/nonstandard/recorder/writer/index.js +3 -9
  321. package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
  322. package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +1 -1
  323. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +23 -12
  324. package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
  325. package/lib/webrtc/src/nonstandard/userMedia.d.ts +4 -5
  326. package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
  327. package/lib/webrtc/src/peerConnection.d.ts +10 -10
  328. package/lib/webrtc/src/peerConnection.js +15 -21
  329. package/lib/webrtc/src/peerConnection.js.map +1 -1
  330. package/lib/webrtc/src/sdp.d.ts +4 -4
  331. package/lib/webrtc/src/sdp.js +21 -21
  332. package/lib/webrtc/src/sdp.js.map +1 -1
  333. package/lib/webrtc/src/transport/dtls.d.ts +8 -8
  334. package/lib/webrtc/src/transport/dtls.js +16 -3
  335. package/lib/webrtc/src/transport/dtls.js.map +1 -1
  336. package/lib/webrtc/src/transport/ice.d.ts +1 -1
  337. package/lib/webrtc/src/transport/ice.js +3 -3
  338. package/lib/webrtc/src/transport/ice.js.map +1 -1
  339. package/lib/webrtc/src/transport/sctp.d.ts +1 -2
  340. package/lib/webrtc/src/transport/sctp.js +1 -1
  341. package/lib/webrtc/src/transport/sctp.js.map +1 -1
  342. package/lib/webrtc/src/utils.d.ts +5 -5
  343. package/lib/webrtc/src/utils.js +16 -10
  344. package/lib/webrtc/src/utils.js.map +1 -1
  345. package/package.json +12 -8
  346. package/src/const.ts +1 -1
  347. package/src/dataChannel.ts +2 -2
  348. package/src/media/extension/rtcpFeedback.ts +1 -1
  349. package/src/media/parameters.ts +1 -1
  350. package/src/media/receiver/nack.ts +9 -6
  351. package/src/media/receiver/receiverTwcc.ts +3 -3
  352. package/src/media/receiver/statistics.ts +1 -1
  353. package/src/media/router.ts +45 -39
  354. package/src/media/rtpReceiver.ts +30 -19
  355. package/src/media/rtpSender.ts +84 -71
  356. package/src/media/rtpTransceiver.ts +6 -6
  357. package/src/media/sender/senderBWE.ts +1 -1
  358. package/src/media/track.ts +19 -5
  359. package/src/nonstandard/index.ts +2 -0
  360. package/src/nonstandard/navigator.ts +118 -0
  361. package/src/nonstandard/recorder/index.ts +47 -19
  362. package/src/nonstandard/recorder/writer/index.ts +7 -4
  363. package/src/nonstandard/recorder/writer/webm.ts +25 -14
  364. package/src/nonstandard/userMedia.ts +1 -1
  365. package/src/peerConnection.ts +43 -51
  366. package/src/sdp.ts +108 -94
  367. package/src/transport/dtls.ts +28 -14
  368. package/src/transport/ice.ts +1 -1
  369. package/src/transport/sctp.ts +75 -67
  370. package/src/utils.ts +13 -6
@@ -3,31 +3,39 @@ import Event from "rx.mini";
3
3
  import { setTimeout } from "timers/promises";
4
4
  import { v4 as uuid } from "uuid";
5
5
 
6
- import { PeerConfig, codecParametersFromString, usePLI, useTWCC } from "..";
6
+ import {
7
+ type PeerConfig,
8
+ codecParametersFromString,
9
+ usePLI,
10
+ useTWCC,
11
+ } from "..";
7
12
  import { int } from "../../../common/src";
8
13
  import {
9
14
  PictureLossIndication,
10
15
  RTP_EXTENSION_URI,
11
16
  Red,
12
17
  RedHandler,
13
- RtcpPacket,
18
+ type RtcpPacket,
14
19
  RtcpPayloadSpecificFeedback,
15
20
  RtcpReceiverInfo,
16
21
  RtcpRrPacket,
17
22
  RtcpSrPacket,
18
- RtpPacket,
19
- TransportWideCCPayload,
23
+ type RtpPacket,
24
+ type TransportWideCCPayload,
20
25
  unwrapRtx,
21
26
  } from "../../../rtp/src";
22
- import { RTCDtlsTransport } from "../transport/dtls";
23
- import { Kind } from "../types/domain";
27
+ import type { RTCDtlsTransport } from "../transport/dtls";
28
+ import type { Kind } from "../types/domain";
24
29
  import { compactNtp, timestampSeconds } from "../utils";
25
- import { RTCRtpCodecParameters, RTCRtpReceiveParameters } from "./parameters";
30
+ import type {
31
+ RTCRtpCodecParameters,
32
+ RTCRtpReceiveParameters,
33
+ } from "./parameters";
26
34
  import { NackHandler } from "./receiver/nack";
27
35
  import { ReceiverTWCC } from "./receiver/receiverTwcc";
28
36
  import { StreamStatistics } from "./receiver/statistics";
29
- import { Extensions } from "./router";
30
- import { MediaStreamTrack } from "./track";
37
+ import type { Extensions } from "./router";
38
+ import type { MediaStreamTrack } from "./track";
31
39
 
32
40
  const log = debug("werift:packages/webrtc/src/media/rtpReceiver.ts");
33
41
 
@@ -236,17 +244,20 @@ export class RTCRtpReceiver {
236
244
 
237
245
  handleRtcpPacket(packet: RtcpPacket) {
238
246
  switch (packet.type) {
239
- case RtcpSrPacket.type: {
240
- const sr = packet as RtcpSrPacket;
241
- this.lastSRtimestamp[sr.ssrc] = compactNtp(sr.senderInfo.ntpTimestamp);
242
- this.receiveLastSRTimestamp[sr.ssrc] = timestampSeconds();
243
-
244
- const track = this.trackBySSRC[packet.ssrc];
245
- if (track) {
246
- track.onReceiveRtcp.execute(packet);
247
+ case RtcpSrPacket.type:
248
+ {
249
+ const sr = packet as RtcpSrPacket;
250
+ this.lastSRtimestamp[sr.ssrc] = compactNtp(
251
+ sr.senderInfo.ntpTimestamp,
252
+ );
253
+ this.receiveLastSRTimestamp[sr.ssrc] = timestampSeconds();
254
+
255
+ const track = this.trackBySSRC[packet.ssrc];
256
+ if (track) {
257
+ track.onReceiveRtcp.execute(packet);
258
+ }
247
259
  }
248
- }
249
- break;
260
+ break;
250
261
  }
251
262
  this.onRtcp.execute(packet);
252
263
  }
@@ -30,20 +30,20 @@ import * as uuid from "uuid";
30
30
  import { codecParametersFromString } from "..";
31
31
  import { random16, uint16Add, uint32Add } from "../../../common/src";
32
32
  import {
33
- Extension,
33
+ type Extension,
34
34
  GenericNack,
35
35
  PictureLossIndication,
36
36
  RTP_EXTENSION_URI,
37
37
  ReceiverEstimatedMaxBitrate,
38
38
  RedEncoder,
39
- RtcpPacket,
39
+ type RtcpPacket,
40
40
  RtcpPayloadSpecificFeedback,
41
41
  RtcpRrPacket,
42
42
  RtcpSenderInfo,
43
43
  RtcpSourceDescriptionPacket,
44
44
  RtcpSrPacket,
45
45
  RtcpTransportLayerFeedback,
46
- RtpHeader,
46
+ type RtpHeader,
47
47
  RtpPacket,
48
48
  SourceDescriptionChunk,
49
49
  SourceDescriptionItem,
@@ -55,16 +55,16 @@ import {
55
55
  serializeTransportWideCC,
56
56
  wrapRtx,
57
57
  } from "../../../rtp/src";
58
- import { RTCDtlsTransport } from "../transport/dtls";
59
- import { Kind } from "../types/domain";
58
+ import type { RTCDtlsTransport } from "../transport/dtls";
59
+ import type { Kind } from "../types/domain";
60
60
  import { compactNtp, milliTime, ntpTime, timestampSeconds } from "../utils";
61
- import {
61
+ import type {
62
62
  RTCRtpCodecParameters,
63
63
  RTCRtpHeaderExtensionParameters,
64
64
  RTCRtpSendParameters,
65
65
  } from "./parameters";
66
- import { SenderBandwidthEstimator, SentInfo } from "./sender/senderBWE";
67
- import { MediaStreamTrack } from "./track";
66
+ import { SenderBandwidthEstimator, type SentInfo } from "./sender/senderBWE";
67
+ import type { MediaStreamTrack } from "./track";
68
68
 
69
69
  const log = debug("werift:packages/webrtc/src/media/rtpSender.ts");
70
70
 
@@ -410,77 +410,90 @@ export class RTCRtpSender {
410
410
  handleRtcpPacket(rtcpPacket: RtcpPacket) {
411
411
  switch (rtcpPacket.type) {
412
412
  case RtcpSrPacket.type:
413
- case RtcpRrPacket.type: {
414
- const packet = rtcpPacket as RtcpSrPacket | RtcpRrPacket;
415
- packet.reports
416
- .filter((report) => report.ssrc === this.ssrc)
417
- .forEach((report) => {
418
- if (this.lastSRtimestamp === report.lsr && report.dlsr) {
419
- if (this.lastSentSRTimestamp) {
420
- const rtt =
421
- timestampSeconds() -
422
- this.lastSentSRTimestamp -
423
- report.dlsr / 65536;
424
- if (this.rtt === undefined) {
425
- this.rtt = rtt;
426
- } else {
427
- this.rtt = RTT_ALPHA * this.rtt + (1 - RTT_ALPHA) * rtt;
413
+ case RtcpRrPacket.type:
414
+ {
415
+ const packet = rtcpPacket as RtcpSrPacket | RtcpRrPacket;
416
+ packet.reports
417
+ .filter((report) => report.ssrc === this.ssrc)
418
+ .forEach((report) => {
419
+ if (this.lastSRtimestamp === report.lsr && report.dlsr) {
420
+ if (this.lastSentSRTimestamp) {
421
+ const rtt =
422
+ timestampSeconds() -
423
+ this.lastSentSRTimestamp -
424
+ report.dlsr / 65536;
425
+ if (this.rtt === undefined) {
426
+ this.rtt = rtt;
427
+ } else {
428
+ this.rtt = RTT_ALPHA * this.rtt + (1 - RTT_ALPHA) * rtt;
429
+ }
428
430
  }
429
431
  }
430
- }
431
- });
432
- }
433
- break;
434
- case RtcpTransportLayerFeedback.type: {
435
- const packet = rtcpPacket as RtcpTransportLayerFeedback;
436
- switch (packet.feedback.count) {
437
- case TransportWideCC.count: {
438
- const feedback = packet.feedback as TransportWideCC;
439
- this.senderBWE.receiveTWCC(feedback);
440
- }
441
- break;
442
- case GenericNack.count: {
443
- const feedback = packet.feedback as GenericNack;
444
- feedback.lost.forEach(async (seqNum) => {
445
- let packet: RtpPacket | undefined =
446
- this.rtpCache[seqNum % RTP_HISTORY_SIZE];
447
- if (packet && packet.header.sequenceNumber !== seqNum) {
448
- packet = undefined;
432
+ });
433
+ }
434
+ break;
435
+ case RtcpTransportLayerFeedback.type:
436
+ {
437
+ const packet = rtcpPacket as RtcpTransportLayerFeedback;
438
+ switch (packet.feedback.count) {
439
+ case TransportWideCC.count:
440
+ {
441
+ const feedback = packet.feedback as TransportWideCC;
442
+ this.senderBWE.receiveTWCC(feedback);
449
443
  }
450
- if (packet) {
451
- if (this.rtxPayloadType != undefined) {
452
- packet = wrapRtx(
453
- packet,
454
- this.rtxPayloadType,
455
- this.rtxSequenceNumber,
456
- this.rtxSsrc,
457
- );
458
- this.rtxSequenceNumber = uint16Add(this.rtxSequenceNumber, 1);
459
- }
460
- await this.dtlsTransport.sendRtp(packet.payload, packet.header);
444
+ break;
445
+ case GenericNack.count:
446
+ {
447
+ const feedback = packet.feedback as GenericNack;
448
+ feedback.lost.forEach(async (seqNum) => {
449
+ let packet: RtpPacket | undefined =
450
+ this.rtpCache[seqNum % RTP_HISTORY_SIZE];
451
+ if (packet && packet.header.sequenceNumber !== seqNum) {
452
+ packet = undefined;
453
+ }
454
+ if (packet) {
455
+ if (this.rtxPayloadType != undefined) {
456
+ packet = wrapRtx(
457
+ packet,
458
+ this.rtxPayloadType,
459
+ this.rtxSequenceNumber,
460
+ this.rtxSsrc,
461
+ );
462
+ this.rtxSequenceNumber = uint16Add(
463
+ this.rtxSequenceNumber,
464
+ 1,
465
+ );
466
+ }
467
+ await this.dtlsTransport.sendRtp(
468
+ packet.payload,
469
+ packet.header,
470
+ );
471
+ }
472
+ });
473
+ this.onGenericNack.execute(feedback);
461
474
  }
462
- });
463
- this.onGenericNack.execute(feedback);
475
+ break;
464
476
  }
465
- break;
466
477
  }
467
- }
468
- break;
469
- case RtcpPayloadSpecificFeedback.type: {
470
- const packet = rtcpPacket as RtcpPayloadSpecificFeedback;
471
- switch (packet.feedback.count) {
472
- case ReceiverEstimatedMaxBitrate.count: {
473
- const feedback = packet.feedback as ReceiverEstimatedMaxBitrate;
474
- this.receiverEstimatedMaxBitrate = feedback.bitrate;
475
- }
476
- break;
477
- case PictureLossIndication.count: {
478
- this.onPictureLossIndication.execute();
478
+ break;
479
+ case RtcpPayloadSpecificFeedback.type:
480
+ {
481
+ const packet = rtcpPacket as RtcpPayloadSpecificFeedback;
482
+ switch (packet.feedback.count) {
483
+ case ReceiverEstimatedMaxBitrate.count:
484
+ {
485
+ const feedback = packet.feedback as ReceiverEstimatedMaxBitrate;
486
+ this.receiverEstimatedMaxBitrate = feedback.bitrate;
487
+ }
488
+ break;
489
+ case PictureLossIndication.count:
490
+ {
491
+ this.onPictureLossIndication.execute();
492
+ }
493
+ break;
479
494
  }
480
- break;
481
495
  }
482
- }
483
- break;
496
+ break;
484
497
  }
485
498
  this.onRtcp.execute(rtcpPacket);
486
499
  }
@@ -1,16 +1,16 @@
1
1
  import Event from "rx.mini";
2
2
  import * as uuid from "uuid";
3
3
 
4
- import { RTCDtlsTransport } from "..";
4
+ import type { RTCDtlsTransport } from "..";
5
5
  import { SenderDirections } from "../const";
6
- import { Kind } from "../types/domain";
7
- import {
6
+ import type { Kind } from "../types/domain";
7
+ import type {
8
8
  RTCRtpCodecParameters,
9
9
  RTCRtpHeaderExtensionParameters,
10
10
  } from "./parameters";
11
- import { RTCRtpReceiver } from "./rtpReceiver";
12
- import { RTCRtpSender } from "./rtpSender";
13
- import { MediaStreamTrack } from "./track";
11
+ import type { RTCRtpReceiver } from "./rtpReceiver";
12
+ import type { RTCRtpSender } from "./rtpSender";
13
+ import type { MediaStreamTrack } from "./track";
14
14
 
15
15
  export class RTCRtpTransceiver {
16
16
  readonly id = uuid.v4();
@@ -1,6 +1,6 @@
1
1
  import Event from "rx.mini";
2
2
 
3
- import { TransportWideCC } from "../../../../rtp/src";
3
+ import type { TransportWideCC } from "../../../../rtp/src";
4
4
  import { Int } from "../../../../rtp/src/helper";
5
5
  import { milliTime } from "../../utils";
6
6
  import { CumulativeResult } from "./cumulativeResult";
@@ -1,10 +1,10 @@
1
1
  import Event from "rx.mini";
2
2
  import { v4 } from "uuid";
3
3
 
4
- import { RtcpPacket, RtpHeader, RtpPacket } from "../../../rtp/src";
4
+ import { type RtcpPacket, type RtpHeader, RtpPacket } from "../../../rtp/src";
5
5
  import { EventTarget } from "../helper";
6
- import { Kind } from "../types/domain";
7
- import { RTCRtpCodecParameters } from "./parameters";
6
+ import type { Kind } from "../types/domain";
7
+ import type { RTCRtpCodecParameters } from "./parameters";
8
8
 
9
9
  export class MediaStreamTrack extends EventTarget {
10
10
  readonly uuid = v4();
@@ -49,6 +49,7 @@ export class MediaStreamTrack extends EventTarget {
49
49
  this.stopped = true;
50
50
  this.muted = true;
51
51
  this.onReceiveRtp.complete();
52
+ this.emit("ended");
52
53
  };
53
54
 
54
55
  writeRtp = (rtp: RtpPacket | Buffer) => {
@@ -70,8 +71,13 @@ export class MediaStream {
70
71
  id!: string;
71
72
  tracks: MediaStreamTrack[] = [];
72
73
 
73
- constructor(props: Partial<MediaStream> & Pick<MediaStream, "id">) {
74
- Object.assign(this, props);
74
+ constructor(props: Partial<MediaStream> | MediaStreamTrack[]) {
75
+ if (Array.isArray(props)) {
76
+ this.tracks = props;
77
+ } else {
78
+ Object.assign(this, props);
79
+ }
80
+ this.id ??= v4();
75
81
  }
76
82
 
77
83
  addTrack(track: MediaStreamTrack) {
@@ -82,4 +88,12 @@ export class MediaStream {
82
88
  getTracks() {
83
89
  return this.tracks;
84
90
  }
91
+
92
+ getAudioTracks() {
93
+ return this.tracks.filter((track) => track.kind === "audio");
94
+ }
95
+
96
+ getVideoTracks() {
97
+ return this.tracks.filter((track) => track.kind === "video");
98
+ }
85
99
  }
@@ -1,2 +1,4 @@
1
1
  export * from "./recorder";
2
2
  export * from "./userMedia";
3
+ export * from "./navigator";
4
+ export * from "../../../rtp/src/extra";
@@ -0,0 +1,118 @@
1
+ import { randomBytes } from "crypto";
2
+ import { jspack } from "@shinyoshiaki/jspack";
3
+ import { MediaStream, MediaStreamTrack } from "../media/track";
4
+
5
+ export class Navigator {
6
+ mediaDevices: MediaDevices;
7
+
8
+ constructor(props: ConstructorParameters<typeof MediaDevices>[0] = {}) {
9
+ this.mediaDevices = new MediaDevices(props);
10
+ }
11
+ }
12
+
13
+ export class MediaDevices extends EventTarget {
14
+ video?: MediaStreamTrack;
15
+ audio?: MediaStreamTrack;
16
+
17
+ constructor(
18
+ readonly props: { video?: MediaStreamTrack; audio?: MediaStreamTrack },
19
+ ) {
20
+ super();
21
+ this.video = props.video;
22
+ this.audio = props.audio;
23
+ }
24
+
25
+ readonly getUserMedia = async (
26
+ constraints: MediaStreamConstraints,
27
+ ): Promise<MediaStream> => {
28
+ const video = constraints.video
29
+ ? new MediaStreamTrack({ kind: "video" })
30
+ : undefined;
31
+ if (video) {
32
+ this.video?.onReceiveRtp.subscribe((rtp) => {
33
+ const cloned = rtp.clone();
34
+ cloned.header.ssrc = jspack.Unpack("!L", randomBytes(4))[0];
35
+ video.onReceiveRtp.execute(cloned);
36
+ });
37
+ }
38
+ const audio = constraints.audio
39
+ ? new MediaStreamTrack({ kind: "audio" })
40
+ : undefined;
41
+ if (audio) {
42
+ this.audio?.onReceiveRtp.subscribe((rtp) => {
43
+ const cloned = rtp.clone();
44
+ cloned.header.ssrc = jspack.Unpack("!L", randomBytes(4))[0];
45
+ audio.onReceiveRtp.execute(cloned);
46
+ });
47
+ }
48
+
49
+ if (constraints.video && constraints.audio) {
50
+ return new MediaStream([video!, audio!]);
51
+ } else if (constraints.audio) {
52
+ return new MediaStream([audio!]);
53
+ } else if (constraints.video) {
54
+ return new MediaStream([video!]);
55
+ }
56
+
57
+ throw new Error("Not implemented");
58
+ };
59
+
60
+ readonly getDisplayMedia = this.getUserMedia;
61
+ }
62
+
63
+ interface MediaStreamConstraints {
64
+ audio?: boolean | MediaTrackConstraints;
65
+ peerIdentity?: string;
66
+ preferCurrentTab?: boolean;
67
+ video?: boolean | MediaTrackConstraints;
68
+ }
69
+
70
+ interface MediaTrackConstraints extends MediaTrackConstraintSet {
71
+ advanced?: MediaTrackConstraintSet[];
72
+ }
73
+
74
+ interface MediaTrackConstraintSet {
75
+ aspectRatio?: ConstrainDouble;
76
+ autoGainControl?: ConstrainBoolean;
77
+ channelCount?: ConstrainULong;
78
+ deviceId?: ConstrainDOMString;
79
+ displaySurface?: ConstrainDOMString;
80
+ echoCancellation?: ConstrainBoolean;
81
+ facingMode?: ConstrainDOMString;
82
+ frameRate?: ConstrainDouble;
83
+ groupId?: ConstrainDOMString;
84
+ height?: ConstrainULong;
85
+ noiseSuppression?: ConstrainBoolean;
86
+ sampleRate?: ConstrainULong;
87
+ sampleSize?: ConstrainULong;
88
+ width?: ConstrainULong;
89
+ }
90
+
91
+ type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;
92
+ interface ConstrainDOMStringParameters {
93
+ exact?: string | string[];
94
+ ideal?: string | string[];
95
+ }
96
+ type ConstrainBoolean = boolean | ConstrainBooleanParameters;
97
+ interface ConstrainBooleanParameters {
98
+ exact?: boolean;
99
+ ideal?: boolean;
100
+ }
101
+ type ConstrainULong = number | ConstrainULongRange;
102
+ interface ConstrainULongRange extends ULongRange {
103
+ exact?: number;
104
+ ideal?: number;
105
+ }
106
+ interface ULongRange {
107
+ max?: number;
108
+ min?: number;
109
+ }
110
+ type ConstrainDouble = number | ConstrainDoubleRange;
111
+ interface ConstrainDoubleRange extends DoubleRange {
112
+ exact?: number;
113
+ ideal?: number;
114
+ }
115
+ interface DoubleRange {
116
+ max?: number;
117
+ min?: number;
118
+ }
@@ -1,37 +1,61 @@
1
1
  import Event from "rx.mini";
2
2
 
3
- import { MediaStreamTrack } from "../../media/track";
4
- import { MediaWriter } from "./writer";
3
+ import type { PassThrough } from "stream";
4
+ import type { MediaStreamTrack } from "../../media/track";
5
+ import type { MediaWriter } from "./writer";
5
6
  import { WebmFactory } from "./writer/webm";
6
7
 
7
8
  export class MediaRecorder {
8
9
  writer: MediaWriter;
9
- ext: string;
10
+ ext?: string;
10
11
  tracks: MediaStreamTrack[] = [];
11
12
  started = false;
12
13
  onError = new Event<[Error]>();
13
14
 
14
15
  constructor(
15
- public path: string,
16
- public numOfTracks = 1,
17
- public options: Partial<MediaRecorderOptions> = {},
16
+ public props: Partial<MediaRecorderOptions> & {
17
+ numOfTracks: number;
18
+ } & (
19
+ | {
20
+ path: string;
21
+ stream?: PassThrough;
22
+ }
23
+ | {
24
+ path?: string;
25
+ stream: PassThrough;
26
+ }
27
+ ),
18
28
  ) {
19
- this.ext = path.split(".").slice(-1)[0];
20
- this.writer = (() => {
21
- switch (this.ext) {
22
- case "webm":
23
- return new WebmFactory(path, options);
24
- default:
25
- throw new Error();
26
- }
27
- })();
28
-
29
- this.tracks = options.tracks ?? this.tracks;
30
- if (this.tracks.length === numOfTracks) {
29
+ this.tracks = props.tracks ?? this.tracks;
30
+ if (this.tracks.length === props.numOfTracks) {
31
31
  this.start().catch((error) => {
32
32
  this.onError.execute(error);
33
33
  });
34
34
  }
35
+
36
+ const { path, stream } = props;
37
+
38
+ if (path) {
39
+ this.ext = path.split(".").slice(-1)[0];
40
+ this.writer = (() => {
41
+ switch (this.ext) {
42
+ case "webm":
43
+ return new WebmFactory({
44
+ ...props,
45
+ path: path!,
46
+ stream: stream!,
47
+ });
48
+ default:
49
+ throw new Error();
50
+ }
51
+ })();
52
+ } else {
53
+ this.writer = new WebmFactory({
54
+ ...props,
55
+ path: path!,
56
+ stream: stream!,
57
+ });
58
+ }
35
59
  }
36
60
 
37
61
  async addTrack(track: MediaStreamTrack) {
@@ -40,7 +64,10 @@ export class MediaRecorder {
40
64
  }
41
65
 
42
66
  private async start() {
43
- if (this.tracks.length === this.numOfTracks && this.started === false) {
67
+ if (
68
+ this.tracks.length === this.props.numOfTracks &&
69
+ this.started === false
70
+ ) {
44
71
  this.started = true;
45
72
  await this.writer.start(this.tracks);
46
73
  }
@@ -59,4 +86,5 @@ export interface MediaRecorderOptions {
59
86
  waitForKeyframe: boolean;
60
87
  defaultDuration: number;
61
88
  tracks: MediaStreamTrack[];
89
+ disableNtp: boolean;
62
90
  }
@@ -1,10 +1,13 @@
1
- import { MediaRecorderOptions } from "..";
2
- import { MediaStreamTrack } from "../../..";
1
+ import type { PassThrough } from "stream";
2
+ import type { MediaRecorderOptions } from "..";
3
+ import type { MediaStreamTrack } from "../../..";
3
4
 
4
5
  export abstract class MediaWriter {
5
6
  constructor(
6
- protected path: string,
7
- protected options: Partial<MediaRecorderOptions>,
7
+ protected props: Partial<MediaRecorderOptions> & {
8
+ path: string;
9
+ stream?: PassThrough;
10
+ } & { path?: string; stream: PassThrough },
8
11
  ) {}
9
12
 
10
13
  async start(tracks: MediaStreamTrack[]) {}