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.
- package/lib/common/src/binary.d.ts +0 -1
- package/lib/common/src/binary.js +14 -14
- package/lib/common/src/binary.js.map +1 -1
- package/lib/common/src/network.d.ts +1 -2
- package/lib/common/src/network.js +4 -4
- package/lib/common/src/network.js.map +1 -1
- package/lib/common/src/number.js +10 -10
- package/lib/common/src/number.js.map +1 -1
- package/lib/dtls/src/cipher/create.d.ts +1 -1
- package/lib/dtls/src/cipher/create.js +2 -3
- package/lib/dtls/src/cipher/create.js.map +1 -1
- package/lib/dtls/src/cipher/ec.d.ts +0 -1
- package/lib/dtls/src/cipher/key-exchange.js +7 -7
- package/lib/dtls/src/cipher/key-exchange.js.map +1 -1
- package/lib/dtls/src/cipher/namedCurve.d.ts +1 -2
- package/lib/dtls/src/cipher/namedCurve.js +1 -2
- package/lib/dtls/src/cipher/namedCurve.js.map +1 -1
- package/lib/dtls/src/cipher/prf.d.ts +1 -2
- package/lib/dtls/src/cipher/prf.js +11 -12
- package/lib/dtls/src/cipher/prf.js.map +1 -1
- package/lib/dtls/src/cipher/suites/abstract.d.ts +1 -2
- package/lib/dtls/src/cipher/suites/abstract.js.map +1 -1
- package/lib/dtls/src/cipher/suites/aead.d.ts +1 -2
- package/lib/dtls/src/cipher/suites/aead.js.map +1 -1
- package/lib/dtls/src/client.d.ts +1 -1
- package/lib/dtls/src/client.js.map +1 -1
- package/lib/dtls/src/context/cipher.d.ts +6 -7
- package/lib/dtls/src/context/cipher.js +5 -3
- package/lib/dtls/src/context/cipher.js.map +1 -1
- package/lib/dtls/src/context/dtls.d.ts +5 -6
- package/lib/dtls/src/context/dtls.js +1 -2
- package/lib/dtls/src/context/dtls.js.map +1 -1
- package/lib/dtls/src/context/transport.d.ts +1 -2
- package/lib/dtls/src/context/transport.js.map +1 -1
- package/lib/dtls/src/flight/client/flight1.d.ts +4 -4
- package/lib/dtls/src/flight/client/flight1.js.map +1 -1
- package/lib/dtls/src/flight/client/flight3.d.ts +3 -3
- package/lib/dtls/src/flight/client/flight3.js +6 -0
- package/lib/dtls/src/flight/client/flight3.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.d.ts +4 -4
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/flight/flight.d.ts +3 -4
- package/lib/dtls/src/flight/flight.js.map +1 -1
- package/lib/dtls/src/flight/server/flight2.d.ts +4 -4
- package/lib/dtls/src/flight/server/flight2.js +9 -2
- package/lib/dtls/src/flight/server/flight2.js.map +1 -1
- package/lib/dtls/src/flight/server/flight4.d.ts +5 -5
- package/lib/dtls/src/flight/server/flight4.js.map +1 -1
- package/lib/dtls/src/flight/server/flight6.d.ts +4 -4
- package/lib/dtls/src/flight/server/flight6.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/ellipticCurves.d.ts +1 -2
- package/lib/dtls/src/handshake/extensions/ellipticCurves.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/renegotiationIndication.d.ts +0 -1
- package/lib/dtls/src/handshake/extensions/signature.d.ts +1 -2
- package/lib/dtls/src/handshake/extensions/signature.js.map +1 -1
- package/lib/dtls/src/handshake/extensions/useSrtp.d.ts +1 -2
- package/lib/dtls/src/handshake/extensions/useSrtp.js.map +1 -1
- package/lib/dtls/src/handshake/message/alert.d.ts +0 -1
- package/lib/dtls/src/handshake/message/alert.js.map +1 -1
- package/lib/dtls/src/handshake/message/certificate.d.ts +1 -2
- package/lib/dtls/src/handshake/message/certificate.js.map +1 -1
- package/lib/dtls/src/handshake/message/changeCipherSpec.d.ts +0 -1
- package/lib/dtls/src/handshake/message/client/certificateVerify.d.ts +2 -3
- package/lib/dtls/src/handshake/message/client/certificateVerify.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/hello.d.ts +1 -2
- package/lib/dtls/src/handshake/message/client/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/client/keyExchange.d.ts +1 -2
- package/lib/dtls/src/handshake/message/client/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/message/finished.d.ts +1 -2
- package/lib/dtls/src/handshake/message/finished.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/certificateRequest.d.ts +2 -3
- package/lib/dtls/src/handshake/message/server/certificateRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/hello.d.ts +2 -3
- package/lib/dtls/src/handshake/message/server/hello.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloDone.d.ts +1 -2
- package/lib/dtls/src/handshake/message/server/helloDone.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.d.ts +1 -2
- package/lib/dtls/src/handshake/message/server/helloVerifyRequest.js.map +1 -1
- package/lib/dtls/src/handshake/message/server/keyExchange.d.ts +2 -3
- package/lib/dtls/src/handshake/message/server/keyExchange.js.map +1 -1
- package/lib/dtls/src/handshake/random.d.ts +0 -1
- package/lib/dtls/src/helper.d.ts +0 -1
- package/lib/dtls/src/helper.js +3 -3
- package/lib/dtls/src/helper.js.map +1 -1
- package/lib/dtls/src/record/builder.d.ts +2 -3
- package/lib/dtls/src/record/builder.js +2 -4
- package/lib/dtls/src/record/builder.js.map +1 -1
- package/lib/dtls/src/record/message/fragment.d.ts +1 -2
- package/lib/dtls/src/record/message/fragment.js.map +1 -1
- package/lib/dtls/src/record/message/header.d.ts +0 -1
- package/lib/dtls/src/record/message/plaintext.d.ts +0 -1
- package/lib/dtls/src/record/receive.d.ts +2 -3
- package/lib/dtls/src/record/receive.js.map +1 -1
- package/lib/dtls/src/server.d.ts +1 -1
- package/lib/dtls/src/server.js.map +1 -1
- package/lib/dtls/src/socket.d.ts +5 -6
- package/lib/dtls/src/socket.js +17 -23
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/dtls/src/transport.d.ts +1 -3
- package/lib/dtls/src/transport.js.map +1 -1
- package/lib/dtls/src/typings/domain.d.ts +2 -3
- package/lib/dtls/src/typings/domain.js.map +1 -1
- package/lib/dtls/src/util/binary.d.ts +0 -1
- package/lib/dtls/src/util/binary.js +1 -2
- package/lib/dtls/src/util/binary.js.map +1 -1
- package/lib/ice/src/candidate.js +3 -3
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/dns/lookup.d.ts +1 -1
- package/lib/ice/src/dns/lookup.js +1 -0
- package/lib/ice/src/dns/lookup.js.map +1 -1
- package/lib/ice/src/exceptions.js.map +1 -1
- package/lib/ice/src/helper.d.ts +0 -1
- package/lib/ice/src/helper.js +5 -5
- package/lib/ice/src/helper.js.map +1 -1
- package/lib/ice/src/ice.d.ts +3 -2
- package/lib/ice/src/ice.js +25 -16
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/stun/attributes.d.ts +0 -1
- package/lib/ice/src/stun/attributes.js +5 -5
- package/lib/ice/src/stun/attributes.js.map +1 -1
- package/lib/ice/src/stun/message.d.ts +0 -1
- package/lib/ice/src/stun/message.js +2 -2
- package/lib/ice/src/stun/message.js.map +1 -1
- package/lib/ice/src/stun/protocol.d.ts +0 -1
- package/lib/ice/src/stun/transaction.d.ts +1 -1
- package/lib/ice/src/transport.d.ts +1 -4
- package/lib/ice/src/turn/protocol.d.ts +1 -2
- package/lib/ice/src/turn/protocol.js +5 -4
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +0 -1
- package/lib/ice/src/utils.js +3 -4
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/rtp/src/codec/av1.d.ts +1 -2
- package/lib/rtp/src/codec/av1.js +2 -2
- package/lib/rtp/src/codec/av1.js.map +1 -1
- package/lib/rtp/src/codec/base.d.ts +1 -2
- package/lib/rtp/src/codec/base.js.map +1 -1
- package/lib/rtp/src/codec/h264.d.ts +2 -3
- package/lib/rtp/src/codec/h264.js.map +1 -1
- package/lib/rtp/src/codec/index.d.ts +1 -2
- package/lib/rtp/src/codec/index.js +2 -2
- package/lib/rtp/src/codec/index.js.map +1 -1
- package/lib/rtp/src/codec/opus.d.ts +2 -3
- package/lib/rtp/src/codec/opus.js.map +1 -1
- package/lib/rtp/src/codec/vp8.d.ts +2 -3
- package/lib/rtp/src/codec/vp8.js +1 -1
- package/lib/rtp/src/codec/vp8.js.map +1 -1
- package/lib/rtp/src/codec/vp9.d.ts +2 -3
- package/lib/rtp/src/codec/vp9.js +1 -1
- package/lib/rtp/src/codec/vp9.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/h264.d.ts +0 -1
- package/lib/rtp/src/extra/container/mp4/h264.js +2 -2
- package/lib/rtp/src/extra/container/mp4/h264.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/mp4box.d.ts +1 -1
- package/lib/rtp/src/extra/container/mp4/mp4box.js +3 -3
- package/lib/rtp/src/extra/container/mp4/mp4box.js.map +1 -1
- package/lib/rtp/src/extra/container/ogg/parser.d.ts +0 -1
- package/lib/rtp/src/extra/container/webm/container.d.ts +0 -1
- package/lib/rtp/src/extra/container/webm/container.js +2 -3
- package/lib/rtp/src/extra/container/webm/container.js.map +1 -1
- package/lib/rtp/src/extra/container/webm/ebml/typedArrayUtils.js +2 -2
- package/lib/rtp/src/extra/container/webm/ebml/typedArrayUtils.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +2 -3
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizerCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/depacketizerCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizerTransformer.d.ts +2 -3
- package/lib/rtp/src/extra/processor/depacketizerTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtx.d.ts +2 -3
- package/lib/rtp/src/extra/processor/dtx.js.map +1 -1
- package/lib/rtp/src/extra/processor/dtxCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/interface.d.ts +2 -2
- package/lib/rtp/src/extra/processor/jitterBuffer.d.ts +2 -2
- package/lib/rtp/src/extra/processor/jitterBuffer.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.d.ts +1 -2
- package/lib/rtp/src/extra/processor/jitterBufferTransformer.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsync.d.ts +3 -4
- package/lib/rtp/src/extra/processor/lipsync.js +2 -2
- package/lib/rtp/src/extra/processor/lipsync.js.map +1 -1
- package/lib/rtp/src/extra/processor/lipsyncCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/lipsyncCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +2 -3
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4Callback.d.ts +2 -2
- package/lib/rtp/src/extra/processor/mp4Callback.js.map +1 -1
- package/lib/rtp/src/extra/processor/mute.d.ts +2 -3
- package/lib/rtp/src/extra/processor/mute.js.map +1 -1
- package/lib/rtp/src/extra/processor/muteCallback.d.ts +2 -2
- package/lib/rtp/src/extra/processor/muteCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +2 -2
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/nackHandlerCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTime.d.ts +2 -2
- package/lib/rtp/src/extra/processor/ntpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/ntpTimeCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/ntpTimeCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +2 -2
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -2
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpStream.d.ts +2 -4
- package/lib/rtp/src/extra/processor/rtpStream.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTime.d.ts +2 -2
- package/lib/rtp/src/extra/processor/rtpTime.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpTimeCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtpTimeCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webm.d.ts +2 -3
- package/lib/rtp/src/extra/processor/webm.js +2 -2
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmCallback.d.ts +2 -2
- package/lib/rtp/src/extra/processor/webmCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webmStream.d.ts +2 -3
- package/lib/rtp/src/extra/processor/webmStream.js.map +1 -1
- package/lib/rtp/src/helper.d.ts +0 -1
- package/lib/rtp/src/helper.js +6 -6
- package/lib/rtp/src/helper.js.map +1 -1
- package/lib/rtp/src/index.d.ts +0 -1
- package/lib/rtp/src/rtcp/header.d.ts +0 -1
- package/lib/rtp/src/rtcp/psfb/fullIntraRequest.d.ts +0 -1
- package/lib/rtp/src/rtcp/psfb/index.d.ts +1 -2
- package/lib/rtp/src/rtcp/psfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/psfb/pictureLossIndication.d.ts +0 -1
- package/lib/rtp/src/rtcp/psfb/remb.d.ts +0 -1
- package/lib/rtp/src/rtcp/rr.d.ts +0 -1
- package/lib/rtp/src/rtcp/rtcp.d.ts +0 -1
- package/lib/rtp/src/rtcp/rtcp.js +2 -2
- package/lib/rtp/src/rtcp/rtcp.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/index.d.ts +1 -2
- package/lib/rtp/src/rtcp/rtpfb/index.js.map +1 -1
- package/lib/rtp/src/rtcp/rtpfb/nack.d.ts +0 -1
- package/lib/rtp/src/rtcp/rtpfb/twcc.d.ts +0 -1
- package/lib/rtp/src/rtcp/rtpfb/twcc.js +1 -2
- package/lib/rtp/src/rtcp/rtpfb/twcc.js.map +1 -1
- package/lib/rtp/src/rtcp/sdes.d.ts +1 -2
- package/lib/rtp/src/rtcp/sdes.js.map +1 -1
- package/lib/rtp/src/rtcp/sr.d.ts +0 -1
- package/lib/rtp/src/rtp/headerExtension.d.ts +1 -2
- package/lib/rtp/src/rtp/headerExtension.js +12 -12
- package/lib/rtp/src/rtp/headerExtension.js.map +1 -1
- package/lib/rtp/src/rtp/red/encoder.d.ts +0 -1
- package/lib/rtp/src/rtp/red/handler.d.ts +1 -1
- package/lib/rtp/src/rtp/red/handler.js.map +1 -1
- package/lib/rtp/src/rtp/red/packet.d.ts +0 -1
- package/lib/rtp/src/rtp/rtp.d.ts +0 -1
- package/lib/rtp/src/rtp/rtp.js.map +1 -1
- package/lib/rtp/src/rtp/rtx.js +2 -3
- package/lib/rtp/src/rtp/rtx.js.map +1 -1
- package/lib/rtp/src/srtp/cipher/ctr.d.ts +0 -1
- package/lib/rtp/src/srtp/cipher/gcm.d.ts +0 -1
- package/lib/rtp/src/srtp/cipher/index.d.ts +2 -3
- package/lib/rtp/src/srtp/cipher/index.js.map +1 -1
- package/lib/rtp/src/srtp/context/context.d.ts +3 -5
- package/lib/rtp/src/srtp/context/context.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtcp.d.ts +2 -3
- package/lib/rtp/src/srtp/context/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/context/srtp.d.ts +1 -2
- package/lib/rtp/src/srtp/context/srtp.js.map +1 -1
- package/lib/rtp/src/srtp/session.d.ts +1 -2
- package/lib/rtp/src/srtp/session.js.map +1 -1
- package/lib/rtp/src/srtp/srtcp.d.ts +1 -2
- package/lib/rtp/src/srtp/srtcp.js.map +1 -1
- package/lib/rtp/src/srtp/srtp.d.ts +2 -3
- package/lib/rtp/src/srtp/srtp.js.map +1 -1
- package/lib/rtp/src/util.d.ts +0 -1
- package/lib/sctp/src/chunk.d.ts +0 -1
- package/lib/sctp/src/chunk.js +4 -4
- package/lib/sctp/src/chunk.js.map +1 -1
- package/lib/sctp/src/helper.js +2 -3
- package/lib/sctp/src/helper.js.map +1 -1
- package/lib/sctp/src/param.d.ts +0 -1
- package/lib/sctp/src/param.js.map +1 -1
- package/lib/sctp/src/sctp.d.ts +5 -6
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/sctp/src/transport.d.ts +1 -3
- package/lib/sctp/src/transport.js.map +1 -1
- package/lib/webrtc/src/const.d.ts +1 -1
- package/lib/webrtc/src/const.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +2 -3
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/helper.d.ts +0 -1
- package/lib/webrtc/src/helper.js +3 -3
- package/lib/webrtc/src/helper.js.map +1 -1
- package/lib/webrtc/src/media/extension/rtcpFeedback.d.ts +1 -1
- package/lib/webrtc/src/media/extension/rtcpFeedback.js.map +1 -1
- package/lib/webrtc/src/media/extension/rtpExtension.js +7 -8
- package/lib/webrtc/src/media/extension/rtpExtension.js.map +1 -1
- package/lib/webrtc/src/media/parameters.d.ts +1 -1
- package/lib/webrtc/src/media/parameters.js.map +1 -1
- package/lib/webrtc/src/media/receiver/nack.d.ts +2 -2
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.d.ts +1 -1
- package/lib/webrtc/src/media/receiver/receiverTwcc.js.map +1 -1
- package/lib/webrtc/src/media/receiver/statistics.d.ts +1 -1
- package/lib/webrtc/src/media/receiver/statistics.js.map +1 -1
- package/lib/webrtc/src/media/router.d.ts +4 -4
- package/lib/webrtc/src/media/router.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +7 -7
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +5 -6
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +6 -6
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +6 -5
- package/lib/webrtc/src/media/track.js +14 -1
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/nonstandard/index.d.ts +2 -0
- package/lib/webrtc/src/nonstandard/index.js +2 -0
- package/lib/webrtc/src/nonstandard/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/navigator.d.ts +73 -0
- package/lib/webrtc/src/nonstandard/navigator.js +88 -0
- package/lib/webrtc/src/nonstandard/navigator.js.map +1 -0
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +23 -7
- package/lib/webrtc/src/nonstandard/recorder/index.js +30 -27
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +17 -5
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js +3 -9
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +23 -12
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/nonstandard/userMedia.d.ts +4 -5
- package/lib/webrtc/src/nonstandard/userMedia.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +10 -10
- package/lib/webrtc/src/peerConnection.js +15 -21
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/sdp.d.ts +4 -4
- package/lib/webrtc/src/sdp.js +21 -21
- package/lib/webrtc/src/sdp.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +8 -8
- package/lib/webrtc/src/transport/dtls.js +16 -3
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +1 -1
- package/lib/webrtc/src/transport/ice.js +3 -3
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +1 -2
- package/lib/webrtc/src/transport/sctp.js +1 -1
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/lib/webrtc/src/utils.d.ts +5 -5
- package/lib/webrtc/src/utils.js +16 -10
- package/lib/webrtc/src/utils.js.map +1 -1
- package/package.json +12 -8
- package/src/const.ts +1 -1
- package/src/dataChannel.ts +2 -2
- package/src/media/extension/rtcpFeedback.ts +1 -1
- package/src/media/parameters.ts +1 -1
- package/src/media/receiver/nack.ts +9 -6
- package/src/media/receiver/receiverTwcc.ts +3 -3
- package/src/media/receiver/statistics.ts +1 -1
- package/src/media/router.ts +45 -39
- package/src/media/rtpReceiver.ts +30 -19
- package/src/media/rtpSender.ts +84 -71
- package/src/media/rtpTransceiver.ts +6 -6
- package/src/media/sender/senderBWE.ts +1 -1
- package/src/media/track.ts +19 -5
- package/src/nonstandard/index.ts +2 -0
- package/src/nonstandard/navigator.ts +118 -0
- package/src/nonstandard/recorder/index.ts +47 -19
- package/src/nonstandard/recorder/writer/index.ts +7 -4
- package/src/nonstandard/recorder/writer/webm.ts +25 -14
- package/src/nonstandard/userMedia.ts +1 -1
- package/src/peerConnection.ts +43 -51
- package/src/sdp.ts +108 -94
- package/src/transport/dtls.ts +28 -14
- package/src/transport/ice.ts +1 -1
- package/src/transport/sctp.ts +75 -67
- package/src/utils.ts +13 -6
package/src/media/rtpReceiver.ts
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
}
|
package/src/media/rtpSender.ts
CHANGED
|
@@ -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
|
-
|
|
415
|
-
|
|
416
|
-
.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (this.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.rtt
|
|
426
|
-
|
|
427
|
-
|
|
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
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
this.
|
|
457
|
-
)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
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
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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";
|
package/src/media/track.ts
CHANGED
|
@@ -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>
|
|
74
|
-
|
|
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
|
}
|
package/src/nonstandard/index.ts
CHANGED
|
@@ -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 {
|
|
4
|
-
import {
|
|
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
|
|
10
|
+
ext?: string;
|
|
10
11
|
tracks: MediaStreamTrack[] = [];
|
|
11
12
|
started = false;
|
|
12
13
|
onError = new Event<[Error]>();
|
|
13
14
|
|
|
14
15
|
constructor(
|
|
15
|
-
public
|
|
16
|
-
|
|
17
|
-
|
|
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.
|
|
20
|
-
this.
|
|
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 (
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
7
|
-
|
|
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[]) {}
|