@lakutata/webrtc 0.0.0-stage → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +509 -2
- package/README.zh-CN.md +399 -0
- package/THIRD_PARTY_NOTICES.md +652 -0
- package/dist/cjs/client/SignalingConnection.d.ts +81 -0
- package/dist/cjs/client/SignalingConnection.js +67 -0
- package/dist/cjs/cluster/Cluster.d.ts +503 -0
- package/dist/cjs/cluster/Cluster.js +546 -0
- package/dist/cjs/cluster/ClusterFrames.d.ts +24 -0
- package/dist/cjs/cluster/ClusterFrames.js +90 -0
- package/dist/cjs/cluster/ClusterTURN.d.ts +63 -0
- package/dist/cjs/cluster/ClusterTURN.js +78 -0
- package/dist/cjs/cluster/Rendezvous.d.ts +8 -0
- package/dist/cjs/cluster/Rendezvous.js +23 -0
- package/dist/cjs/cluster/transports/ClusterTransport.d.ts +34 -0
- package/dist/cjs/cluster/transports/ClusterTransport.js +2 -0
- package/dist/cjs/cluster/transports/LoadClient.d.ts +6 -0
- package/dist/cjs/cluster/transports/LoadClient.js +80 -0
- package/dist/cjs/cluster/transports/MemoryClusterTransport.d.ts +13 -0
- package/dist/cjs/cluster/transports/MemoryClusterTransport.js +47 -0
- package/dist/cjs/cluster/transports/NATSClusterTransport.d.ts +23 -0
- package/dist/cjs/cluster/transports/NATSClusterTransport.js +70 -0
- package/dist/cjs/cluster/transports/RedisClusterTransport.d.ts +23 -0
- package/dist/cjs/cluster/transports/RedisClusterTransport.js +77 -0
- package/dist/cjs/exceptions/ClusterRequestException.d.ts +11 -0
- package/dist/cjs/exceptions/ClusterRequestException.js +18 -0
- package/dist/cjs/exceptions/ClusterTimeoutException.d.ts +10 -0
- package/dist/cjs/exceptions/ClusterTimeoutException.js +17 -0
- package/dist/cjs/exceptions/ClusterTransportNotFoundException.d.ts +11 -0
- package/dist/cjs/exceptions/ClusterTransportNotFoundException.js +18 -0
- package/dist/cjs/exceptions/SignalingClientRequiredException.d.ts +12 -0
- package/dist/cjs/exceptions/SignalingClientRequiredException.js +19 -0
- package/dist/cjs/exceptions/SignalingConnectionException.d.ts +12 -0
- package/dist/cjs/exceptions/SignalingConnectionException.js +19 -0
- package/dist/cjs/exceptions/SignalingDeniedException.d.ts +11 -0
- package/dist/cjs/exceptions/SignalingDeniedException.js +18 -0
- package/dist/cjs/exceptions/SignalingLimitException.d.ts +11 -0
- package/dist/cjs/exceptions/SignalingLimitException.js +18 -0
- package/dist/cjs/exceptions/SignalingNotAMemberException.d.ts +11 -0
- package/dist/cjs/exceptions/SignalingNotAMemberException.js +18 -0
- package/dist/cjs/exceptions/WHEPDeniedException.d.ts +15 -0
- package/dist/cjs/exceptions/WHEPDeniedException.js +22 -0
- package/dist/cjs/exceptions/WHEPLimitException.d.ts +15 -0
- package/dist/cjs/exceptions/WHEPLimitException.js +22 -0
- package/dist/cjs/exceptions/WHEPMediaTypeException.d.ts +15 -0
- package/dist/cjs/exceptions/WHEPMediaTypeException.js +22 -0
- package/dist/cjs/exceptions/WHEPOfferException.d.ts +16 -0
- package/dist/cjs/exceptions/WHEPOfferException.js +23 -0
- package/dist/cjs/exceptions/WHEPSessionNotFoundException.d.ts +15 -0
- package/dist/cjs/exceptions/WHEPSessionNotFoundException.js +22 -0
- package/dist/cjs/exceptions/WHIPDeniedException.d.ts +15 -0
- package/dist/cjs/exceptions/WHIPDeniedException.js +22 -0
- package/dist/cjs/exceptions/WHIPLimitException.d.ts +15 -0
- package/dist/cjs/exceptions/WHIPLimitException.js +22 -0
- package/dist/cjs/exceptions/WHIPMediaTypeException.d.ts +15 -0
- package/dist/cjs/exceptions/WHIPMediaTypeException.js +22 -0
- package/dist/cjs/exceptions/WHIPOfferException.d.ts +16 -0
- package/dist/cjs/exceptions/WHIPOfferException.js +23 -0
- package/dist/cjs/exceptions/WHIPSessionNotFoundException.d.ts +15 -0
- package/dist/cjs/exceptions/WHIPSessionNotFoundException.js +22 -0
- package/dist/cjs/exports/Client.d.ts +11 -0
- package/dist/cjs/exports/Client.js +29 -0
- package/dist/cjs/exports/WebRTC.d.ts +48 -0
- package/dist/cjs/exports/WebRTC.js +72 -0
- package/dist/cjs/lib/common/binary.d.ts +51 -0
- package/dist/cjs/lib/common/binary.js +264 -0
- package/dist/cjs/lib/common/binaryData.d.ts +116 -0
- package/dist/cjs/lib/common/binaryData.js +400 -0
- package/dist/cjs/lib/common/crc.d.ts +4 -0
- package/dist/cjs/lib/common/crc.js +122 -0
- package/dist/cjs/lib/common/deque.d.ts +36 -0
- package/dist/cjs/lib/common/deque.js +89 -0
- package/dist/cjs/lib/common/event.d.ts +48 -0
- package/dist/cjs/lib/common/event.js +207 -0
- package/dist/cjs/lib/common/index.d.ts +11 -0
- package/dist/cjs/lib/common/index.js +50 -0
- package/dist/cjs/lib/common/log.d.ts +47 -0
- package/dist/cjs/lib/common/log.js +62 -0
- package/dist/cjs/lib/common/network.d.ts +10 -0
- package/dist/cjs/lib/common/network.js +60 -0
- package/dist/cjs/lib/common/number.d.ts +13 -0
- package/dist/cjs/lib/common/number.js +43 -0
- package/dist/cjs/lib/common/promise.d.ts +21 -0
- package/dist/cjs/lib/common/promise.js +70 -0
- package/dist/cjs/lib/common/transport.d.ts +104 -0
- package/dist/cjs/lib/common/transport.js +441 -0
- package/dist/cjs/lib/common/type.d.ts +3 -0
- package/dist/cjs/lib/common/type.js +2 -0
- package/dist/cjs/lib/dtls/cipher/const.d.ts +42 -0
- package/dist/cjs/lib/dtls/cipher/const.js +33 -0
- package/dist/cjs/lib/dtls/cipher/create.d.ts +21 -0
- package/dist/cjs/lib/dtls/cipher/create.js +105 -0
- package/dist/cjs/lib/dtls/cipher/ec.d.ts +28 -0
- package/dist/cjs/lib/dtls/cipher/ec.js +44 -0
- package/dist/cjs/lib/dtls/cipher/key-exchange.d.ts +43 -0
- package/dist/cjs/lib/dtls/cipher/key-exchange.js +113 -0
- package/dist/cjs/lib/dtls/cipher/namedCurve.d.ts +7 -0
- package/dist/cjs/lib/dtls/cipher/namedCurve.js +27 -0
- package/dist/cjs/lib/dtls/cipher/prf.d.ts +17 -0
- package/dist/cjs/lib/dtls/cipher/prf.js +92 -0
- package/dist/cjs/lib/dtls/cipher/suites/abstract.d.ts +40 -0
- package/dist/cjs/lib/dtls/cipher/suites/abstract.js +41 -0
- package/dist/cjs/lib/dtls/cipher/suites/aead.d.ts +28 -0
- package/dist/cjs/lib/dtls/cipher/suites/aead.js +132 -0
- package/dist/cjs/lib/dtls/cipher/suites/null.d.ts +24 -0
- package/dist/cjs/lib/dtls/cipher/suites/null.js +41 -0
- package/dist/cjs/lib/dtls/cipher/utils.d.ts +18 -0
- package/dist/cjs/lib/dtls/cipher/utils.js +70 -0
- package/dist/cjs/lib/dtls/cipher/x509.d.ts +33 -0
- package/dist/cjs/lib/dtls/cipher/x509.js +100 -0
- package/dist/cjs/lib/dtls/client.d.ts +7 -0
- package/dist/cjs/lib/dtls/client.js +76 -0
- package/dist/cjs/lib/dtls/context/cipher.d.ts +42 -0
- package/dist/cjs/lib/dtls/context/cipher.js +87 -0
- package/dist/cjs/lib/dtls/context/dtls.d.ts +38 -0
- package/dist/cjs/lib/dtls/context/dtls.js +49 -0
- package/dist/cjs/lib/dtls/context/srtp.d.ts +5 -0
- package/dist/cjs/lib/dtls/context/srtp.js +12 -0
- package/dist/cjs/lib/dtls/context/transport.d.ts +8 -0
- package/dist/cjs/lib/dtls/context/transport.js +17 -0
- package/dist/cjs/lib/dtls/flight/client/flight1.d.ts +10 -0
- package/dist/cjs/lib/dtls/flight/client/flight1.js +26 -0
- package/dist/cjs/lib/dtls/flight/client/flight3.d.ts +8 -0
- package/dist/cjs/lib/dtls/flight/client/flight3.js +25 -0
- package/dist/cjs/lib/dtls/flight/client/flight5.d.ts +18 -0
- package/dist/cjs/lib/dtls/flight/client/flight5.js +206 -0
- package/dist/cjs/lib/dtls/flight/flight.d.ts +18 -0
- package/dist/cjs/lib/dtls/flight/flight.js +68 -0
- package/dist/cjs/lib/dtls/flight/server/flight2.d.ts +6 -0
- package/dist/cjs/lib/dtls/flight/server/flight2.js +126 -0
- package/dist/cjs/lib/dtls/flight/server/flight4.d.ts +17 -0
- package/dist/cjs/lib/dtls/flight/server/flight4.js +87 -0
- package/dist/cjs/lib/dtls/flight/server/flight6.d.ts +13 -0
- package/dist/cjs/lib/dtls/flight/server/flight6.js +111 -0
- package/dist/cjs/lib/dtls/handshake/binary.d.ts +16 -0
- package/dist/cjs/lib/dtls/handshake/binary.js +20 -0
- package/dist/cjs/lib/dtls/handshake/const.d.ts +13 -0
- package/dist/cjs/lib/dtls/handshake/const.js +17 -0
- package/dist/cjs/lib/dtls/handshake/extensions/ellipticCurves.d.ts +17 -0
- package/dist/cjs/lib/dtls/handshake/extensions/ellipticCurves.js +40 -0
- package/dist/cjs/lib/dtls/handshake/extensions/extendedMasterSecret.d.ts +3 -0
- package/dist/cjs/lib/dtls/handshake/extensions/extendedMasterSecret.js +7 -0
- package/dist/cjs/lib/dtls/handshake/extensions/renegotiationIndication.d.ts +18 -0
- package/dist/cjs/lib/dtls/handshake/extensions/renegotiationIndication.js +34 -0
- package/dist/cjs/lib/dtls/handshake/extensions/signature.d.ts +26 -0
- package/dist/cjs/lib/dtls/handshake/extensions/signature.js +39 -0
- package/dist/cjs/lib/dtls/handshake/extensions/useSrtp.d.ts +19 -0
- package/dist/cjs/lib/dtls/handshake/extensions/useSrtp.js +65 -0
- package/dist/cjs/lib/dtls/handshake/message/alert.d.ts +12 -0
- package/dist/cjs/lib/dtls/handshake/message/alert.js +24 -0
- package/dist/cjs/lib/dtls/handshake/message/certificate.d.ts +17 -0
- package/dist/cjs/lib/dtls/handshake/message/certificate.js +35 -0
- package/dist/cjs/lib/dtls/handshake/message/changeCipherSpec.d.ts +11 -0
- package/dist/cjs/lib/dtls/handshake/message/changeCipherSpec.js +24 -0
- package/dist/cjs/lib/dtls/handshake/message/client/certificateVerify.d.ts +20 -0
- package/dist/cjs/lib/dtls/handshake/message/client/certificateVerify.js +35 -0
- package/dist/cjs/lib/dtls/handshake/message/client/hello.d.ts +50 -0
- package/dist/cjs/lib/dtls/handshake/message/client/hello.js +48 -0
- package/dist/cjs/lib/dtls/handshake/message/client/keyExchange.d.ts +17 -0
- package/dist/cjs/lib/dtls/handshake/message/client/keyExchange.js +33 -0
- package/dist/cjs/lib/dtls/handshake/message/finished.d.ts +13 -0
- package/dist/cjs/lib/dtls/handshake/message/finished.js +26 -0
- package/dist/cjs/lib/dtls/handshake/message/server/certificateRequest.d.ts +31 -0
- package/dist/cjs/lib/dtls/handshake/message/server/certificateRequest.js +38 -0
- package/dist/cjs/lib/dtls/handshake/message/server/hello.d.ts +33 -0
- package/dist/cjs/lib/dtls/handshake/message/server/hello.js +57 -0
- package/dist/cjs/lib/dtls/handshake/message/server/helloDone.d.ts +12 -0
- package/dist/cjs/lib/dtls/handshake/message/server/helloDone.js +30 -0
- package/dist/cjs/lib/dtls/handshake/message/server/helloVerifyRequest.d.ts +32 -0
- package/dist/cjs/lib/dtls/handshake/message/server/helloVerifyRequest.js +42 -0
- package/dist/cjs/lib/dtls/handshake/message/server/keyExchange.d.ts +32 -0
- package/dist/cjs/lib/dtls/handshake/message/server/keyExchange.js +49 -0
- package/dist/cjs/lib/dtls/handshake/random.d.ts +13 -0
- package/dist/cjs/lib/dtls/handshake/random.js +29 -0
- package/dist/cjs/lib/dtls/helper.d.ts +4 -0
- package/dist/cjs/lib/dtls/helper.js +30 -0
- package/dist/cjs/lib/dtls/imports/common.d.ts +1 -0
- package/dist/cjs/lib/dtls/imports/common.js +17 -0
- package/dist/cjs/lib/dtls/imports/rtp.d.ts +1 -0
- package/dist/cjs/lib/dtls/imports/rtp.js +17 -0
- package/dist/cjs/lib/dtls/index.d.ts +7 -0
- package/dist/cjs/lib/dtls/index.js +117 -0
- package/dist/cjs/lib/dtls/record/antiReplayWindow.d.ts +27 -0
- package/dist/cjs/lib/dtls/record/antiReplayWindow.js +102 -0
- package/dist/cjs/lib/dtls/record/builder.d.ts +9 -0
- package/dist/cjs/lib/dtls/record/builder.js +27 -0
- package/dist/cjs/lib/dtls/record/const.d.ts +33 -0
- package/dist/cjs/lib/dtls/record/const.js +38 -0
- package/dist/cjs/lib/dtls/record/message/fragment.d.ts +26 -0
- package/dist/cjs/lib/dtls/record/message/fragment.js +96 -0
- package/dist/cjs/lib/dtls/record/message/header.d.ts +38 -0
- package/dist/cjs/lib/dtls/record/message/header.js +34 -0
- package/dist/cjs/lib/dtls/record/message/plaintext.d.ts +14 -0
- package/dist/cjs/lib/dtls/record/message/plaintext.js +63 -0
- package/dist/cjs/lib/dtls/record/receive.d.ts +9 -0
- package/dist/cjs/lib/dtls/record/receive.js +91 -0
- package/dist/cjs/lib/dtls/server.d.ts +6 -0
- package/dist/cjs/lib/dtls/server.js +78 -0
- package/dist/cjs/lib/dtls/socket.d.ts +52 -0
- package/dist/cjs/lib/dtls/socket.js +188 -0
- package/dist/cjs/lib/dtls/typings/domain.d.ts +20 -0
- package/dist/cjs/lib/dtls/typings/domain.js +2 -0
- package/dist/cjs/lib/dtls/util/binary.d.ts +2 -0
- package/dist/cjs/lib/dtls/util/binary.js +8 -0
- package/dist/cjs/lib/ice/candidate.d.ts +35 -0
- package/dist/cjs/lib/ice/candidate.js +198 -0
- package/dist/cjs/lib/ice/dns/lookup.d.ts +16 -0
- package/dist/cjs/lib/ice/dns/lookup.js +133 -0
- package/dist/cjs/lib/ice/dns/mdns.d.ts +38 -0
- package/dist/cjs/lib/ice/dns/mdns.js +145 -0
- package/dist/cjs/lib/ice/exceptions.d.ts +24 -0
- package/dist/cjs/lib/ice/exceptions.js +41 -0
- package/dist/cjs/lib/ice/helper.d.ts +17 -0
- package/dist/cjs/lib/ice/helper.js +74 -0
- package/dist/cjs/lib/ice/ice.d.ts +182 -0
- package/dist/cjs/lib/ice/ice.js +1584 -0
- package/dist/cjs/lib/ice/iceBase.d.ts +214 -0
- package/dist/cjs/lib/ice/iceBase.js +182 -0
- package/dist/cjs/lib/ice/imports/common.d.ts +1 -0
- package/dist/cjs/lib/ice/imports/common.js +17 -0
- package/dist/cjs/lib/ice/index.d.ts +12 -0
- package/dist/cjs/lib/ice/index.js +30 -0
- package/dist/cjs/lib/ice/internal/selectAddresses.d.ts +9 -0
- package/dist/cjs/lib/ice/internal/selectAddresses.js +39 -0
- package/dist/cjs/lib/ice/stun/attributes.d.ts +1 -0
- package/dist/cjs/lib/ice/stun/attributes.js +17 -0
- package/dist/cjs/lib/ice/stun/const.d.ts +8 -0
- package/dist/cjs/lib/ice/stun/const.js +25 -0
- package/dist/cjs/lib/ice/stun/message.d.ts +1 -0
- package/dist/cjs/lib/ice/stun/message.js +17 -0
- package/dist/cjs/lib/ice/stun/protocol.d.ts +30 -0
- package/dist/cjs/lib/ice/stun/protocol.js +125 -0
- package/dist/cjs/lib/ice/stun/tcpFrame.d.ts +5 -0
- package/dist/cjs/lib/ice/stun/tcpFrame.js +25 -0
- package/dist/cjs/lib/ice/stun/tcpProtocol.d.ts +57 -0
- package/dist/cjs/lib/ice/stun/tcpProtocol.js +323 -0
- package/dist/cjs/lib/ice/stun/transaction.d.ts +75 -0
- package/dist/cjs/lib/ice/stun/transaction.js +239 -0
- package/dist/cjs/lib/ice/turn/frame.d.ts +1 -0
- package/dist/cjs/lib/ice/turn/frame.js +17 -0
- package/dist/cjs/lib/ice/turn/protocol.d.ts +170 -0
- package/dist/cjs/lib/ice/turn/protocol.js +638 -0
- package/dist/cjs/lib/ice/types/model.d.ts +56 -0
- package/dist/cjs/lib/ice/types/model.js +2 -0
- package/dist/cjs/lib/ice/utils.d.ts +13 -0
- package/dist/cjs/lib/ice/utils.js +84 -0
- package/dist/cjs/lib/peer/const.d.ts +36 -0
- package/dist/cjs/lib/peer/const.js +53 -0
- package/dist/cjs/lib/peer/dataChannel.d.ts +69 -0
- package/dist/cjs/lib/peer/dataChannel.js +133 -0
- package/dist/cjs/lib/peer/errors.d.ts +11 -0
- package/dist/cjs/lib/peer/errors.js +23 -0
- package/dist/cjs/lib/peer/helper.d.ts +20 -0
- package/dist/cjs/lib/peer/helper.js +84 -0
- package/dist/cjs/lib/peer/imports/common.d.ts +1 -0
- package/dist/cjs/lib/peer/imports/common.js +17 -0
- package/dist/cjs/lib/peer/imports/dtls.d.ts +1 -0
- package/dist/cjs/lib/peer/imports/dtls.js +17 -0
- package/dist/cjs/lib/peer/imports/ice.d.ts +1 -0
- package/dist/cjs/lib/peer/imports/ice.js +17 -0
- package/dist/cjs/lib/peer/imports/rtp.d.ts +1 -0
- package/dist/cjs/lib/peer/imports/rtp.js +17 -0
- package/dist/cjs/lib/peer/index.d.ts +14 -0
- package/dist/cjs/lib/peer/index.js +30 -0
- package/dist/cjs/lib/peer/media/codec.d.ts +15 -0
- package/dist/cjs/lib/peer/media/codec.js +80 -0
- package/dist/cjs/lib/peer/media/codecCompatibility.d.ts +23 -0
- package/dist/cjs/lib/peer/media/codecCompatibility.js +137 -0
- package/dist/cjs/lib/peer/media/extension/rtcpFeedback.d.ts +6 -0
- package/dist/cjs/lib/peer/media/extension/rtcpFeedback.js +13 -0
- package/dist/cjs/lib/peer/media/extension/rtpExtension.d.ts +9 -0
- package/dist/cjs/lib/peer/media/extension/rtpExtension.js +52 -0
- package/dist/cjs/lib/peer/media/index.d.ts +12 -0
- package/dist/cjs/lib/peer/media/index.js +28 -0
- package/dist/cjs/lib/peer/media/parameters.d.ts +65 -0
- package/dist/cjs/lib/peer/media/parameters.js +60 -0
- package/dist/cjs/lib/peer/media/receiver/nack.d.ts +23 -0
- package/dist/cjs/lib/peer/media/receiver/nack.js +104 -0
- package/dist/cjs/lib/peer/media/receiver/receiverTwcc.d.ts +47 -0
- package/dist/cjs/lib/peer/media/receiver/receiverTwcc.js +179 -0
- package/dist/cjs/lib/peer/media/receiver/statistics.d.ts +22 -0
- package/dist/cjs/lib/peer/media/receiver/statistics.js +71 -0
- package/dist/cjs/lib/peer/media/router.d.ts +25 -0
- package/dist/cjs/lib/peer/media/router.js +166 -0
- package/dist/cjs/lib/peer/media/rtpReceiver.d.ts +90 -0
- package/dist/cjs/lib/peer/media/rtpReceiver.js +407 -0
- package/dist/cjs/lib/peer/media/rtpSender.d.ts +209 -0
- package/dist/cjs/lib/peer/media/rtpSender.js +826 -0
- package/dist/cjs/lib/peer/media/rtpTransceiver.d.ts +117 -0
- package/dist/cjs/lib/peer/media/rtpTransceiver.js +245 -0
- package/dist/cjs/lib/peer/media/sender/cumulativeResult.d.ts +19 -0
- package/dist/cjs/lib/peer/media/sender/cumulativeResult.js +61 -0
- package/dist/cjs/lib/peer/media/sender/senderBWE.d.ts +32 -0
- package/dist/cjs/lib/peer/media/sender/senderBWE.js +99 -0
- package/dist/cjs/lib/peer/media/stats.d.ts +293 -0
- package/dist/cjs/lib/peer/media/stats.js +90 -0
- package/dist/cjs/lib/peer/media/track.d.ts +67 -0
- package/dist/cjs/lib/peer/media/track.js +216 -0
- package/dist/cjs/lib/peer/peerConnection.d.ts +458 -0
- package/dist/cjs/lib/peer/peerConnection.js +1591 -0
- package/dist/cjs/lib/peer/sctpManager.d.ts +28 -0
- package/dist/cjs/lib/peer/sctpManager.js +138 -0
- package/dist/cjs/lib/peer/sdp.d.ts +97 -0
- package/dist/cjs/lib/peer/sdp.js +628 -0
- package/dist/cjs/lib/peer/sdpManager.d.ts +116 -0
- package/dist/cjs/lib/peer/sdpManager.js +573 -0
- package/dist/cjs/lib/peer/secureTransportManager.d.ts +96 -0
- package/dist/cjs/lib/peer/secureTransportManager.js +472 -0
- package/dist/cjs/lib/peer/transceiverManager.d.ts +151 -0
- package/dist/cjs/lib/peer/transceiverManager.js +767 -0
- package/dist/cjs/lib/peer/transport/dtls.d.ts +95 -0
- package/dist/cjs/lib/peer/transport/dtls.js +571 -0
- package/dist/cjs/lib/peer/transport/ice.d.ts +143 -0
- package/dist/cjs/lib/peer/transport/ice.js +436 -0
- package/dist/cjs/lib/peer/transport/sctp.d.ts +56 -0
- package/dist/cjs/lib/peer/transport/sctp.js +387 -0
- package/dist/cjs/lib/peer/types/domain.d.ts +5 -0
- package/dist/cjs/lib/peer/types/domain.js +19 -0
- package/dist/cjs/lib/peer/types/util.d.ts +2 -0
- package/dist/cjs/lib/peer/types/util.js +2 -0
- package/dist/cjs/lib/peer/utils.d.ts +73 -0
- package/dist/cjs/lib/peer/utils.js +306 -0
- package/dist/cjs/lib/rtp/codec/av1.d.ts +56 -0
- package/dist/cjs/lib/rtp/codec/av1.js +209 -0
- package/dist/cjs/lib/rtp/codec/base.d.ts +8 -0
- package/dist/cjs/lib/rtp/codec/base.js +15 -0
- package/dist/cjs/lib/rtp/codec/h264.d.ts +32 -0
- package/dist/cjs/lib/rtp/codec/h264.js +122 -0
- package/dist/cjs/lib/rtp/codec/index.d.ts +16 -0
- package/dist/cjs/lib/rtp/codec/index.js +84 -0
- package/dist/cjs/lib/rtp/codec/leb128.d.ts +5 -0
- package/dist/cjs/lib/rtp/codec/leb128.js +23 -0
- package/dist/cjs/lib/rtp/codec/opus.d.ts +9 -0
- package/dist/cjs/lib/rtp/codec/opus.js +25 -0
- package/dist/cjs/lib/rtp/codec/vp8.d.ts +27 -0
- package/dist/cjs/lib/rtp/codec/vp8.js +109 -0
- package/dist/cjs/lib/rtp/codec/vp9.d.ts +46 -0
- package/dist/cjs/lib/rtp/codec/vp9.js +161 -0
- package/dist/cjs/lib/rtp/const.d.ts +1 -0
- package/dist/cjs/lib/rtp/const.js +4 -0
- package/dist/cjs/lib/rtp/helper.d.ts +8 -0
- package/dist/cjs/lib/rtp/helper.js +36 -0
- package/dist/cjs/lib/rtp/imports/common.d.ts +1 -0
- package/dist/cjs/lib/rtp/imports/common.js +17 -0
- package/dist/cjs/lib/rtp/index.d.ts +25 -0
- package/dist/cjs/lib/rtp/index.js +41 -0
- package/dist/cjs/lib/rtp/rtcp/header.d.ts +13 -0
- package/dist/cjs/lib/rtp/rtcp/header.js +50 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/fullIntraRequest.d.ts +16 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/fullIntraRequest.js +34 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/index.d.ts +14 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/index.js +39 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/pictureLossIndication.d.ts +10 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/pictureLossIndication.js +20 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/remb.d.ts +16 -0
- package/dist/cjs/lib/rtp/rtcp/psfb/remb.js +53 -0
- package/dist/cjs/lib/rtp/rtcp/rr.d.ts +32 -0
- package/dist/cjs/lib/rtp/rtcp/rr.js +73 -0
- package/dist/cjs/lib/rtp/rtcp/rtcp.d.ts +10 -0
- package/dist/cjs/lib/rtp/rtcp/rtcp.js +58 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/const.d.ts +1 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/const.js +4 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/index.d.ts +14 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/index.js +35 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/nack.d.ts +17 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/nack.js +77 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/twcc.d.ts +71 -0
- package/dist/cjs/lib/rtp/rtcp/rtpfb/twcc.js +352 -0
- package/dist/cjs/lib/rtp/rtcp/sdes.d.ts +26 -0
- package/dist/cjs/lib/rtp/rtcp/sdes.js +97 -0
- package/dist/cjs/lib/rtp/rtcp/sr.d.ts +41 -0
- package/dist/cjs/lib/rtp/rtcp/sr.js +110 -0
- package/dist/cjs/lib/rtp/rtp/headerExtension.d.ts +72 -0
- package/dist/cjs/lib/rtp/rtp/headerExtension.js +117 -0
- package/dist/cjs/lib/rtp/rtp/red/encoder.d.ts +13 -0
- package/dist/cjs/lib/rtp/rtp/red/encoder.js +44 -0
- package/dist/cjs/lib/rtp/rtp/red/handler.d.ts +6 -0
- package/dist/cjs/lib/rtp/rtp/red/handler.js +59 -0
- package/dist/cjs/lib/rtp/rtp/red/packet.d.ts +26 -0
- package/dist/cjs/lib/rtp/rtp/red/packet.js +112 -0
- package/dist/cjs/lib/rtp/rtp/rtp.d.ts +44 -0
- package/dist/cjs/lib/rtp/rtp/rtp.js +271 -0
- package/dist/cjs/lib/rtp/rtp/rtx.d.ts +3 -0
- package/dist/cjs/lib/rtp/rtp/rtx.js +29 -0
- package/dist/cjs/lib/rtp/srtp/cipher/ctr.d.ts +16 -0
- package/dist/cjs/lib/rtp/srtp/cipher/ctr.js +107 -0
- package/dist/cjs/lib/rtp/srtp/cipher/gcm.d.ts +17 -0
- package/dist/cjs/lib/rtp/srtp/cipher/gcm.js +145 -0
- package/dist/cjs/lib/rtp/srtp/cipher/index.d.ts +13 -0
- package/dist/cjs/lib/rtp/srtp/cipher/index.js +24 -0
- package/dist/cjs/lib/rtp/srtp/const.d.ts +6 -0
- package/dist/cjs/lib/rtp/srtp/const.js +26 -0
- package/dist/cjs/lib/rtp/srtp/context/context.d.ts +45 -0
- package/dist/cjs/lib/rtp/srtp/context/context.js +180 -0
- package/dist/cjs/lib/rtp/srtp/context/srtcp.d.ts +8 -0
- package/dist/cjs/lib/rtp/srtp/context/srtcp.js +25 -0
- package/dist/cjs/lib/rtp/srtp/context/srtp.d.ts +9 -0
- package/dist/cjs/lib/rtp/srtp/context/srtp.js +41 -0
- package/dist/cjs/lib/rtp/srtp/error.d.ts +3 -0
- package/dist/cjs/lib/rtp/srtp/error.js +10 -0
- package/dist/cjs/lib/rtp/srtp/packet.d.ts +5 -0
- package/dist/cjs/lib/rtp/srtp/packet.js +47 -0
- package/dist/cjs/lib/rtp/srtp/session.d.ts +19 -0
- package/dist/cjs/lib/rtp/srtp/session.js +13 -0
- package/dist/cjs/lib/rtp/srtp/srtcp.d.ts +8 -0
- package/dist/cjs/lib/rtp/srtp/srtcp.js +21 -0
- package/dist/cjs/lib/rtp/srtp/srtp.d.ts +9 -0
- package/dist/cjs/lib/rtp/srtp/srtp.js +20 -0
- package/dist/cjs/lib/rtp/transport.d.ts +15 -0
- package/dist/cjs/lib/rtp/transport.js +23 -0
- package/dist/cjs/lib/rtp/util.d.ts +11 -0
- package/dist/cjs/lib/rtp/util.js +28 -0
- package/dist/cjs/lib/sctp/chunk.d.ts +164 -0
- package/dist/cjs/lib/sctp/chunk.js +542 -0
- package/dist/cjs/lib/sctp/const.d.ts +17 -0
- package/dist/cjs/lib/sctp/const.js +22 -0
- package/dist/cjs/lib/sctp/helper.d.ts +5 -0
- package/dist/cjs/lib/sctp/helper.js +14 -0
- package/dist/cjs/lib/sctp/imports/common.d.ts +1 -0
- package/dist/cjs/lib/sctp/imports/common.js +17 -0
- package/dist/cjs/lib/sctp/index.d.ts +6 -0
- package/dist/cjs/lib/sctp/index.js +20 -0
- package/dist/cjs/lib/sctp/param.d.ts +40 -0
- package/dist/cjs/lib/sctp/param.js +132 -0
- package/dist/cjs/lib/sctp/sctp.d.ts +210 -0
- package/dist/cjs/lib/sctp/sctp.js +1467 -0
- package/dist/cjs/lib/sctp/transport.d.ts +15 -0
- package/dist/cjs/lib/sctp/transport.js +28 -0
- package/dist/cjs/lib/turn/index.d.ts +9 -0
- package/dist/cjs/lib/turn/index.js +25 -0
- package/dist/cjs/lib/turn/node/server.d.ts +21 -0
- package/dist/cjs/lib/turn/node/server.js +94 -0
- package/dist/cjs/lib/turn/node/turnServer.d.ts +91 -0
- package/dist/cjs/lib/turn/node/turnServer.js +565 -0
- package/dist/cjs/lib/turn/protocol.d.ts +47 -0
- package/dist/cjs/lib/turn/protocol.js +116 -0
- package/dist/cjs/lib/turn/stun/attributes.d.ts +37 -0
- package/dist/cjs/lib/turn/stun/attributes.js +208 -0
- package/dist/cjs/lib/turn/stun/const.d.ts +28 -0
- package/dist/cjs/lib/turn/stun/const.js +87 -0
- package/dist/cjs/lib/turn/stun/ip.d.ts +12 -0
- package/dist/cjs/lib/turn/stun/ip.js +87 -0
- package/dist/cjs/lib/turn/stun/message.d.ts +37 -0
- package/dist/cjs/lib/turn/stun/message.js +180 -0
- package/dist/cjs/lib/turn/turn/auth.d.ts +1 -0
- package/dist/cjs/lib/turn/turn/auth.js +9 -0
- package/dist/cjs/lib/turn/turn/frame.d.ts +13 -0
- package/dist/cjs/lib/turn/turn/frame.js +68 -0
- package/dist/cjs/lib/turn/turn/protocol.d.ts +147 -0
- package/dist/cjs/lib/turn/turn/protocol.js +785 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/peer/Endpoints.d.ts +75 -0
- package/dist/cjs/peer/Endpoints.js +154 -0
- package/dist/cjs/peer/EngineConfig.d.ts +20 -0
- package/dist/cjs/peer/EngineConfig.js +36 -0
- package/dist/cjs/peer/EngineConnection.d.ts +22 -0
- package/dist/cjs/peer/EngineConnection.js +27 -0
- package/dist/cjs/peer/Events.d.ts +55 -0
- package/dist/cjs/peer/Events.js +85 -0
- package/dist/cjs/peer/MediaCodecs.d.ts +27 -0
- package/dist/cjs/peer/MediaCodecs.js +53 -0
- package/dist/cjs/peer/MediaTrack.d.ts +212 -0
- package/dist/cjs/peer/MediaTrack.js +313 -0
- package/dist/cjs/peer/PeerChannel.d.ts +248 -0
- package/dist/cjs/peer/PeerChannel.js +319 -0
- package/dist/cjs/peer/PeerConnection.d.ts +603 -0
- package/dist/cjs/peer/PeerConnection.js +697 -0
- package/dist/cjs/peer/PeerThreadChannel.d.ts +112 -0
- package/dist/cjs/peer/PeerThreadChannel.js +273 -0
- package/dist/cjs/peer/PeerThreadProtocol.d.ts +325 -0
- package/dist/cjs/peer/PeerThreadProtocol.js +2 -0
- package/dist/cjs/peer/PeerThreads.d.ts +114 -0
- package/dist/cjs/peer/PeerThreads.js +268 -0
- package/dist/cjs/peer/PeerWorker.d.ts +6 -0
- package/dist/cjs/peer/PeerWorker.js +461 -0
- package/dist/cjs/peer/PeerWorkerCode.d.ts +5 -0
- package/dist/cjs/peer/PeerWorkerCode.js +4 -0
- package/dist/cjs/peer/RemoteConnection.d.ts +314 -0
- package/dist/cjs/peer/RemoteConnection.js +913 -0
- package/dist/cjs/peer/RtpPacket.d.ts +112 -0
- package/dist/cjs/peer/RtpPacket.js +92 -0
- package/dist/cjs/peer/RtpTransceiver.d.ts +167 -0
- package/dist/cjs/peer/RtpTransceiver.js +235 -0
- package/dist/cjs/peer/SignalingClient.d.ts +236 -0
- package/dist/cjs/peer/SignalingClient.js +285 -0
- package/dist/cjs/protocol/SignalingProtocol.d.ts +266 -0
- package/dist/cjs/protocol/SignalingProtocol.js +65 -0
- package/dist/cjs/service/WebRTCServiceEntrypoint.d.ts +158 -0
- package/dist/cjs/service/WebRTCServiceEntrypoint.js +356 -0
- package/dist/cjs/sfu/SFU.d.ts +356 -0
- package/dist/cjs/sfu/SFU.js +763 -0
- package/dist/cjs/sfu/SFUAccess.d.ts +48 -0
- package/dist/cjs/sfu/SFUAccess.js +15 -0
- package/dist/cjs/sfu/SFUClusterLeg.d.ts +101 -0
- package/dist/cjs/sfu/SFUClusterLeg.js +106 -0
- package/dist/cjs/sfu/SFURoom.d.ts +148 -0
- package/dist/cjs/sfu/SFURoom.js +1300 -0
- package/dist/cjs/sfu/SFUWorker.d.ts +13 -0
- package/dist/cjs/sfu/SFUWorker.js +168 -0
- package/dist/cjs/sfu/SFUWorkerChannel.d.ts +204 -0
- package/dist/cjs/sfu/SFUWorkerChannel.js +105 -0
- package/dist/cjs/sfu/SFUWorkerCode.d.ts +5 -0
- package/dist/cjs/sfu/SFUWorkerCode.js +4 -0
- package/dist/cjs/sfu/SFUWorkers.d.ts +247 -0
- package/dist/cjs/sfu/SFUWorkers.js +552 -0
- package/dist/cjs/shared/ChunkedChannel.d.ts +122 -0
- package/dist/cjs/shared/ChunkedChannel.js +182 -0
- package/dist/cjs/shared/Connections.d.ts +231 -0
- package/dist/cjs/shared/Connections.js +2 -0
- package/dist/cjs/shared/Emitter.d.ts +50 -0
- package/dist/cjs/shared/Emitter.js +80 -0
- package/dist/cjs/shared/Peer.d.ts +182 -0
- package/dist/cjs/shared/Peer.js +509 -0
- package/dist/cjs/shared/PeerServiceProxy.d.ts +173 -0
- package/dist/cjs/shared/PeerServiceProxy.js +304 -0
- package/dist/cjs/shared/Room.d.ts +143 -0
- package/dist/cjs/shared/Room.js +515 -0
- package/dist/cjs/shared/SignalingError.d.ts +40 -0
- package/dist/cjs/shared/SignalingError.js +48 -0
- package/dist/cjs/shared/SignalingSession.d.ts +97 -0
- package/dist/cjs/shared/SignalingSession.js +347 -0
- package/dist/cjs/shared/Transports.d.ts +139 -0
- package/dist/cjs/shared/Transports.js +285 -0
- package/dist/cjs/signaling/MediaServers.d.ts +40 -0
- package/dist/cjs/signaling/MediaServers.js +16 -0
- package/dist/cjs/signaling/Signaling.d.ts +573 -0
- package/dist/cjs/signaling/Signaling.js +945 -0
- package/dist/cjs/signaling/SignalingController.d.ts +128 -0
- package/dist/cjs/signaling/SignalingController.js +229 -0
- package/dist/cjs/turn/TURNCredentials.d.ts +49 -0
- package/dist/cjs/turn/TURNCredentials.js +49 -0
- package/dist/cjs/turn/TURNIceServers.d.ts +11 -0
- package/dist/cjs/turn/TURNIceServers.js +25 -0
- package/dist/cjs/turn/TURNServer.d.ts +309 -0
- package/dist/cjs/turn/TURNServer.js +331 -0
- package/dist/cjs/turn/TURNWorker.d.ts +42 -0
- package/dist/cjs/turn/TURNWorker.js +52 -0
- package/dist/cjs/turn/TURNWorkerCode.d.ts +5 -0
- package/dist/cjs/turn/TURNWorkerCode.js +4 -0
- package/dist/cjs/turn/TURNWorkers.d.ts +52 -0
- package/dist/cjs/turn/TURNWorkers.js +211 -0
- package/dist/cjs/whep/WHEP.d.ts +386 -0
- package/dist/cjs/whep/WHEP.js +426 -0
- package/dist/cjs/whep/WHEPController.d.ts +134 -0
- package/dist/cjs/whep/WHEPController.js +301 -0
- package/dist/cjs/whip/WHIP.d.ts +426 -0
- package/dist/cjs/whip/WHIP.js +470 -0
- package/dist/cjs/whip/WHIPController.d.ts +132 -0
- package/dist/cjs/whip/WHIPController.js +299 -0
- package/dist/esm/client/SignalingConnection.js +63 -0
- package/dist/esm/cluster/Cluster.js +542 -0
- package/dist/esm/cluster/ClusterFrames.js +85 -0
- package/dist/esm/cluster/ClusterTURN.js +73 -0
- package/dist/esm/cluster/Rendezvous.js +20 -0
- package/dist/esm/cluster/transports/ClusterTransport.js +1 -0
- package/dist/esm/cluster/transports/LoadClient.js +44 -0
- package/dist/esm/cluster/transports/MemoryClusterTransport.js +43 -0
- package/dist/esm/cluster/transports/NATSClusterTransport.js +66 -0
- package/dist/esm/cluster/transports/RedisClusterTransport.js +73 -0
- package/dist/esm/exceptions/ClusterRequestException.js +14 -0
- package/dist/esm/exceptions/ClusterTimeoutException.js +13 -0
- package/dist/esm/exceptions/ClusterTransportNotFoundException.js +14 -0
- package/dist/esm/exceptions/SignalingClientRequiredException.js +15 -0
- package/dist/esm/exceptions/SignalingConnectionException.js +15 -0
- package/dist/esm/exceptions/SignalingDeniedException.js +14 -0
- package/dist/esm/exceptions/SignalingLimitException.js +14 -0
- package/dist/esm/exceptions/SignalingNotAMemberException.js +14 -0
- package/dist/esm/exceptions/WHEPDeniedException.js +18 -0
- package/dist/esm/exceptions/WHEPLimitException.js +18 -0
- package/dist/esm/exceptions/WHEPMediaTypeException.js +18 -0
- package/dist/esm/exceptions/WHEPOfferException.js +19 -0
- package/dist/esm/exceptions/WHEPSessionNotFoundException.js +18 -0
- package/dist/esm/exceptions/WHIPDeniedException.js +18 -0
- package/dist/esm/exceptions/WHIPLimitException.js +18 -0
- package/dist/esm/exceptions/WHIPMediaTypeException.js +18 -0
- package/dist/esm/exceptions/WHIPOfferException.js +19 -0
- package/dist/esm/exceptions/WHIPSessionNotFoundException.js +18 -0
- package/dist/esm/exports/Client.js +5 -0
- package/dist/esm/exports/WebRTC.js +41 -0
- package/dist/esm/lib/common/binary.js +244 -0
- package/dist/esm/lib/common/binaryData.js +392 -0
- package/dist/esm/lib/common/crc.js +118 -0
- package/dist/esm/lib/common/deque.js +85 -0
- package/dist/esm/lib/common/event.js +202 -0
- package/dist/esm/lib/common/index.js +11 -0
- package/dist/esm/lib/common/log.js +55 -0
- package/dist/esm/lib/common/network.js +52 -0
- package/dist/esm/lib/common/number.js +31 -0
- package/dist/esm/lib/common/promise.js +64 -0
- package/dist/esm/lib/common/transport.js +401 -0
- package/dist/esm/lib/common/type.js +1 -0
- package/dist/esm/lib/dtls/cipher/const.js +30 -0
- package/dist/esm/lib/dtls/cipher/create.js +98 -0
- package/dist/esm/lib/dtls/cipher/ec.js +37 -0
- package/dist/esm/lib/dtls/cipher/key-exchange.js +103 -0
- package/dist/esm/lib/dtls/cipher/namedCurve.js +24 -0
- package/dist/esm/lib/dtls/cipher/prf.js +79 -0
- package/dist/esm/lib/dtls/cipher/suites/abstract.js +37 -0
- package/dist/esm/lib/dtls/cipher/suites/aead.js +96 -0
- package/dist/esm/lib/dtls/cipher/suites/null.js +35 -0
- package/dist/esm/lib/dtls/cipher/utils.js +34 -0
- package/dist/esm/lib/dtls/cipher/x509.js +94 -0
- package/dist/esm/lib/dtls/client.js +72 -0
- package/dist/esm/lib/dtls/context/cipher.js +83 -0
- package/dist/esm/lib/dtls/context/dtls.js +45 -0
- package/dist/esm/lib/dtls/context/srtp.js +8 -0
- package/dist/esm/lib/dtls/context/transport.js +13 -0
- package/dist/esm/lib/dtls/flight/client/flight1.js +22 -0
- package/dist/esm/lib/dtls/flight/client/flight3.js +21 -0
- package/dist/esm/lib/dtls/flight/client/flight5.js +202 -0
- package/dist/esm/lib/dtls/flight/flight.js +64 -0
- package/dist/esm/lib/dtls/flight/server/flight2.js +122 -0
- package/dist/esm/lib/dtls/flight/server/flight4.js +83 -0
- package/dist/esm/lib/dtls/flight/server/flight6.js +107 -0
- package/dist/esm/lib/dtls/handshake/binary.js +17 -0
- package/dist/esm/lib/dtls/handshake/const.js +14 -0
- package/dist/esm/lib/dtls/handshake/extensions/ellipticCurves.js +36 -0
- package/dist/esm/lib/dtls/handshake/extensions/extendedMasterSecret.js +3 -0
- package/dist/esm/lib/dtls/handshake/extensions/renegotiationIndication.js +30 -0
- package/dist/esm/lib/dtls/handshake/extensions/signature.js +35 -0
- package/dist/esm/lib/dtls/handshake/extensions/useSrtp.js +61 -0
- package/dist/esm/lib/dtls/handshake/message/alert.js +20 -0
- package/dist/esm/lib/dtls/handshake/message/certificate.js +31 -0
- package/dist/esm/lib/dtls/handshake/message/changeCipherSpec.js +20 -0
- package/dist/esm/lib/dtls/handshake/message/client/certificateVerify.js +31 -0
- package/dist/esm/lib/dtls/handshake/message/client/hello.js +44 -0
- package/dist/esm/lib/dtls/handshake/message/client/keyExchange.js +29 -0
- package/dist/esm/lib/dtls/handshake/message/finished.js +22 -0
- package/dist/esm/lib/dtls/handshake/message/server/certificateRequest.js +34 -0
- package/dist/esm/lib/dtls/handshake/message/server/hello.js +53 -0
- package/dist/esm/lib/dtls/handshake/message/server/helloDone.js +26 -0
- package/dist/esm/lib/dtls/handshake/message/server/helloVerifyRequest.js +38 -0
- package/dist/esm/lib/dtls/handshake/message/server/keyExchange.js +45 -0
- package/dist/esm/lib/dtls/handshake/random.js +25 -0
- package/dist/esm/lib/dtls/helper.js +23 -0
- package/dist/esm/lib/dtls/imports/common.js +1 -0
- package/dist/esm/lib/dtls/imports/rtp.js +1 -0
- package/dist/esm/lib/dtls/index.js +97 -0
- package/dist/esm/lib/dtls/record/antiReplayWindow.js +98 -0
- package/dist/esm/lib/dtls/record/builder.js +22 -0
- package/dist/esm/lib/dtls/record/const.js +35 -0
- package/dist/esm/lib/dtls/record/message/fragment.js +92 -0
- package/dist/esm/lib/dtls/record/message/header.js +30 -0
- package/dist/esm/lib/dtls/record/message/plaintext.js +59 -0
- package/dist/esm/lib/dtls/record/receive.js +86 -0
- package/dist/esm/lib/dtls/server.js +74 -0
- package/dist/esm/lib/dtls/socket.js +184 -0
- package/dist/esm/lib/dtls/typings/domain.js +1 -0
- package/dist/esm/lib/dtls/util/binary.js +5 -0
- package/dist/esm/lib/ice/candidate.js +190 -0
- package/dist/esm/lib/ice/dns/lookup.js +95 -0
- package/dist/esm/lib/ice/dns/mdns.js +139 -0
- package/dist/esm/lib/ice/exceptions.js +34 -0
- package/dist/esm/lib/ice/helper.js +65 -0
- package/dist/esm/lib/ice/ice.js +1547 -0
- package/dist/esm/lib/ice/iceBase.js +172 -0
- package/dist/esm/lib/ice/imports/common.js +1 -0
- package/dist/esm/lib/ice/index.js +12 -0
- package/dist/esm/lib/ice/internal/selectAddresses.js +36 -0
- package/dist/esm/lib/ice/stun/attributes.js +1 -0
- package/dist/esm/lib/ice/stun/const.js +8 -0
- package/dist/esm/lib/ice/stun/message.js +1 -0
- package/dist/esm/lib/ice/stun/protocol.js +121 -0
- package/dist/esm/lib/ice/stun/tcpFrame.js +21 -0
- package/dist/esm/lib/ice/stun/tcpProtocol.js +318 -0
- package/dist/esm/lib/ice/stun/transaction.js +230 -0
- package/dist/esm/lib/ice/turn/frame.js +1 -0
- package/dist/esm/lib/ice/turn/protocol.js +630 -0
- package/dist/esm/lib/ice/types/model.js +1 -0
- package/dist/esm/lib/ice/utils.js +43 -0
- package/dist/esm/lib/peer/const.js +50 -0
- package/dist/esm/lib/peer/dataChannel.js +127 -0
- package/dist/esm/lib/peer/errors.js +17 -0
- package/dist/esm/lib/peer/helper.js +77 -0
- package/dist/esm/lib/peer/imports/common.js +1 -0
- package/dist/esm/lib/peer/imports/dtls.js +1 -0
- package/dist/esm/lib/peer/imports/ice.js +1 -0
- package/dist/esm/lib/peer/imports/rtp.js +1 -0
- package/dist/esm/lib/peer/index.js +14 -0
- package/dist/esm/lib/peer/media/codec.js +69 -0
- package/dist/esm/lib/peer/media/codecCompatibility.js +128 -0
- package/dist/esm/lib/peer/media/extension/rtcpFeedback.js +5 -0
- package/dist/esm/lib/peer/media/extension/rtpExtension.js +42 -0
- package/dist/esm/lib/peer/media/index.js +12 -0
- package/dist/esm/lib/peer/media/parameters.js +50 -0
- package/dist/esm/lib/peer/media/receiver/nack.js +100 -0
- package/dist/esm/lib/peer/media/receiver/receiverTwcc.js +175 -0
- package/dist/esm/lib/peer/media/receiver/statistics.js +67 -0
- package/dist/esm/lib/peer/media/router.js +162 -0
- package/dist/esm/lib/peer/media/rtpReceiver.js +403 -0
- package/dist/esm/lib/peer/media/rtpSender.js +822 -0
- package/dist/esm/lib/peer/media/rtpTransceiver.js +241 -0
- package/dist/esm/lib/peer/media/sender/cumulativeResult.js +57 -0
- package/dist/esm/lib/peer/media/sender/senderBWE.js +95 -0
- package/dist/esm/lib/peer/media/stats.js +81 -0
- package/dist/esm/lib/peer/media/track.js +208 -0
- package/dist/esm/lib/peer/peerConnection.js +1585 -0
- package/dist/esm/lib/peer/sctpManager.js +134 -0
- package/dist/esm/lib/peer/sdp.js +614 -0
- package/dist/esm/lib/peer/sdpManager.js +569 -0
- package/dist/esm/lib/peer/secureTransportManager.js +468 -0
- package/dist/esm/lib/peer/transceiverManager.js +763 -0
- package/dist/esm/lib/peer/transport/dtls.js +564 -0
- package/dist/esm/lib/peer/transport/ice.js +426 -0
- package/dist/esm/lib/peer/transport/sctp.js +382 -0
- package/dist/esm/lib/peer/types/domain.js +16 -0
- package/dist/esm/lib/peer/types/util.js +1 -0
- package/dist/esm/lib/peer/utils.js +286 -0
- package/dist/esm/lib/rtp/codec/av1.js +203 -0
- package/dist/esm/lib/rtp/codec/base.js +11 -0
- package/dist/esm/lib/rtp/codec/h264.js +118 -0
- package/dist/esm/lib/rtp/codec/index.js +66 -0
- package/dist/esm/lib/rtp/codec/leb128.js +20 -0
- package/dist/esm/lib/rtp/codec/opus.js +21 -0
- package/dist/esm/lib/rtp/codec/vp8.js +105 -0
- package/dist/esm/lib/rtp/codec/vp9.js +157 -0
- package/dist/esm/lib/rtp/const.js +1 -0
- package/dist/esm/lib/rtp/helper.js +29 -0
- package/dist/esm/lib/rtp/imports/common.js +1 -0
- package/dist/esm/lib/rtp/index.js +25 -0
- package/dist/esm/lib/rtp/rtcp/header.js +46 -0
- package/dist/esm/lib/rtp/rtcp/psfb/fullIntraRequest.js +30 -0
- package/dist/esm/lib/rtp/rtcp/psfb/index.js +35 -0
- package/dist/esm/lib/rtp/rtcp/psfb/pictureLossIndication.js +16 -0
- package/dist/esm/lib/rtp/rtcp/psfb/remb.js +49 -0
- package/dist/esm/lib/rtp/rtcp/rr.js +68 -0
- package/dist/esm/lib/rtp/rtcp/rtcp.js +53 -0
- package/dist/esm/lib/rtp/rtcp/rtpfb/const.js +1 -0
- package/dist/esm/lib/rtp/rtcp/rtpfb/index.js +31 -0
- package/dist/esm/lib/rtp/rtcp/rtpfb/nack.js +73 -0
- package/dist/esm/lib/rtp/rtcp/rtpfb/twcc.js +344 -0
- package/dist/esm/lib/rtp/rtcp/sdes.js +91 -0
- package/dist/esm/lib/rtp/rtcp/sr.js +104 -0
- package/dist/esm/lib/rtp/rtp/headerExtension.js +102 -0
- package/dist/esm/lib/rtp/rtp/red/encoder.js +40 -0
- package/dist/esm/lib/rtp/rtp/red/handler.js +55 -0
- package/dist/esm/lib/rtp/rtp/red/packet.js +107 -0
- package/dist/esm/lib/rtp/rtp/rtp.js +266 -0
- package/dist/esm/lib/rtp/rtp/rtx.js +25 -0
- package/dist/esm/lib/rtp/srtp/cipher/ctr.js +103 -0
- package/dist/esm/lib/rtp/srtp/cipher/gcm.js +141 -0
- package/dist/esm/lib/rtp/srtp/cipher/index.js +20 -0
- package/dist/esm/lib/rtp/srtp/const.js +21 -0
- package/dist/esm/lib/rtp/srtp/context/context.js +175 -0
- package/dist/esm/lib/rtp/srtp/context/srtcp.js +21 -0
- package/dist/esm/lib/rtp/srtp/context/srtp.js +37 -0
- package/dist/esm/lib/rtp/srtp/error.js +6 -0
- package/dist/esm/lib/rtp/srtp/packet.js +42 -0
- package/dist/esm/lib/rtp/srtp/session.js +9 -0
- package/dist/esm/lib/rtp/srtp/srtcp.js +17 -0
- package/dist/esm/lib/rtp/srtp/srtp.js +16 -0
- package/dist/esm/lib/rtp/transport.js +18 -0
- package/dist/esm/lib/rtp/util.js +24 -0
- package/dist/esm/lib/sctp/chunk.js +515 -0
- package/dist/esm/lib/sctp/const.js +19 -0
- package/dist/esm/lib/sctp/helper.js +10 -0
- package/dist/esm/lib/sctp/imports/common.js +1 -0
- package/dist/esm/lib/sctp/index.js +4 -0
- package/dist/esm/lib/sctp/param.js +126 -0
- package/dist/esm/lib/sctp/sctp.js +1459 -0
- package/dist/esm/lib/sctp/transport.js +23 -0
- package/dist/esm/lib/turn/index.js +9 -0
- package/dist/esm/lib/turn/node/server.js +89 -0
- package/dist/esm/lib/turn/node/turnServer.js +560 -0
- package/dist/esm/lib/turn/protocol.js +112 -0
- package/dist/esm/lib/turn/stun/attributes.js +198 -0
- package/dist/esm/lib/turn/stun/const.js +82 -0
- package/dist/esm/lib/turn/stun/ip.js +81 -0
- package/dist/esm/lib/turn/stun/message.js +174 -0
- package/dist/esm/lib/turn/turn/auth.js +6 -0
- package/dist/esm/lib/turn/turn/frame.js +61 -0
- package/dist/esm/lib/turn/turn/protocol.js +781 -0
- package/dist/esm/peer/Endpoints.js +143 -0
- package/dist/esm/peer/EngineConfig.js +33 -0
- package/dist/esm/peer/EngineConnection.js +22 -0
- package/dist/esm/peer/Events.js +81 -0
- package/dist/esm/peer/MediaCodecs.js +47 -0
- package/dist/esm/peer/MediaTrack.js +305 -0
- package/dist/esm/peer/PeerChannel.js +315 -0
- package/dist/esm/peer/PeerConnection.js +694 -0
- package/dist/esm/peer/PeerThreadChannel.js +266 -0
- package/dist/esm/peer/PeerThreadProtocol.js +1 -0
- package/dist/esm/peer/PeerThreads.js +264 -0
- package/dist/esm/peer/PeerWorker.js +458 -0
- package/dist/esm/peer/PeerWorkerCode.js +1 -0
- package/dist/esm/peer/RemoteConnection.js +905 -0
- package/dist/esm/peer/RtpPacket.js +86 -0
- package/dist/esm/peer/RtpTransceiver.js +225 -0
- package/dist/esm/peer/SignalingClient.js +249 -0
- package/dist/esm/protocol/SignalingProtocol.js +62 -0
- package/dist/esm/service/WebRTCServiceEntrypoint.js +352 -0
- package/dist/esm/sfu/SFU.js +759 -0
- package/dist/esm/sfu/SFUAccess.js +12 -0
- package/dist/esm/sfu/SFUClusterLeg.js +102 -0
- package/dist/esm/sfu/SFURoom.js +1296 -0
- package/dist/esm/sfu/SFUWorker.js +165 -0
- package/dist/esm/sfu/SFUWorkerChannel.js +101 -0
- package/dist/esm/sfu/SFUWorkerCode.js +1 -0
- package/dist/esm/sfu/SFUWorkers.js +547 -0
- package/dist/esm/shared/ChunkedChannel.js +178 -0
- package/dist/esm/shared/Connections.js +1 -0
- package/dist/esm/shared/Emitter.js +76 -0
- package/dist/esm/shared/Peer.js +505 -0
- package/dist/esm/shared/PeerServiceProxy.js +299 -0
- package/dist/esm/shared/Room.js +511 -0
- package/dist/esm/shared/SignalingError.js +43 -0
- package/dist/esm/shared/SignalingSession.js +343 -0
- package/dist/esm/shared/Transports.js +279 -0
- package/dist/esm/signaling/MediaServers.js +13 -0
- package/dist/esm/signaling/Signaling.js +941 -0
- package/dist/esm/signaling/SignalingController.js +225 -0
- package/dist/esm/turn/TURNCredentials.js +44 -0
- package/dist/esm/turn/TURNIceServers.js +22 -0
- package/dist/esm/turn/TURNServer.js +327 -0
- package/dist/esm/turn/TURNWorker.js +49 -0
- package/dist/esm/turn/TURNWorkerCode.js +1 -0
- package/dist/esm/turn/TURNWorkers.js +206 -0
- package/dist/esm/whep/WHEP.js +422 -0
- package/dist/esm/whep/WHEPController.js +298 -0
- package/dist/esm/whip/WHIP.js +466 -0
- package/dist/esm/whip/WHIPController.js +296 -0
- package/dist/types/client/SignalingConnection.d.ts +81 -0
- package/dist/types/cluster/Cluster.d.ts +503 -0
- package/dist/types/cluster/ClusterFrames.d.ts +24 -0
- package/dist/types/cluster/ClusterTURN.d.ts +63 -0
- package/dist/types/cluster/Rendezvous.d.ts +8 -0
- package/dist/types/cluster/transports/ClusterTransport.d.ts +34 -0
- package/dist/types/cluster/transports/LoadClient.d.ts +6 -0
- package/dist/types/cluster/transports/MemoryClusterTransport.d.ts +13 -0
- package/dist/types/cluster/transports/NATSClusterTransport.d.ts +23 -0
- package/dist/types/cluster/transports/RedisClusterTransport.d.ts +23 -0
- package/dist/types/exceptions/ClusterRequestException.d.ts +11 -0
- package/dist/types/exceptions/ClusterTimeoutException.d.ts +10 -0
- package/dist/types/exceptions/ClusterTransportNotFoundException.d.ts +11 -0
- package/dist/types/exceptions/SignalingClientRequiredException.d.ts +12 -0
- package/dist/types/exceptions/SignalingConnectionException.d.ts +12 -0
- package/dist/types/exceptions/SignalingDeniedException.d.ts +11 -0
- package/dist/types/exceptions/SignalingLimitException.d.ts +11 -0
- package/dist/types/exceptions/SignalingNotAMemberException.d.ts +11 -0
- package/dist/types/exceptions/WHEPDeniedException.d.ts +15 -0
- package/dist/types/exceptions/WHEPLimitException.d.ts +15 -0
- package/dist/types/exceptions/WHEPMediaTypeException.d.ts +15 -0
- package/dist/types/exceptions/WHEPOfferException.d.ts +16 -0
- package/dist/types/exceptions/WHEPSessionNotFoundException.d.ts +15 -0
- package/dist/types/exceptions/WHIPDeniedException.d.ts +15 -0
- package/dist/types/exceptions/WHIPLimitException.d.ts +15 -0
- package/dist/types/exceptions/WHIPMediaTypeException.d.ts +15 -0
- package/dist/types/exceptions/WHIPOfferException.d.ts +16 -0
- package/dist/types/exceptions/WHIPSessionNotFoundException.d.ts +15 -0
- package/dist/types/exports/Client.d.ts +11 -0
- package/dist/types/exports/WebRTC.d.ts +48 -0
- package/dist/types/lib/common/binary.d.ts +51 -0
- package/dist/types/lib/common/binaryData.d.ts +116 -0
- package/dist/types/lib/common/crc.d.ts +4 -0
- package/dist/types/lib/common/deque.d.ts +36 -0
- package/dist/types/lib/common/event.d.ts +48 -0
- package/dist/types/lib/common/index.d.ts +11 -0
- package/dist/types/lib/common/log.d.ts +47 -0
- package/dist/types/lib/common/network.d.ts +10 -0
- package/dist/types/lib/common/number.d.ts +13 -0
- package/dist/types/lib/common/promise.d.ts +21 -0
- package/dist/types/lib/common/transport.d.ts +104 -0
- package/dist/types/lib/common/type.d.ts +3 -0
- package/dist/types/lib/dtls/cipher/const.d.ts +42 -0
- package/dist/types/lib/dtls/cipher/create.d.ts +21 -0
- package/dist/types/lib/dtls/cipher/ec.d.ts +28 -0
- package/dist/types/lib/dtls/cipher/key-exchange.d.ts +43 -0
- package/dist/types/lib/dtls/cipher/namedCurve.d.ts +7 -0
- package/dist/types/lib/dtls/cipher/prf.d.ts +17 -0
- package/dist/types/lib/dtls/cipher/suites/abstract.d.ts +40 -0
- package/dist/types/lib/dtls/cipher/suites/aead.d.ts +28 -0
- package/dist/types/lib/dtls/cipher/suites/null.d.ts +24 -0
- package/dist/types/lib/dtls/cipher/utils.d.ts +18 -0
- package/dist/types/lib/dtls/cipher/x509.d.ts +33 -0
- package/dist/types/lib/dtls/client.d.ts +7 -0
- package/dist/types/lib/dtls/context/cipher.d.ts +42 -0
- package/dist/types/lib/dtls/context/dtls.d.ts +38 -0
- package/dist/types/lib/dtls/context/srtp.d.ts +5 -0
- package/dist/types/lib/dtls/context/transport.d.ts +8 -0
- package/dist/types/lib/dtls/flight/client/flight1.d.ts +10 -0
- package/dist/types/lib/dtls/flight/client/flight3.d.ts +8 -0
- package/dist/types/lib/dtls/flight/client/flight5.d.ts +18 -0
- package/dist/types/lib/dtls/flight/flight.d.ts +18 -0
- package/dist/types/lib/dtls/flight/server/flight2.d.ts +6 -0
- package/dist/types/lib/dtls/flight/server/flight4.d.ts +17 -0
- package/dist/types/lib/dtls/flight/server/flight6.d.ts +13 -0
- package/dist/types/lib/dtls/handshake/binary.d.ts +16 -0
- package/dist/types/lib/dtls/handshake/const.d.ts +13 -0
- package/dist/types/lib/dtls/handshake/extensions/ellipticCurves.d.ts +17 -0
- package/dist/types/lib/dtls/handshake/extensions/extendedMasterSecret.d.ts +3 -0
- package/dist/types/lib/dtls/handshake/extensions/renegotiationIndication.d.ts +18 -0
- package/dist/types/lib/dtls/handshake/extensions/signature.d.ts +26 -0
- package/dist/types/lib/dtls/handshake/extensions/useSrtp.d.ts +19 -0
- package/dist/types/lib/dtls/handshake/message/alert.d.ts +12 -0
- package/dist/types/lib/dtls/handshake/message/certificate.d.ts +17 -0
- package/dist/types/lib/dtls/handshake/message/changeCipherSpec.d.ts +11 -0
- package/dist/types/lib/dtls/handshake/message/client/certificateVerify.d.ts +20 -0
- package/dist/types/lib/dtls/handshake/message/client/hello.d.ts +50 -0
- package/dist/types/lib/dtls/handshake/message/client/keyExchange.d.ts +17 -0
- package/dist/types/lib/dtls/handshake/message/finished.d.ts +13 -0
- package/dist/types/lib/dtls/handshake/message/server/certificateRequest.d.ts +31 -0
- package/dist/types/lib/dtls/handshake/message/server/hello.d.ts +33 -0
- package/dist/types/lib/dtls/handshake/message/server/helloDone.d.ts +12 -0
- package/dist/types/lib/dtls/handshake/message/server/helloVerifyRequest.d.ts +32 -0
- package/dist/types/lib/dtls/handshake/message/server/keyExchange.d.ts +32 -0
- package/dist/types/lib/dtls/handshake/random.d.ts +13 -0
- package/dist/types/lib/dtls/helper.d.ts +4 -0
- package/dist/types/lib/dtls/imports/common.d.ts +1 -0
- package/dist/types/lib/dtls/imports/rtp.d.ts +1 -0
- package/dist/types/lib/dtls/index.d.ts +7 -0
- package/dist/types/lib/dtls/record/antiReplayWindow.d.ts +27 -0
- package/dist/types/lib/dtls/record/builder.d.ts +9 -0
- package/dist/types/lib/dtls/record/const.d.ts +33 -0
- package/dist/types/lib/dtls/record/message/fragment.d.ts +26 -0
- package/dist/types/lib/dtls/record/message/header.d.ts +38 -0
- package/dist/types/lib/dtls/record/message/plaintext.d.ts +14 -0
- package/dist/types/lib/dtls/record/receive.d.ts +9 -0
- package/dist/types/lib/dtls/server.d.ts +6 -0
- package/dist/types/lib/dtls/socket.d.ts +52 -0
- package/dist/types/lib/dtls/typings/domain.d.ts +20 -0
- package/dist/types/lib/dtls/util/binary.d.ts +2 -0
- package/dist/types/lib/ice/candidate.d.ts +35 -0
- package/dist/types/lib/ice/dns/lookup.d.ts +16 -0
- package/dist/types/lib/ice/dns/mdns.d.ts +38 -0
- package/dist/types/lib/ice/exceptions.d.ts +24 -0
- package/dist/types/lib/ice/helper.d.ts +17 -0
- package/dist/types/lib/ice/ice.d.ts +182 -0
- package/dist/types/lib/ice/iceBase.d.ts +214 -0
- package/dist/types/lib/ice/imports/common.d.ts +1 -0
- package/dist/types/lib/ice/index.d.ts +12 -0
- package/dist/types/lib/ice/internal/selectAddresses.d.ts +9 -0
- package/dist/types/lib/ice/stun/attributes.d.ts +1 -0
- package/dist/types/lib/ice/stun/const.d.ts +8 -0
- package/dist/types/lib/ice/stun/message.d.ts +1 -0
- package/dist/types/lib/ice/stun/protocol.d.ts +30 -0
- package/dist/types/lib/ice/stun/tcpFrame.d.ts +5 -0
- package/dist/types/lib/ice/stun/tcpProtocol.d.ts +57 -0
- package/dist/types/lib/ice/stun/transaction.d.ts +75 -0
- package/dist/types/lib/ice/turn/frame.d.ts +1 -0
- package/dist/types/lib/ice/turn/protocol.d.ts +170 -0
- package/dist/types/lib/ice/types/model.d.ts +56 -0
- package/dist/types/lib/ice/utils.d.ts +13 -0
- package/dist/types/lib/peer/const.d.ts +36 -0
- package/dist/types/lib/peer/dataChannel.d.ts +69 -0
- package/dist/types/lib/peer/errors.d.ts +11 -0
- package/dist/types/lib/peer/helper.d.ts +20 -0
- package/dist/types/lib/peer/imports/common.d.ts +1 -0
- package/dist/types/lib/peer/imports/dtls.d.ts +1 -0
- package/dist/types/lib/peer/imports/ice.d.ts +1 -0
- package/dist/types/lib/peer/imports/rtp.d.ts +1 -0
- package/dist/types/lib/peer/index.d.ts +14 -0
- package/dist/types/lib/peer/media/codec.d.ts +15 -0
- package/dist/types/lib/peer/media/codecCompatibility.d.ts +23 -0
- package/dist/types/lib/peer/media/extension/rtcpFeedback.d.ts +6 -0
- package/dist/types/lib/peer/media/extension/rtpExtension.d.ts +9 -0
- package/dist/types/lib/peer/media/index.d.ts +12 -0
- package/dist/types/lib/peer/media/parameters.d.ts +65 -0
- package/dist/types/lib/peer/media/receiver/nack.d.ts +23 -0
- package/dist/types/lib/peer/media/receiver/receiverTwcc.d.ts +47 -0
- package/dist/types/lib/peer/media/receiver/statistics.d.ts +22 -0
- package/dist/types/lib/peer/media/router.d.ts +25 -0
- package/dist/types/lib/peer/media/rtpReceiver.d.ts +90 -0
- package/dist/types/lib/peer/media/rtpSender.d.ts +209 -0
- package/dist/types/lib/peer/media/rtpTransceiver.d.ts +117 -0
- package/dist/types/lib/peer/media/sender/cumulativeResult.d.ts +19 -0
- package/dist/types/lib/peer/media/sender/senderBWE.d.ts +32 -0
- package/dist/types/lib/peer/media/stats.d.ts +293 -0
- package/dist/types/lib/peer/media/track.d.ts +67 -0
- package/dist/types/lib/peer/peerConnection.d.ts +458 -0
- package/dist/types/lib/peer/sctpManager.d.ts +28 -0
- package/dist/types/lib/peer/sdp.d.ts +97 -0
- package/dist/types/lib/peer/sdpManager.d.ts +116 -0
- package/dist/types/lib/peer/secureTransportManager.d.ts +96 -0
- package/dist/types/lib/peer/transceiverManager.d.ts +151 -0
- package/dist/types/lib/peer/transport/dtls.d.ts +95 -0
- package/dist/types/lib/peer/transport/ice.d.ts +143 -0
- package/dist/types/lib/peer/transport/sctp.d.ts +56 -0
- package/dist/types/lib/peer/types/domain.d.ts +5 -0
- package/dist/types/lib/peer/types/util.d.ts +2 -0
- package/dist/types/lib/peer/utils.d.ts +73 -0
- package/dist/types/lib/rtp/codec/av1.d.ts +56 -0
- package/dist/types/lib/rtp/codec/base.d.ts +8 -0
- package/dist/types/lib/rtp/codec/h264.d.ts +32 -0
- package/dist/types/lib/rtp/codec/index.d.ts +16 -0
- package/dist/types/lib/rtp/codec/leb128.d.ts +5 -0
- package/dist/types/lib/rtp/codec/opus.d.ts +9 -0
- package/dist/types/lib/rtp/codec/vp8.d.ts +27 -0
- package/dist/types/lib/rtp/codec/vp9.d.ts +46 -0
- package/dist/types/lib/rtp/const.d.ts +1 -0
- package/dist/types/lib/rtp/helper.d.ts +8 -0
- package/dist/types/lib/rtp/imports/common.d.ts +1 -0
- package/dist/types/lib/rtp/index.d.ts +25 -0
- package/dist/types/lib/rtp/rtcp/header.d.ts +13 -0
- package/dist/types/lib/rtp/rtcp/psfb/fullIntraRequest.d.ts +16 -0
- package/dist/types/lib/rtp/rtcp/psfb/index.d.ts +14 -0
- package/dist/types/lib/rtp/rtcp/psfb/pictureLossIndication.d.ts +10 -0
- package/dist/types/lib/rtp/rtcp/psfb/remb.d.ts +16 -0
- package/dist/types/lib/rtp/rtcp/rr.d.ts +32 -0
- package/dist/types/lib/rtp/rtcp/rtcp.d.ts +10 -0
- package/dist/types/lib/rtp/rtcp/rtpfb/const.d.ts +1 -0
- package/dist/types/lib/rtp/rtcp/rtpfb/index.d.ts +14 -0
- package/dist/types/lib/rtp/rtcp/rtpfb/nack.d.ts +17 -0
- package/dist/types/lib/rtp/rtcp/rtpfb/twcc.d.ts +71 -0
- package/dist/types/lib/rtp/rtcp/sdes.d.ts +26 -0
- package/dist/types/lib/rtp/rtcp/sr.d.ts +41 -0
- package/dist/types/lib/rtp/rtp/headerExtension.d.ts +72 -0
- package/dist/types/lib/rtp/rtp/red/encoder.d.ts +13 -0
- package/dist/types/lib/rtp/rtp/red/handler.d.ts +6 -0
- package/dist/types/lib/rtp/rtp/red/packet.d.ts +26 -0
- package/dist/types/lib/rtp/rtp/rtp.d.ts +44 -0
- package/dist/types/lib/rtp/rtp/rtx.d.ts +3 -0
- package/dist/types/lib/rtp/srtp/cipher/ctr.d.ts +16 -0
- package/dist/types/lib/rtp/srtp/cipher/gcm.d.ts +17 -0
- package/dist/types/lib/rtp/srtp/cipher/index.d.ts +13 -0
- package/dist/types/lib/rtp/srtp/const.d.ts +6 -0
- package/dist/types/lib/rtp/srtp/context/context.d.ts +45 -0
- package/dist/types/lib/rtp/srtp/context/srtcp.d.ts +8 -0
- package/dist/types/lib/rtp/srtp/context/srtp.d.ts +9 -0
- package/dist/types/lib/rtp/srtp/error.d.ts +3 -0
- package/dist/types/lib/rtp/srtp/packet.d.ts +5 -0
- package/dist/types/lib/rtp/srtp/session.d.ts +19 -0
- package/dist/types/lib/rtp/srtp/srtcp.d.ts +8 -0
- package/dist/types/lib/rtp/srtp/srtp.d.ts +9 -0
- package/dist/types/lib/rtp/transport.d.ts +15 -0
- package/dist/types/lib/rtp/util.d.ts +11 -0
- package/dist/types/lib/sctp/chunk.d.ts +164 -0
- package/dist/types/lib/sctp/const.d.ts +17 -0
- package/dist/types/lib/sctp/helper.d.ts +5 -0
- package/dist/types/lib/sctp/imports/common.d.ts +1 -0
- package/dist/types/lib/sctp/index.d.ts +6 -0
- package/dist/types/lib/sctp/param.d.ts +40 -0
- package/dist/types/lib/sctp/sctp.d.ts +210 -0
- package/dist/types/lib/sctp/transport.d.ts +15 -0
- package/dist/types/lib/turn/index.d.ts +9 -0
- package/dist/types/lib/turn/node/server.d.ts +21 -0
- package/dist/types/lib/turn/node/turnServer.d.ts +91 -0
- package/dist/types/lib/turn/protocol.d.ts +47 -0
- package/dist/types/lib/turn/stun/attributes.d.ts +37 -0
- package/dist/types/lib/turn/stun/const.d.ts +28 -0
- package/dist/types/lib/turn/stun/ip.d.ts +12 -0
- package/dist/types/lib/turn/stun/message.d.ts +37 -0
- package/dist/types/lib/turn/turn/auth.d.ts +1 -0
- package/dist/types/lib/turn/turn/frame.d.ts +13 -0
- package/dist/types/lib/turn/turn/protocol.d.ts +147 -0
- package/dist/types/peer/Endpoints.d.ts +75 -0
- package/dist/types/peer/EngineConfig.d.ts +20 -0
- package/dist/types/peer/EngineConnection.d.ts +22 -0
- package/dist/types/peer/Events.d.ts +55 -0
- package/dist/types/peer/MediaCodecs.d.ts +27 -0
- package/dist/types/peer/MediaTrack.d.ts +212 -0
- package/dist/types/peer/PeerChannel.d.ts +248 -0
- package/dist/types/peer/PeerConnection.d.ts +603 -0
- package/dist/types/peer/PeerThreadChannel.d.ts +112 -0
- package/dist/types/peer/PeerThreadProtocol.d.ts +325 -0
- package/dist/types/peer/PeerThreads.d.ts +114 -0
- package/dist/types/peer/PeerWorker.d.ts +6 -0
- package/dist/types/peer/PeerWorkerCode.d.ts +5 -0
- package/dist/types/peer/RemoteConnection.d.ts +314 -0
- package/dist/types/peer/RtpPacket.d.ts +112 -0
- package/dist/types/peer/RtpTransceiver.d.ts +167 -0
- package/dist/types/peer/SignalingClient.d.ts +236 -0
- package/dist/types/protocol/SignalingProtocol.d.ts +266 -0
- package/dist/types/service/WebRTCServiceEntrypoint.d.ts +158 -0
- package/dist/types/sfu/SFU.d.ts +356 -0
- package/dist/types/sfu/SFUAccess.d.ts +48 -0
- package/dist/types/sfu/SFUClusterLeg.d.ts +101 -0
- package/dist/types/sfu/SFURoom.d.ts +148 -0
- package/dist/types/sfu/SFUWorker.d.ts +13 -0
- package/dist/types/sfu/SFUWorkerChannel.d.ts +204 -0
- package/dist/types/sfu/SFUWorkerCode.d.ts +5 -0
- package/dist/types/sfu/SFUWorkers.d.ts +247 -0
- package/dist/types/shared/ChunkedChannel.d.ts +122 -0
- package/dist/types/shared/Connections.d.ts +231 -0
- package/dist/types/shared/Emitter.d.ts +50 -0
- package/dist/types/shared/Peer.d.ts +182 -0
- package/dist/types/shared/PeerServiceProxy.d.ts +173 -0
- package/dist/types/shared/Room.d.ts +143 -0
- package/dist/types/shared/SignalingError.d.ts +40 -0
- package/dist/types/shared/SignalingSession.d.ts +97 -0
- package/dist/types/shared/Transports.d.ts +139 -0
- package/dist/types/signaling/MediaServers.d.ts +40 -0
- package/dist/types/signaling/Signaling.d.ts +573 -0
- package/dist/types/signaling/SignalingController.d.ts +128 -0
- package/dist/types/turn/TURNCredentials.d.ts +49 -0
- package/dist/types/turn/TURNIceServers.d.ts +11 -0
- package/dist/types/turn/TURNServer.d.ts +309 -0
- package/dist/types/turn/TURNWorker.d.ts +42 -0
- package/dist/types/turn/TURNWorkerCode.d.ts +5 -0
- package/dist/types/turn/TURNWorkers.d.ts +52 -0
- package/dist/types/whep/WHEP.d.ts +386 -0
- package/dist/types/whep/WHEPController.d.ts +134 -0
- package/dist/types/whip/WHIP.d.ts +426 -0
- package/dist/types/whip/WHIPController.d.ts +132 -0
- package/package.json +115 -4
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WHIP = void 0;
|
|
13
|
+
exports.buildWHIPOptions = buildWHIPOptions;
|
|
14
|
+
const node_crypto_1 = require("node:crypto");
|
|
15
|
+
const core_1 = require("@lakutata/core");
|
|
16
|
+
const di_1 = require("@lakutata/core/decorator/di");
|
|
17
|
+
const ClusterTURN_js_1 = require("../cluster/ClusterTURN.js");
|
|
18
|
+
const Endpoints_js_1 = require("../peer/Endpoints.js");
|
|
19
|
+
const PeerConnection_js_1 = require("../peer/PeerConnection.js");
|
|
20
|
+
const WHIPDeniedException_js_1 = require("../exceptions/WHIPDeniedException.js");
|
|
21
|
+
const WHIPLimitException_js_1 = require("../exceptions/WHIPLimitException.js");
|
|
22
|
+
const WHIPOfferException_js_1 = require("../exceptions/WHIPOfferException.js");
|
|
23
|
+
const WHIPSessionNotFoundException_js_1 = require("../exceptions/WHIPSessionNotFoundException.js");
|
|
24
|
+
const SignalingLimitException_js_1 = require("../exceptions/SignalingLimitException.js");
|
|
25
|
+
const SFUAccess_js_1 = require("../sfu/SFUAccess.js");
|
|
26
|
+
/**
|
|
27
|
+
* The topic of the requests ending a session on the node holding it
|
|
28
|
+
*/
|
|
29
|
+
const UNPUBLISH_TOPIC = 'webrtc.whip.unpublish';
|
|
30
|
+
/**
|
|
31
|
+
* How long a DELETE waits for the nodes of the cluster, in milliseconds
|
|
32
|
+
*/
|
|
33
|
+
const UNPUBLISH_TIMEOUT = 2000;
|
|
34
|
+
/**
|
|
35
|
+
* The topic of the requests applying a PATCH of a session on the node holding it
|
|
36
|
+
*/
|
|
37
|
+
const PATCH_TOPIC = 'webrtc.whip.patch';
|
|
38
|
+
/**
|
|
39
|
+
* How long a PATCH waits for the nodes of the cluster (an ICE restart gathers candidates), in milliseconds
|
|
40
|
+
*/
|
|
41
|
+
const PATCH_TIMEOUT = 12000;
|
|
42
|
+
/**
|
|
43
|
+
* The ingestion of WHIP (RFC 9725): encoders (OBS, GStreamer, ffmpeg) and browsers publish a stream with an HTTP POST
|
|
44
|
+
* of their offer, and the application receives their audio and video. Each publication is a session with (without a
|
|
45
|
+
* media server) a {@link PeerConnection} and its tracks; the component emits `publish` (the session) once it answers,
|
|
46
|
+
* and `unpublish` (the session) when it ends: the publisher deleted it, its connection failed or closed, or the
|
|
47
|
+
* application stopped. The tracks give their RTP packets, to record them or to send them on to other connections.
|
|
48
|
+
* With a media server (`sfu`), a stream goes to a room of the server instead (`roomOf`, the stream by default), as a
|
|
49
|
+
* member sending its tracks to the other members and to the viewers of WHEP.
|
|
50
|
+
*
|
|
51
|
+
* Register it as `whip` with {@link buildWHIPOptions}, and add `WHIPController` to the controllers of the entrypoint,
|
|
52
|
+
* with an HTTP adapter reading the bodies of WHIP as text (its option
|
|
53
|
+
* `body: {text: ['application/sdp', 'application/trickle-ice-sdpfrag']}`). The answers carry all the candidates; a
|
|
54
|
+
* PATCH of a session gives it the candidates of its publisher (trickle ICE), or restarts ICE (RFC 9725, section 4.3).
|
|
55
|
+
* Behind a load balancer, give it a `cluster`: the DELETE of a session may reach another instance, which ends it on the
|
|
56
|
+
* instance holding it.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import {Application, Component} from 'lakutata'
|
|
60
|
+
* import {buildEntrypoints} from 'lakutata/com/entrypoint'
|
|
61
|
+
* import {expressHTTPEntrypoint} from 'lakutata/adapter/express'
|
|
62
|
+
* import {buildWHIPOptions, type MediaTrack, type RtpPacket, type WHIP, type WHIPSession, WHIPController} from '@lakutata/webrtc'
|
|
63
|
+
*
|
|
64
|
+
* //The application's own component, receiving the streams
|
|
65
|
+
* class Recorder extends Component {
|
|
66
|
+
* protected async init(): Promise<void> {
|
|
67
|
+
* const whip: WHIP = await this.getObject<WHIP>('whip')
|
|
68
|
+
* whip.on('publish', (session: WHIPSession): void => {
|
|
69
|
+
* session.tracks?.forEach((track: MediaTrack): void => {
|
|
70
|
+
* track.on('rtp', (packet: RtpPacket): void => console.log(session.stream, track.kind, packet.payload.length))
|
|
71
|
+
* })
|
|
72
|
+
* })
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* Application.run(() => ({
|
|
77
|
+
* id: 'ingest.app',
|
|
78
|
+
* name: 'Ingest',
|
|
79
|
+
* components: {
|
|
80
|
+
* //OBS publishes to https://ingest.example.com/whip/studio with the bearer token of the environment
|
|
81
|
+
* whip: buildWHIPOptions({
|
|
82
|
+
* authorize: ({stream, token}): boolean => stream === 'studio' && token === process.env.WHIP_TOKEN,
|
|
83
|
+
* iceAdditionalHostAddresses: ['203.0.113.10'],
|
|
84
|
+
* icePortRange: [40000, 40999]
|
|
85
|
+
* }),
|
|
86
|
+
* recorder: {class: Recorder},
|
|
87
|
+
* entrypoint: buildEntrypoints({
|
|
88
|
+
* controllers: [WHIPController],
|
|
89
|
+
* http: expressHTTPEntrypoint({port: 8080, body: {text: ['application/sdp', 'application/trickle-ice-sdpfrag']}})
|
|
90
|
+
* })
|
|
91
|
+
* },
|
|
92
|
+
* bootstrap: ['recorder', 'entrypoint']
|
|
93
|
+
* }))
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
let WHIP = class WHIP extends core_1.Component {
|
|
97
|
+
#sessions = new Map();
|
|
98
|
+
//The connections of the sessions going to the media server
|
|
99
|
+
#legs = new Map();
|
|
100
|
+
//The entity tags of the ICE sessions of the sessions
|
|
101
|
+
#tags = new Map();
|
|
102
|
+
#clusterObject;
|
|
103
|
+
#unhandle;
|
|
104
|
+
/**
|
|
105
|
+
* Join the cluster: end the sessions of this node asked by the others.
|
|
106
|
+
* @protected
|
|
107
|
+
*/
|
|
108
|
+
async init() {
|
|
109
|
+
if (!this.cluster)
|
|
110
|
+
return;
|
|
111
|
+
const cluster = await this.getObject(this.cluster);
|
|
112
|
+
this.#clusterObject = cluster;
|
|
113
|
+
const unhandle = [
|
|
114
|
+
cluster.handle(UNPUBLISH_TOPIC, ({ id, stream }) => this.end(id, stream)),
|
|
115
|
+
cluster.handle(PATCH_TOPIC, async ({ id, fragment, stream, ifMatch }) => await this.#patchHere(id, fragment, stream, ifMatch) ?? null)
|
|
116
|
+
];
|
|
117
|
+
this.#unhandle = () => unhandle.forEach((each) => each());
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* End the sessions.
|
|
121
|
+
* @protected
|
|
122
|
+
*/
|
|
123
|
+
async destroy() {
|
|
124
|
+
this.#unhandle?.();
|
|
125
|
+
for (const id of [...this.#sessions.keys()])
|
|
126
|
+
this.end(id);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The sessions of this node.
|
|
130
|
+
*/
|
|
131
|
+
get sessions() {
|
|
132
|
+
return [...this.#sessions.values()];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The origins the browsers may publish from.
|
|
136
|
+
*/
|
|
137
|
+
get allowedOrigin() {
|
|
138
|
+
return this.allowOrigin;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A session.
|
|
142
|
+
* @param id The id of the session.
|
|
143
|
+
* @returns The session, `undefined` when there is none of this id.
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* import type {WHIP, WHIPSession} from '@lakutata/webrtc'
|
|
147
|
+
*
|
|
148
|
+
* declare const whip: WHIP
|
|
149
|
+
* const session: WHIPSession | undefined = whip.session('0b7d…')
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
session(id) {
|
|
153
|
+
return this.#sessions.get(id);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Publish a stream: answer the offer of its publisher, with all the candidates of the connection. `WHIPController`
|
|
157
|
+
* calls it for the POST requests.
|
|
158
|
+
* @param stream The stream.
|
|
159
|
+
* @param offer The SDP offer of the publisher.
|
|
160
|
+
* @param options The bearer token of the publisher, and the context of its request (for `authorize`).
|
|
161
|
+
* @returns The session, and the answer.
|
|
162
|
+
* @throws {WHIPDeniedException} When `authorize` refuses the stream.
|
|
163
|
+
* @throws {WHIPLimitException} When there are `maxSessions` sessions already.
|
|
164
|
+
* @throws {WHIPOfferException} When the offer has no audio or video, or the connection refuses it.
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* import type {SignalingDescription, WHIP, WHIPSession} from '@lakutata/webrtc'
|
|
168
|
+
*
|
|
169
|
+
* declare const whip: WHIP
|
|
170
|
+
* declare const offer: SignalingDescription
|
|
171
|
+
* const {session, answer}: {session: WHIPSession, answer: SignalingDescription} = await whip.publish('studio', offer)
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
async publish(stream, offer, options = {}) {
|
|
175
|
+
if (this.authorize && !(await this.authorize({ stream: stream, token: options.token }, options.context))) {
|
|
176
|
+
throw new WHIPDeniedException_js_1.WHIPDeniedException('The stream {stream} may not be published', { stream: stream });
|
|
177
|
+
}
|
|
178
|
+
if (this.maxSessions && this.#sessions.size >= this.maxSessions)
|
|
179
|
+
throw new WHIPLimitException_js_1.WHIPLimitException('There are {count} sessions already', { count: this.#sessions.size });
|
|
180
|
+
if (offer.type !== 'offer' || !/^m=(audio|video) /m.test(offer.sdp ?? ''))
|
|
181
|
+
throw new WHIPOfferException_js_1.WHIPOfferException('The offer has no audio and no video');
|
|
182
|
+
if (this.sfu)
|
|
183
|
+
return await this.publishToSFU(stream, offer, options);
|
|
184
|
+
const connection = await this.getObject(PeerConnection_js_1.PeerConnection, {
|
|
185
|
+
...this.icePortRange ? { icePortRange: this.icePortRange } : {},
|
|
186
|
+
...this.iceAdditionalHostAddresses ? { iceAdditionalHostAddresses: this.iceAdditionalHostAddresses } : {},
|
|
187
|
+
...this.codecs ? { codecs: this.codecs } : {}
|
|
188
|
+
});
|
|
189
|
+
const tracks = [];
|
|
190
|
+
const session = { id: (0, node_crypto_1.randomUUID)(), stream: stream, connection: connection, tracks: tracks };
|
|
191
|
+
connection.on('track', (track) => void tracks.push(track));
|
|
192
|
+
//The session ends when its connection fails or closes; before the answer, the publication is refused
|
|
193
|
+
connection.on('connectionstatechange', (state) => {
|
|
194
|
+
if (state === 'failed' || state === 'closed')
|
|
195
|
+
this.end(session.id);
|
|
196
|
+
});
|
|
197
|
+
try {
|
|
198
|
+
await connection.setRemoteDescription(offer);
|
|
199
|
+
await connection.setLocalDescription();
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
connection.close();
|
|
203
|
+
throw new WHIPOfferException_js_1.WHIPOfferException('The offer is refused: {reason}', { reason: error.message });
|
|
204
|
+
}
|
|
205
|
+
await (0, Endpoints_js_1.gathered)(connection);
|
|
206
|
+
if (connection.connectionState === 'failed' || connection.connectionState === 'closed') {
|
|
207
|
+
connection.close();
|
|
208
|
+
throw new WHIPOfferException_js_1.WHIPOfferException('The connection {state} before the answer', { state: connection.connectionState });
|
|
209
|
+
}
|
|
210
|
+
this.#sessions.set(session.id, session);
|
|
211
|
+
this.#tags.set(session.id, (0, Endpoints_js_1.entityTag)());
|
|
212
|
+
this.emit('publish', session);
|
|
213
|
+
return { session: session, answer: connection.localDescription };
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Publish a stream to a room of the media server
|
|
217
|
+
* @param stream The stream.
|
|
218
|
+
* @param offer The SDP offer of the publisher.
|
|
219
|
+
* @param options The bearer token of the publisher, and the context of its request (for `roomOf`).
|
|
220
|
+
* @returns The session, and the answer.
|
|
221
|
+
* @protected
|
|
222
|
+
*/
|
|
223
|
+
async publishToSFU(stream, offer, options) {
|
|
224
|
+
const sfu = await this.getObject(this.sfu);
|
|
225
|
+
const room = this.roomOf ? await this.roomOf({ stream: stream, token: options.token }, options.context) : stream;
|
|
226
|
+
let published;
|
|
227
|
+
try {
|
|
228
|
+
published = await SFUAccess_js_1.sfuAccess.get(sfu).publish(room, offer);
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
if (error instanceof SignalingLimitException_js_1.SignalingLimitException)
|
|
232
|
+
throw new WHIPLimitException_js_1.WHIPLimitException('The media server takes no more members');
|
|
233
|
+
throw new WHIPOfferException_js_1.WHIPOfferException('The offer is refused: {reason}', { reason: error.message });
|
|
234
|
+
}
|
|
235
|
+
const session = { id: (0, node_crypto_1.randomUUID)(), stream: stream, room: room, peerId: published.peerId };
|
|
236
|
+
this.#sessions.set(session.id, session);
|
|
237
|
+
this.#tags.set(session.id, (0, Endpoints_js_1.entityTag)());
|
|
238
|
+
this.#legs.set(session.id, published.leg);
|
|
239
|
+
published.leg.ended(() => this.end(session.id));
|
|
240
|
+
this.emit('publish', session);
|
|
241
|
+
return { session: session, answer: published.leg.answer };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* End a session: close its connection, and emit `unpublish` (on the node holding it). `WHIPController` calls it for
|
|
245
|
+
* the DELETE requests. With a cluster, a session of another node is ended there.
|
|
246
|
+
* @param id The id of the session.
|
|
247
|
+
* @param stream Only if it is a session of this stream.
|
|
248
|
+
* @returns Whether there was such a session.
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* import type {WHIP, WHIPSession} from '@lakutata/webrtc'
|
|
252
|
+
*
|
|
253
|
+
* declare const whip: WHIP
|
|
254
|
+
* //Stop the publications of a stream on this node
|
|
255
|
+
* await Promise.all(whip.sessions.filter((session: WHIPSession): boolean => session.stream === 'studio').map((session: WHIPSession): Promise<boolean> => whip.unpublish(session.id)))
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
async unpublish(id, stream) {
|
|
259
|
+
if (this.#sessions.has(id) || !this.#clusterObject)
|
|
260
|
+
return this.end(id, stream);
|
|
261
|
+
const replies = await this.#clusterObject.requestAll(UNPUBLISH_TOPIC, { id: id, stream: stream }, { timeout: UNPUBLISH_TIMEOUT });
|
|
262
|
+
return replies.some((reply) => reply.result === true);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* End a session of this node
|
|
266
|
+
* @param id The id of the session.
|
|
267
|
+
* @param stream Only if it is a session of this stream.
|
|
268
|
+
* @returns Whether there was such a session.
|
|
269
|
+
* @protected
|
|
270
|
+
*/
|
|
271
|
+
end(id, stream) {
|
|
272
|
+
const session = this.#sessions.get(id);
|
|
273
|
+
if (!session || (stream !== undefined && session.stream !== stream))
|
|
274
|
+
return false;
|
|
275
|
+
this.#sessions.delete(id);
|
|
276
|
+
this.#tags.delete(id);
|
|
277
|
+
session.connection?.close();
|
|
278
|
+
this.#legs.get(id)?.close();
|
|
279
|
+
this.#legs.delete(id);
|
|
280
|
+
this.emit('unpublish', session);
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The entity tag of the ICE session of a session of this node (its `ETag`): a new one after each ICE restart.
|
|
285
|
+
* @param id The id of the session.
|
|
286
|
+
* @returns The tag, `undefined` when there is no session of this id.
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* import type {WHIP} from '@lakutata/webrtc'
|
|
290
|
+
*
|
|
291
|
+
* declare const whip: WHIP
|
|
292
|
+
* const tag: string | undefined = whip.entityTagOf('0b7d…')
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
entityTagOf(id) {
|
|
296
|
+
return this.#tags.get(id);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Apply a PATCH of a session (RFC 9725, section 4.3), on the node holding it: the candidates of its publisher
|
|
300
|
+
* (trickle ICE), or an ICE restart when its credentials changed, which needs `If-Match: *`. `WHIPController` calls
|
|
301
|
+
* it for the PATCH requests. With a cluster, a session of another node is patched there.
|
|
302
|
+
* @param id The id of the session.
|
|
303
|
+
* @param fragment The fragment of SDP of the request (`application/trickle-ice-sdpfrag`).
|
|
304
|
+
* @param options The stream the session must be of, and the `If-Match` of the request: `*` for any ICE session, or
|
|
305
|
+
* the entity tag of one, quoted.
|
|
306
|
+
* @returns The fragment of SDP answering an ICE restart (none for trickle ICE), and the entity tag of the ICE session;
|
|
307
|
+
* `stale` when the request is not applied: its `If-Match` is not the entity tag of the session, or its credentials
|
|
308
|
+
* changed without `If-Match: *` (a request sent again after a restart).
|
|
309
|
+
* @throws {WHIPSessionNotFoundException} When no node has a session of this id, or the session is not of this
|
|
310
|
+
* stream.
|
|
311
|
+
* @throws {WHIPOfferException} When the fragment has no ICE, or the connection refuses it.
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* import type {WHIP} from '@lakutata/webrtc'
|
|
315
|
+
*
|
|
316
|
+
* declare const whip: WHIP
|
|
317
|
+
* declare const fragment: string
|
|
318
|
+
* //An ICE restart
|
|
319
|
+
* const {fragment: answer, tag} = await whip.patch('0b7d…', fragment, {ifMatch: '*'})
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
async patch(id, fragment, options = {}) {
|
|
323
|
+
let outcome = await this.#patchHere(id, fragment, options.stream, options.ifMatch);
|
|
324
|
+
if (!outcome && this.#clusterObject) {
|
|
325
|
+
const replies = await this.#clusterObject.requestAll(PATCH_TOPIC, { id: id, fragment: fragment, ...options }, { timeout: PATCH_TIMEOUT });
|
|
326
|
+
outcome = replies.find((reply) => !!reply.result)?.result ?? undefined;
|
|
327
|
+
}
|
|
328
|
+
if (!outcome)
|
|
329
|
+
throw new WHIPSessionNotFoundException_js_1.WHIPSessionNotFoundException('There is no session {session}', { session: id });
|
|
330
|
+
if ('refused' in outcome)
|
|
331
|
+
throw new WHIPOfferException_js_1.WHIPOfferException('The ICE fragment is refused: {reason}', { reason: outcome.refused });
|
|
332
|
+
return outcome;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Apply a PATCH of a session of this node
|
|
336
|
+
* @param id
|
|
337
|
+
* @param fragment
|
|
338
|
+
* @param stream
|
|
339
|
+
* @param ifMatch
|
|
340
|
+
* @returns What it gives, or undefined when this node has no such session.
|
|
341
|
+
*/
|
|
342
|
+
async #patchHere(id, fragment, stream, ifMatch) {
|
|
343
|
+
const session = this.#sessions.get(id);
|
|
344
|
+
const connection = session?.connection;
|
|
345
|
+
const leg = this.#legs.get(id);
|
|
346
|
+
if (!session || (!connection && !leg) || (stream !== undefined && session.stream !== stream))
|
|
347
|
+
return undefined;
|
|
348
|
+
const tag = this.#tags.get(id) ?? '';
|
|
349
|
+
if (ifMatch !== undefined && ifMatch !== '*' && ifMatch !== `"${tag}"`)
|
|
350
|
+
return { tag: tag, stale: true };
|
|
351
|
+
//A restart only with If-Match: * (RFC 9725, section 4.3.2)
|
|
352
|
+
const restart = ifMatch === '*';
|
|
353
|
+
let answer;
|
|
354
|
+
try {
|
|
355
|
+
answer = connection ? await (0, Endpoints_js_1.patchConnection)(connection, fragment, restart) : await leg.patch(fragment, restart);
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
return { refused: error.message };
|
|
359
|
+
}
|
|
360
|
+
if (answer === null)
|
|
361
|
+
return { tag: this.#tags.get(id) ?? '', stale: true };
|
|
362
|
+
if (answer !== undefined && this.#sessions.has(id))
|
|
363
|
+
this.#tags.set(id, (0, Endpoints_js_1.entityTag)());
|
|
364
|
+
return { ...answer === undefined ? {} : { fragment: answer }, tag: this.#tags.get(id) ?? '' };
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The ICE servers given to a publisher, with new TURN credentials.
|
|
368
|
+
* @param stream The stream (the user of the TURN credentials).
|
|
369
|
+
* @returns The ICE servers.
|
|
370
|
+
* @example
|
|
371
|
+
* ```typescript
|
|
372
|
+
* import type {SignalingIceServer, WHIP} from '@lakutata/webrtc'
|
|
373
|
+
*
|
|
374
|
+
* declare const whip: WHIP
|
|
375
|
+
* const iceServers: SignalingIceServer[] = await whip.iceServersOf('studio')
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
async iceServersOf(stream) {
|
|
379
|
+
return (0, ClusterTURN_js_1.iceServersFor)(stream, {
|
|
380
|
+
turn: this.turn ? await this.getObject(this.turn) : undefined,
|
|
381
|
+
cluster: this.#clusterObject,
|
|
382
|
+
secret: this.turnSecret,
|
|
383
|
+
select: this.selectTURN,
|
|
384
|
+
iceServers: this.iceServers
|
|
385
|
+
}).iceServers;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
exports.WHIP = WHIP;
|
|
389
|
+
__decorate([
|
|
390
|
+
(0, di_1.Configurable)(core_1.DTO.Function().optional()),
|
|
391
|
+
__metadata("design:type", Function)
|
|
392
|
+
], WHIP.prototype, "authorize", void 0);
|
|
393
|
+
__decorate([
|
|
394
|
+
(0, di_1.Configurable)(core_1.DTO.String().optional()),
|
|
395
|
+
__metadata("design:type", String)
|
|
396
|
+
], WHIP.prototype, "turn", void 0);
|
|
397
|
+
__decorate([
|
|
398
|
+
(0, di_1.Configurable)(core_1.DTO.String().optional()),
|
|
399
|
+
__metadata("design:type", String)
|
|
400
|
+
], WHIP.prototype, "sfu", void 0);
|
|
401
|
+
__decorate([
|
|
402
|
+
(0, di_1.Configurable)(core_1.DTO.Function().optional()),
|
|
403
|
+
__metadata("design:type", Function)
|
|
404
|
+
], WHIP.prototype, "roomOf", void 0);
|
|
405
|
+
__decorate([
|
|
406
|
+
(0, di_1.Configurable)(core_1.DTO.String().optional()),
|
|
407
|
+
__metadata("design:type", String)
|
|
408
|
+
], WHIP.prototype, "cluster", void 0);
|
|
409
|
+
__decorate([
|
|
410
|
+
(0, di_1.Configurable)(core_1.DTO.String().min(1).optional()),
|
|
411
|
+
__metadata("design:type", String)
|
|
412
|
+
], WHIP.prototype, "turnSecret", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
(0, di_1.Configurable)(core_1.DTO.Function().optional()),
|
|
415
|
+
__metadata("design:type", Function)
|
|
416
|
+
], WHIP.prototype, "selectTURN", void 0);
|
|
417
|
+
__decorate([
|
|
418
|
+
(0, di_1.Configurable)(core_1.DTO.Array().items(core_1.DTO.Object({
|
|
419
|
+
urls: core_1.DTO.Alternatives(core_1.DTO.String(), core_1.DTO.Array().items(core_1.DTO.String())).required(),
|
|
420
|
+
username: core_1.DTO.String().optional(),
|
|
421
|
+
credential: core_1.DTO.String().optional()
|
|
422
|
+
})).optional().default([])),
|
|
423
|
+
__metadata("design:type", Array)
|
|
424
|
+
], WHIP.prototype, "iceServers", void 0);
|
|
425
|
+
__decorate([
|
|
426
|
+
(0, di_1.Configurable)(core_1.DTO.Number().integer().min(0).optional().default(100)),
|
|
427
|
+
__metadata("design:type", Number)
|
|
428
|
+
], WHIP.prototype, "maxSessions", void 0);
|
|
429
|
+
__decorate([
|
|
430
|
+
(0, di_1.Configurable)(core_1.DTO.String().optional().default('*')),
|
|
431
|
+
__metadata("design:type", String)
|
|
432
|
+
], WHIP.prototype, "allowOrigin", void 0);
|
|
433
|
+
__decorate([
|
|
434
|
+
(0, di_1.Configurable)(core_1.DTO.Array().items(core_1.DTO.Number().port()).length(2).optional()),
|
|
435
|
+
__metadata("design:type", Array)
|
|
436
|
+
], WHIP.prototype, "icePortRange", void 0);
|
|
437
|
+
__decorate([
|
|
438
|
+
(0, di_1.Configurable)(core_1.DTO.Array().items(core_1.DTO.String()).optional()),
|
|
439
|
+
__metadata("design:type", Array)
|
|
440
|
+
], WHIP.prototype, "iceAdditionalHostAddresses", void 0);
|
|
441
|
+
__decorate([
|
|
442
|
+
(0, di_1.Configurable)(core_1.DTO.Array().items(core_1.DTO.String()).optional()),
|
|
443
|
+
__metadata("design:type", Array)
|
|
444
|
+
], WHIP.prototype, "codecs", void 0);
|
|
445
|
+
exports.WHIP = WHIP = __decorate([
|
|
446
|
+
(0, di_1.Singleton)()
|
|
447
|
+
], WHIP);
|
|
448
|
+
/**
|
|
449
|
+
* Build the options of a {@link WHIP} component, for the `components` of an application (named `whip`, the name
|
|
450
|
+
* `WHIPController` uses).
|
|
451
|
+
* @param options Who may publish, the ICE servers given to the publishers, the limit of sessions, the candidates and
|
|
452
|
+
* the codecs of the connections (all optional).
|
|
453
|
+
* @returns The component options.
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* import {Application} from 'lakutata'
|
|
457
|
+
* import {buildWHIPOptions} from '@lakutata/webrtc'
|
|
458
|
+
*
|
|
459
|
+
* Application.run(() => ({
|
|
460
|
+
* id: 'ingest.app',
|
|
461
|
+
* name: 'Ingest',
|
|
462
|
+
* components: {
|
|
463
|
+
* whip: buildWHIPOptions({maxSessions: 10, codecs: ['audio/opus', 'video/H264']})
|
|
464
|
+
* }
|
|
465
|
+
* }))
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
function buildWHIPOptions(options = {}) {
|
|
469
|
+
return { class: WHIP, ...options };
|
|
470
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import { Controller, type HTTPContext } from '@lakutata/entrypoint';
|
|
3
|
+
import type { WHIP } from './WHIP.js';
|
|
4
|
+
/**
|
|
5
|
+
* The input of the requests to the endpoint of a stream
|
|
6
|
+
*/
|
|
7
|
+
declare class StreamDTO extends DTO {
|
|
8
|
+
stream: string;
|
|
9
|
+
body?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The input of a PATCH of a session
|
|
13
|
+
*/
|
|
14
|
+
declare class PatchDTO extends DTO {
|
|
15
|
+
stream: string;
|
|
16
|
+
session: string;
|
|
17
|
+
body?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The input of the requests to a session
|
|
21
|
+
*/
|
|
22
|
+
declare class SessionDTO extends DTO {
|
|
23
|
+
stream: string;
|
|
24
|
+
session: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The HTTP interface of WHIP (RFC 9725) for the {@link WHIP} component registered as `whip`: an encoder or a browser
|
|
28
|
+
* publishes a stream with `POST /whip/:stream` (its SDP offer as `application/sdp`, its bearer token in the
|
|
29
|
+
* `Authorization` header), gets the answer with the URL of its session (`201 Created`, `Location`), and ends it with
|
|
30
|
+
* `DELETE` on that URL. It answers the CORS preflights (`OPTIONS`) of the browsers, `GET` with no content, and `PATCH`
|
|
31
|
+
* of a session (`application/trickle-ice-sdpfrag`): the candidates of the publisher (trickle ICE), or an ICE restart,
|
|
32
|
+
* whose answer has a new `ETag`. The URL of a session is the capability to end it: its id is random, and the DELETE and
|
|
33
|
+
* the PATCH are not authorized again.
|
|
34
|
+
*
|
|
35
|
+
* Add it to the controllers of an entrypoint whose HTTP adapter reads the bodies of WHIP as text (its option
|
|
36
|
+
* `body: {text: ['application/sdp', 'application/trickle-ice-sdpfrag']}`, without which Fastify refuses the PATCH
|
|
37
|
+
* requests with 415). Its routes are under `/whip`; a subclass with `@Prefix({route: …})` gives them another prefix.
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import {Application} from 'lakutata'
|
|
41
|
+
* import {buildEntrypoints} from 'lakutata/com/entrypoint'
|
|
42
|
+
* import {Prefix} from 'lakutata/decorator/ctrl'
|
|
43
|
+
* import {fastifyHTTPEntrypoint} from 'lakutata/adapter/fastify'
|
|
44
|
+
* import {buildWHIPOptions, WHIPController} from '@lakutata/webrtc'
|
|
45
|
+
*
|
|
46
|
+
* //The endpoints under /live: POST /live/:stream
|
|
47
|
+
* @Prefix({route: '/live'})
|
|
48
|
+
* class LiveController extends WHIPController {
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* Application.run(() => ({
|
|
52
|
+
* id: 'ingest.app',
|
|
53
|
+
* name: 'Ingest',
|
|
54
|
+
* components: {
|
|
55
|
+
* whip: buildWHIPOptions(),
|
|
56
|
+
* entrypoint: buildEntrypoints({
|
|
57
|
+
* controllers: [LiveController],
|
|
58
|
+
* http: fastifyHTTPEntrypoint({port: 8080, body: {text: ['application/sdp', 'application/trickle-ice-sdpfrag']}})
|
|
59
|
+
* })
|
|
60
|
+
* },
|
|
61
|
+
* bootstrap: ['entrypoint']
|
|
62
|
+
* }))
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare class WHIPController extends Controller {
|
|
66
|
+
/**
|
|
67
|
+
* The WHIP component: the one registered as `whip`.
|
|
68
|
+
* @protected
|
|
69
|
+
*/
|
|
70
|
+
protected whip(): Promise<WHIP>;
|
|
71
|
+
/**
|
|
72
|
+
* The HTTP context of the request
|
|
73
|
+
* @protected
|
|
74
|
+
*/
|
|
75
|
+
protected http(): HTTPContext;
|
|
76
|
+
/**
|
|
77
|
+
* Set the CORS headers of the response
|
|
78
|
+
* @protected
|
|
79
|
+
*/
|
|
80
|
+
protected allowOrigin(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Answer the CORS preflight of the endpoint of a stream.
|
|
83
|
+
* @returns Resolves once answered.
|
|
84
|
+
*/
|
|
85
|
+
preflight(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Answer the CORS preflight of a session.
|
|
88
|
+
* @returns Resolves once answered.
|
|
89
|
+
*/
|
|
90
|
+
sessionPreflight(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Answer a GET of the endpoint of a stream with no content (RFC 9725, section 4.1).
|
|
93
|
+
* @returns Resolves once answered.
|
|
94
|
+
*/
|
|
95
|
+
probe(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Answer a GET of a session with no content (RFC 9725, section 4.1).
|
|
98
|
+
* @returns Resolves once answered.
|
|
99
|
+
*/
|
|
100
|
+
sessionProbe(): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Publish a stream: answer the offer with `201 Created`, the answer, the URL of the session (`Location`) and the ICE
|
|
103
|
+
* servers (`Link`).
|
|
104
|
+
* @param input The stream, and the offer (the body).
|
|
105
|
+
* @returns Resolves once answered.
|
|
106
|
+
* @throws {WHIPMediaTypeException} When the body is not `application/sdp`.
|
|
107
|
+
* @throws {WHIPDeniedException} When `authorize` refuses the stream (with `WWW-Authenticate: Bearer`).
|
|
108
|
+
* @throws {WHIPLimitException} When the component has `maxSessions` sessions already.
|
|
109
|
+
* @throws {WHIPOfferException} When the offer cannot be answered.
|
|
110
|
+
*/
|
|
111
|
+
publish(input: StreamDTO): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* End a session.
|
|
114
|
+
* @param input The stream and the session.
|
|
115
|
+
* @returns Resolves once answered.
|
|
116
|
+
* @throws {WHIPSessionNotFoundException} When the stream has no such session.
|
|
117
|
+
*/
|
|
118
|
+
unpublish(input: SessionDTO): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Apply the candidates of the publisher (trickle ICE: `204 No Content`), or restart ICE when its credentials
|
|
121
|
+
* changed (`200 OK`, the fragment of the answer, and a new `ETag`), as RFC 9725 (section 4.3) does: an ICE restart
|
|
122
|
+
* needs `If-Match: *`. An `If-Match` other than `*` and the `ETag` of the session, and new credentials without
|
|
123
|
+
* `If-Match: *`, are answered with `412 Precondition Failed`.
|
|
124
|
+
* @param input The stream, the session, and the fragment of SDP (the body).
|
|
125
|
+
* @returns Resolves once answered.
|
|
126
|
+
* @throws {WHIPMediaTypeException} When the body is not `application/trickle-ice-sdpfrag`.
|
|
127
|
+
* @throws {WHIPSessionNotFoundException} When the stream has no such session on any node.
|
|
128
|
+
* @throws {WHIPOfferException} When the fragment has no ICE, or the connection refuses it.
|
|
129
|
+
*/
|
|
130
|
+
patch(input: PatchDTO): Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
export {};
|