@sbhjt-gr/react-native-webrtc 124.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +11 -0
- package/.claude/settings.local.json +9 -0
- package/.eslintignore +6 -0
- package/.nvmrc +1 -0
- package/ISSUE_TEMPLATE.md +40 -0
- package/LICENSE +22 -0
- package/README.md +103 -0
- package/android/build.gradle +37 -0
- package/android/consumer-rules.pro +3 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/oney/WebRTCModule/AbstractVideoCaptureController.java +113 -0
- package/android/src/main/java/com/oney/WebRTCModule/CameraCaptureController.java +338 -0
- package/android/src/main/java/com/oney/WebRTCModule/CameraEventsHandler.java +49 -0
- package/android/src/main/java/com/oney/WebRTCModule/DataChannelWrapper.java +99 -0
- package/android/src/main/java/com/oney/WebRTCModule/DataPacketCryptorManager.java +63 -0
- package/android/src/main/java/com/oney/WebRTCModule/DisplayUtils.java +16 -0
- package/android/src/main/java/com/oney/WebRTCModule/EglUtils.java +66 -0
- package/android/src/main/java/com/oney/WebRTCModule/GetUserMediaImpl.java +539 -0
- package/android/src/main/java/com/oney/WebRTCModule/LibraryLoader.java +21 -0
- package/android/src/main/java/com/oney/WebRTCModule/MediaProjectionNotification.java +70 -0
- package/android/src/main/java/com/oney/WebRTCModule/MediaProjectionService.java +82 -0
- package/android/src/main/java/com/oney/WebRTCModule/PeerConnectionObserver.java +588 -0
- package/android/src/main/java/com/oney/WebRTCModule/RTCCryptoManager.java +493 -0
- package/android/src/main/java/com/oney/WebRTCModule/RTCVideoViewManager.java +98 -0
- package/android/src/main/java/com/oney/WebRTCModule/ReactBridgeUtil.java +36 -0
- package/android/src/main/java/com/oney/WebRTCModule/ScreenCaptureController.java +94 -0
- package/android/src/main/java/com/oney/WebRTCModule/SerializeUtils.java +342 -0
- package/android/src/main/java/com/oney/WebRTCModule/StringUtils.java +101 -0
- package/android/src/main/java/com/oney/WebRTCModule/ThreadUtils.java +41 -0
- package/android/src/main/java/com/oney/WebRTCModule/TrackCapturerEventsEmitter.java +34 -0
- package/android/src/main/java/com/oney/WebRTCModule/VideoTrackAdapter.java +137 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModule.java +1643 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModuleOptions.java +33 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCModulePackage.java +21 -0
- package/android/src/main/java/com/oney/WebRTCModule/WebRTCView.java +583 -0
- package/android/src/main/java/com/oney/WebRTCModule/palabra/PalabraClient.java +464 -0
- package/android/src/main/java/com/oney/WebRTCModule/palabra/PalabraConfig.java +17 -0
- package/android/src/main/java/com/oney/WebRTCModule/palabra/PalabraListener.java +7 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/ProcessorProvider.java +38 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoEffectProcessor.java +59 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessor.java +19 -0
- package/android/src/main/java/com/oney/WebRTCModule/videoEffects/VideoFrameProcessorFactoryInterface.java +12 -0
- package/android/src/main/java/com/oney/WebRTCModule/webrtcutils/H264AndSoftwareVideoDecoderFactory.java +73 -0
- package/android/src/main/java/com/oney/WebRTCModule/webrtcutils/H264AndSoftwareVideoEncoderFactory.java +73 -0
- package/android/src/main/java/com/oney/WebRTCModule/webrtcutils/SoftwareVideoDecoderFactoryProxy.java +36 -0
- package/android/src/main/java/com/oney/WebRTCModule/webrtcutils/SoftwareVideoEncoderFactoryProxy.java +36 -0
- package/android/src/main/java/org/webrtc/Camera1Helper.java +54 -0
- package/android/src/main/java/org/webrtc/Camera2Helper.java +52 -0
- package/android/src/main/res/values/strings.xml +5 -0
- package/android/src/main/res/values/styles.xml +8 -0
- package/apple/.placeholder +0 -0
- package/ios/RCTWebRTC/CaptureController.h +18 -0
- package/ios/RCTWebRTC/CaptureController.m +29 -0
- package/ios/RCTWebRTC/CapturerEventsDelegate.h +12 -0
- package/ios/RCTWebRTC/DataChannelWrapper.h +27 -0
- package/ios/RCTWebRTC/DataChannelWrapper.m +42 -0
- package/ios/RCTWebRTC/I420Converter.h +22 -0
- package/ios/RCTWebRTC/I420Converter.m +164 -0
- package/ios/RCTWebRTC/PIPController.h +24 -0
- package/ios/RCTWebRTC/PIPController.m +234 -0
- package/ios/RCTWebRTC/PalabraAudioSink.h +13 -0
- package/ios/RCTWebRTC/PalabraAudioSink.m +18 -0
- package/ios/RCTWebRTC/PalabraClient.h +36 -0
- package/ios/RCTWebRTC/PalabraClient.m +584 -0
- package/ios/RCTWebRTC/RCTConvert+WebRTC.h +16 -0
- package/ios/RCTWebRTC/RCTConvert+WebRTC.m +206 -0
- package/ios/RCTWebRTC/RTCMediaStreamTrack+React.h +10 -0
- package/ios/RCTWebRTC/RTCMediaStreamTrack+React.m +16 -0
- package/ios/RCTWebRTC/RTCVideoViewManager.h +29 -0
- package/ios/RCTWebRTC/RTCVideoViewManager.m +411 -0
- package/ios/RCTWebRTC/SampleBufferVideoCallView.h +12 -0
- package/ios/RCTWebRTC/SampleBufferVideoCallView.m +178 -0
- package/ios/RCTWebRTC/ScreenCaptureController.h +20 -0
- package/ios/RCTWebRTC/ScreenCaptureController.m +83 -0
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.h +7 -0
- package/ios/RCTWebRTC/ScreenCapturePickerViewManager.m +60 -0
- package/ios/RCTWebRTC/ScreenCapturer.h +19 -0
- package/ios/RCTWebRTC/ScreenCapturer.m +264 -0
- package/ios/RCTWebRTC/SerializeUtils.h +28 -0
- package/ios/RCTWebRTC/SerializeUtils.m +314 -0
- package/ios/RCTWebRTC/SocketConnection.h +13 -0
- package/ios/RCTWebRTC/SocketConnection.m +137 -0
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.h +14 -0
- package/ios/RCTWebRTC/TrackCapturerEventsEmitter.m +37 -0
- package/ios/RCTWebRTC/VideoCaptureController.h +21 -0
- package/ios/RCTWebRTC/VideoCaptureController.m +328 -0
- package/ios/RCTWebRTC/WebRTCModule+Palabra.h +4 -0
- package/ios/RCTWebRTC/WebRTCModule+Palabra.m +83 -0
- package/ios/RCTWebRTC/WebRTCModule+Permissions.m +75 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCAudioSession.m +20 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.h +14 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCDataChannel.m +165 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCFrameCryptor.m +611 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.h +14 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCMediaStream.m +533 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.h +24 -0
- package/ios/RCTWebRTC/WebRTCModule+RTCPeerConnection.m +1004 -0
- package/ios/RCTWebRTC/WebRTCModule+Transceivers.m +267 -0
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.h +12 -0
- package/ios/RCTWebRTC/WebRTCModule+VideoTrackAdapter.m +166 -0
- package/ios/RCTWebRTC/WebRTCModule.h +51 -0
- package/ios/RCTWebRTC/WebRTCModule.m +151 -0
- package/ios/RCTWebRTC/WebRTCModuleOptions.h +24 -0
- package/ios/RCTWebRTC/WebRTCModuleOptions.m +31 -0
- package/ios/RCTWebRTC/videoEffects/ProcessorProvider.h +9 -0
- package/ios/RCTWebRTC/videoEffects/ProcessorProvider.m +23 -0
- package/ios/RCTWebRTC/videoEffects/VideoEffectProcessor.h +13 -0
- package/ios/RCTWebRTC/videoEffects/VideoEffectProcessor.m +23 -0
- package/ios/RCTWebRTC/videoEffects/VideoFrameProcessor.h +8 -0
- package/ios/RCTWebRTC.xcodeproj/project.pbxproj +404 -0
- package/ios/RCTWebRTC.xcworkspace/contents.xcworkspacedata +10 -0
- package/lib/commonjs/Constraints.js +2 -0
- package/lib/commonjs/Constraints.js.map +1 -0
- package/lib/commonjs/EventEmitter.js +51 -0
- package/lib/commonjs/EventEmitter.js.map +1 -0
- package/lib/commonjs/Logger.js +47 -0
- package/lib/commonjs/Logger.js.map +1 -0
- package/lib/commonjs/MediaDevices.js +54 -0
- package/lib/commonjs/MediaDevices.js.map +1 -0
- package/lib/commonjs/MediaStream.js +137 -0
- package/lib/commonjs/MediaStream.js.map +1 -0
- package/lib/commonjs/MediaStreamError.js +19 -0
- package/lib/commonjs/MediaStreamError.js.map +1 -0
- package/lib/commonjs/MediaStreamErrorEvent.js +17 -0
- package/lib/commonjs/MediaStreamErrorEvent.js.map +1 -0
- package/lib/commonjs/MediaStreamTrack.js +203 -0
- package/lib/commonjs/MediaStreamTrack.js.map +1 -0
- package/lib/commonjs/MediaStreamTrackEvent.js +26 -0
- package/lib/commonjs/MediaStreamTrackEvent.js.map +1 -0
- package/lib/commonjs/MessageEvent.js +27 -0
- package/lib/commonjs/MessageEvent.js.map +1 -0
- package/lib/commonjs/Permissions.js +116 -0
- package/lib/commonjs/Permissions.js.map +1 -0
- package/lib/commonjs/RTCAudioSession.js +33 -0
- package/lib/commonjs/RTCAudioSession.js.map +1 -0
- package/lib/commonjs/RTCDataChannel.js +165 -0
- package/lib/commonjs/RTCDataChannel.js.map +1 -0
- package/lib/commonjs/RTCDataChannelEvent.js +26 -0
- package/lib/commonjs/RTCDataChannelEvent.js.map +1 -0
- package/lib/commonjs/RTCDataPacketCryptor.js +76 -0
- package/lib/commonjs/RTCDataPacketCryptor.js.map +1 -0
- package/lib/commonjs/RTCDataPacketCryptorFactory.js +27 -0
- package/lib/commonjs/RTCDataPacketCryptorFactory.js.map +1 -0
- package/lib/commonjs/RTCErrorEvent.js +23 -0
- package/lib/commonjs/RTCErrorEvent.js.map +1 -0
- package/lib/commonjs/RTCFrameCryptor.js +138 -0
- package/lib/commonjs/RTCFrameCryptor.js.map +1 -0
- package/lib/commonjs/RTCFrameCryptorFactory.js +81 -0
- package/lib/commonjs/RTCFrameCryptorFactory.js.map +1 -0
- package/lib/commonjs/RTCIceCandidate.js +34 -0
- package/lib/commonjs/RTCIceCandidate.js.map +1 -0
- package/lib/commonjs/RTCIceCandidateEvent.js +28 -0
- package/lib/commonjs/RTCIceCandidateEvent.js.map +1 -0
- package/lib/commonjs/RTCKeyProvider.js +111 -0
- package/lib/commonjs/RTCKeyProvider.js.map +1 -0
- package/lib/commonjs/RTCPIPView.js +38 -0
- package/lib/commonjs/RTCPIPView.js.map +1 -0
- package/lib/commonjs/RTCPIPView.web.js +23 -0
- package/lib/commonjs/RTCPIPView.web.js.map +1 -0
- package/lib/commonjs/RTCPeerConnection.js +694 -0
- package/lib/commonjs/RTCPeerConnection.js.map +1 -0
- package/lib/commonjs/RTCRtcpParameters.js +24 -0
- package/lib/commonjs/RTCRtcpParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpCapabilities.js +22 -0
- package/lib/commonjs/RTCRtpCapabilities.js.map +1 -0
- package/lib/commonjs/RTCRtpCodecCapability.js +19 -0
- package/lib/commonjs/RTCRtpCodecCapability.js.map +1 -0
- package/lib/commonjs/RTCRtpCodecParameters.js +38 -0
- package/lib/commonjs/RTCRtpCodecParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpEncodingParameters.js +78 -0
- package/lib/commonjs/RTCRtpEncodingParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpHeaderExtension.js +27 -0
- package/lib/commonjs/RTCRtpHeaderExtension.js.map +1 -0
- package/lib/commonjs/RTCRtpParameters.js +35 -0
- package/lib/commonjs/RTCRtpParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpReceiveParameters.js +15 -0
- package/lib/commonjs/RTCRtpReceiveParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpReceiver.js +53 -0
- package/lib/commonjs/RTCRtpReceiver.js.map +1 -0
- package/lib/commonjs/RTCRtpSendParameters.js +49 -0
- package/lib/commonjs/RTCRtpSendParameters.js.map +1 -0
- package/lib/commonjs/RTCRtpSender.js +67 -0
- package/lib/commonjs/RTCRtpSender.js.map +1 -0
- package/lib/commonjs/RTCRtpTransceiver.js +81 -0
- package/lib/commonjs/RTCRtpTransceiver.js.map +1 -0
- package/lib/commonjs/RTCSessionDescription.js +33 -0
- package/lib/commonjs/RTCSessionDescription.js.map +1 -0
- package/lib/commonjs/RTCTrackEvent.js +38 -0
- package/lib/commonjs/RTCTrackEvent.js.map +1 -0
- package/lib/commonjs/RTCUtil.js +186 -0
- package/lib/commonjs/RTCUtil.js.map +1 -0
- package/lib/commonjs/RTCView.js +16 -0
- package/lib/commonjs/RTCView.js.map +1 -0
- package/lib/commonjs/RTCView.web.js +62 -0
- package/lib/commonjs/RTCView.web.js.map +1 -0
- package/lib/commonjs/ScreenCapturePickerView.js +10 -0
- package/lib/commonjs/ScreenCapturePickerView.js.map +1 -0
- package/lib/commonjs/ScreenCapturePickerView.web.js +10 -0
- package/lib/commonjs/ScreenCapturePickerView.web.js.map +1 -0
- package/lib/commonjs/getDisplayMedia.js +33 -0
- package/lib/commonjs/getDisplayMedia.js.map +1 -0
- package/lib/commonjs/getUserMedia.js +101 -0
- package/lib/commonjs/getUserMedia.js.map +1 -0
- package/lib/commonjs/index.js +224 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +175 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/webStream.js +35 -0
- package/lib/commonjs/webStream.js.map +1 -0
- package/lib/module/Constraints.js +2 -0
- package/lib/module/Constraints.js.map +1 -0
- package/lib/module/EventEmitter.js +41 -0
- package/lib/module/EventEmitter.js.map +1 -0
- package/lib/module/Logger.js +39 -0
- package/lib/module/Logger.js.map +1 -0
- package/lib/module/MediaDevices.js +46 -0
- package/lib/module/MediaDevices.js.map +1 -0
- package/lib/module/MediaStream.js +129 -0
- package/lib/module/MediaStream.js.map +1 -0
- package/lib/module/MediaStreamError.js +12 -0
- package/lib/module/MediaStreamError.js.map +1 -0
- package/lib/module/MediaStreamErrorEvent.js +10 -0
- package/lib/module/MediaStreamErrorEvent.js.map +1 -0
- package/lib/module/MediaStreamTrack.js +195 -0
- package/lib/module/MediaStreamTrack.js.map +1 -0
- package/lib/module/MediaStreamTrackEvent.js +19 -0
- package/lib/module/MediaStreamTrackEvent.js.map +1 -0
- package/lib/module/MessageEvent.js +20 -0
- package/lib/module/MessageEvent.js.map +1 -0
- package/lib/module/Permissions.js +109 -0
- package/lib/module/Permissions.js.map +1 -0
- package/lib/module/RTCAudioSession.js +26 -0
- package/lib/module/RTCAudioSession.js.map +1 -0
- package/lib/module/RTCDataChannel.js +155 -0
- package/lib/module/RTCDataChannel.js.map +1 -0
- package/lib/module/RTCDataChannelEvent.js +19 -0
- package/lib/module/RTCDataChannelEvent.js.map +1 -0
- package/lib/module/RTCDataPacketCryptor.js +66 -0
- package/lib/module/RTCDataPacketCryptor.js.map +1 -0
- package/lib/module/RTCDataPacketCryptorFactory.js +19 -0
- package/lib/module/RTCDataPacketCryptorFactory.js.map +1 -0
- package/lib/module/RTCErrorEvent.js +16 -0
- package/lib/module/RTCErrorEvent.js.map +1 -0
- package/lib/module/RTCFrameCryptor.js +128 -0
- package/lib/module/RTCFrameCryptor.js.map +1 -0
- package/lib/module/RTCFrameCryptorFactory.js +70 -0
- package/lib/module/RTCFrameCryptorFactory.js.map +1 -0
- package/lib/module/RTCIceCandidate.js +27 -0
- package/lib/module/RTCIceCandidate.js.map +1 -0
- package/lib/module/RTCIceCandidateEvent.js +21 -0
- package/lib/module/RTCIceCandidateEvent.js.map +1 -0
- package/lib/module/RTCKeyProvider.js +101 -0
- package/lib/module/RTCKeyProvider.js.map +1 -0
- package/lib/module/RTCPIPView.js +26 -0
- package/lib/module/RTCPIPView.js.map +1 -0
- package/lib/module/RTCPIPView.web.js +11 -0
- package/lib/module/RTCPIPView.web.js.map +1 -0
- package/lib/module/RTCPeerConnection.js +684 -0
- package/lib/module/RTCPeerConnection.js.map +1 -0
- package/lib/module/RTCRtcpParameters.js +17 -0
- package/lib/module/RTCRtcpParameters.js.map +1 -0
- package/lib/module/RTCRtpCapabilities.js +15 -0
- package/lib/module/RTCRtpCapabilities.js.map +1 -0
- package/lib/module/RTCRtpCodecCapability.js +12 -0
- package/lib/module/RTCRtpCodecCapability.js.map +1 -0
- package/lib/module/RTCRtpCodecParameters.js +31 -0
- package/lib/module/RTCRtpCodecParameters.js.map +1 -0
- package/lib/module/RTCRtpEncodingParameters.js +71 -0
- package/lib/module/RTCRtpEncodingParameters.js.map +1 -0
- package/lib/module/RTCRtpHeaderExtension.js +20 -0
- package/lib/module/RTCRtpHeaderExtension.js.map +1 -0
- package/lib/module/RTCRtpParameters.js +27 -0
- package/lib/module/RTCRtpParameters.js.map +1 -0
- package/lib/module/RTCRtpReceiveParameters.js +7 -0
- package/lib/module/RTCRtpReceiveParameters.js.map +1 -0
- package/lib/module/RTCRtpReceiver.js +45 -0
- package/lib/module/RTCRtpReceiver.js.map +1 -0
- package/lib/module/RTCRtpSendParameters.js +41 -0
- package/lib/module/RTCRtpSendParameters.js.map +1 -0
- package/lib/module/RTCRtpSender.js +59 -0
- package/lib/module/RTCRtpSender.js.map +1 -0
- package/lib/module/RTCRtpTransceiver.js +74 -0
- package/lib/module/RTCRtpTransceiver.js.map +1 -0
- package/lib/module/RTCSessionDescription.js +26 -0
- package/lib/module/RTCSessionDescription.js.map +1 -0
- package/lib/module/RTCTrackEvent.js +31 -0
- package/lib/module/RTCTrackEvent.js.map +1 -0
- package/lib/module/RTCUtil.js +176 -0
- package/lib/module/RTCUtil.js.map +1 -0
- package/lib/module/RTCView.js +11 -0
- package/lib/module/RTCView.js.map +1 -0
- package/lib/module/RTCView.web.js +54 -0
- package/lib/module/RTCView.web.js.map +1 -0
- package/lib/module/ScreenCapturePickerView.js +3 -0
- package/lib/module/ScreenCapturePickerView.js.map +1 -0
- package/lib/module/ScreenCapturePickerView.web.js +4 -0
- package/lib/module/ScreenCapturePickerView.web.js.map +1 -0
- package/lib/module/getDisplayMedia.js +26 -0
- package/lib/module/getDisplayMedia.js.map +1 -0
- package/lib/module/getUserMedia.js +92 -0
- package/lib/module/getUserMedia.js.map +1 -0
- package/lib/module/index.js +60 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +114 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/webStream.js +27 -0
- package/lib/module/webStream.js.map +1 -0
- package/lib/typescript/Constraints.d.ts +19 -0
- package/lib/typescript/EventEmitter.d.ts +6 -0
- package/lib/typescript/Logger.d.ts +13 -0
- package/lib/typescript/MediaDevices.d.ts +30 -0
- package/lib/typescript/MediaStream.d.ts +48 -0
- package/lib/typescript/MediaStreamError.d.ts +6 -0
- package/lib/typescript/MediaStreamErrorEvent.d.ts +6 -0
- package/lib/typescript/MediaStreamTrack.d.ts +101 -0
- package/lib/typescript/MediaStreamTrackEvent.d.ts +19 -0
- package/lib/typescript/MessageEvent.d.ts +20 -0
- package/lib/typescript/Permissions.d.ts +55 -0
- package/lib/typescript/RTCAudioSession.d.ts +10 -0
- package/lib/typescript/RTCDataChannel.d.ts +43 -0
- package/lib/typescript/RTCDataChannelEvent.d.ts +19 -0
- package/lib/typescript/RTCDataPacketCryptor.d.ts +12 -0
- package/lib/typescript/RTCDataPacketCryptorFactory.d.ts +6 -0
- package/lib/typescript/RTCErrorEvent.d.ts +12 -0
- package/lib/typescript/RTCFrameCryptor.d.ts +47 -0
- package/lib/typescript/RTCFrameCryptorFactory.d.ts +21 -0
- package/lib/typescript/RTCIceCandidate.d.ts +17 -0
- package/lib/typescript/RTCIceCandidateEvent.d.ts +20 -0
- package/lib/typescript/RTCKeyProvider.d.ts +21 -0
- package/lib/typescript/RTCPIPView.d.ts +15 -0
- package/lib/typescript/RTCPIPView.web.d.ts +13 -0
- package/lib/typescript/RTCPeerConnection.d.ts +117 -0
- package/lib/typescript/RTCRtcpParameters.d.ts +10 -0
- package/lib/typescript/RTCRtpCapabilities.d.ts +9 -0
- package/lib/typescript/RTCRtpCodecCapability.d.ts +7 -0
- package/lib/typescript/RTCRtpCodecParameters.d.ts +16 -0
- package/lib/typescript/RTCRtpEncodingParameters.d.ts +23 -0
- package/lib/typescript/RTCRtpHeaderExtension.d.ts +12 -0
- package/lib/typescript/RTCRtpParameters.d.ts +19 -0
- package/lib/typescript/RTCRtpReceiveParameters.d.ts +4 -0
- package/lib/typescript/RTCRtpReceiver.d.ts +21 -0
- package/lib/typescript/RTCRtpSendParameters.d.ts +20 -0
- package/lib/typescript/RTCRtpSender.d.ts +22 -0
- package/lib/typescript/RTCRtpTransceiver.d.ts +31 -0
- package/lib/typescript/RTCSessionDescription.d.ts +12 -0
- package/lib/typescript/RTCTrackEvent.d.ts +29 -0
- package/lib/typescript/RTCUtil.d.ts +37 -0
- package/lib/typescript/RTCView.d.ts +117 -0
- package/lib/typescript/RTCView.web.d.ts +25 -0
- package/lib/typescript/ScreenCapturePickerView.d.ts +2 -0
- package/lib/typescript/ScreenCapturePickerView.web.d.ts +1 -0
- package/lib/typescript/getDisplayMedia.d.ts +2 -0
- package/lib/typescript/getUserMedia.d.ts +7 -0
- package/lib/typescript/index.d.ts +22 -0
- package/lib/typescript/index.web.d.ts +101 -0
- package/lib/typescript/webStream.d.ts +3 -0
- package/livekit-react-native-webrtc.podspec +29 -0
- package/macos/RCTWebRTC.xcodeproj/project.pbxproj +324 -0
- package/macos/RCTWebRTC.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/macos/RCTWebRTC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/metro.config.js +7 -0
- package/metro.config.macos.js +14 -0
- package/package.json +66 -0
- package/react-native.config.js +11 -0
- package/src/.eslintrc.cjs +67 -0
- package/src/Constraints.ts +21 -0
- package/src/EventEmitter.ts +65 -0
- package/src/Logger.ts +49 -0
- package/src/MediaDevices.ts +53 -0
- package/src/MediaStream.ts +161 -0
- package/src/MediaStreamError.ts +12 -0
- package/src/MediaStreamErrorEvent.ts +11 -0
- package/src/MediaStreamTrack.ts +284 -0
- package/src/MediaStreamTrackEvent.ts +25 -0
- package/src/MessageEvent.ts +26 -0
- package/src/Permissions.ts +133 -0
- package/src/RTCAudioSession.ts +25 -0
- package/src/RTCDataChannel.ts +190 -0
- package/src/RTCDataChannelEvent.ts +28 -0
- package/src/RTCDataPacketCryptor.ts +90 -0
- package/src/RTCDataPacketCryptorFactory.ts +25 -0
- package/src/RTCErrorEvent.ts +21 -0
- package/src/RTCFrameCryptor.ts +163 -0
- package/src/RTCFrameCryptorFactory.ts +102 -0
- package/src/RTCIceCandidate.ts +29 -0
- package/src/RTCIceCandidateEvent.ts +26 -0
- package/src/RTCKeyProvider.ts +117 -0
- package/src/RTCPIPView.tsx +47 -0
- package/src/RTCPIPView.web.tsx +18 -0
- package/src/RTCPeerConnection.ts +832 -0
- package/src/RTCRtcpParameters.ts +23 -0
- package/src/RTCRtpCapabilities.ts +16 -0
- package/src/RTCRtpCodecCapability.ts +13 -0
- package/src/RTCRtpCodecParameters.ts +44 -0
- package/src/RTCRtpEncodingParameters.ts +90 -0
- package/src/RTCRtpHeaderExtension.ts +27 -0
- package/src/RTCRtpParameters.ts +37 -0
- package/src/RTCRtpReceiveParameters.ts +7 -0
- package/src/RTCRtpReceiver.ts +60 -0
- package/src/RTCRtpSendParameters.ts +63 -0
- package/src/RTCRtpSender.ts +78 -0
- package/src/RTCRtpTransceiver.ts +107 -0
- package/src/RTCSessionDescription.ts +30 -0
- package/src/RTCTrackEvent.ts +42 -0
- package/src/RTCUtil.ts +211 -0
- package/src/RTCView.ts +122 -0
- package/src/RTCView.web.tsx +82 -0
- package/src/ScreenCapturePickerView.ts +4 -0
- package/src/ScreenCapturePickerView.web.tsx +3 -0
- package/src/getDisplayMedia.ts +30 -0
- package/src/getUserMedia.ts +111 -0
- package/src/index.ts +107 -0
- package/src/index.web.ts +191 -0
- package/src/webStream.ts +33 -0
- package/tools/format.sh +6 -0
- package/tools/release.sh +45 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_debug","_interopRequireDefault","require","obj","__esModule","default","_defineProperty","key","value","Object","defineProperty","enumerable","configurable","writable","Logger","enable","ns","debug","constructor","prefix","_prefix","ROOT_PREFIX","_info","_warn","_error","log","console","bind","msg","info","warn","error","err","_err$stack","trace","stack","exports"],"sources":["Logger.ts"],"sourcesContent":["import debug from 'debug';\r\n\r\n\r\nexport default class Logger {\r\n static ROOT_PREFIX = 'rn-webrtc';\r\n\r\n private _debug: debug.Debugger;\r\n private _info: debug.Debugger;\r\n private _warn: debug.Debugger;\r\n private _error: debug.Debugger;\r\n\r\n static enable(ns: string): void {\r\n debug.enable(ns);\r\n }\r\n\r\n constructor(prefix: string) {\r\n const _prefix = `${Logger.ROOT_PREFIX}:${prefix}`;\r\n\r\n this._debug = debug(`${_prefix}:DEBUG`);\r\n this._info = debug(`${_prefix}:INFO`);\r\n this._warn = debug(`${_prefix}:WARN`);\r\n this._error = debug(`${_prefix}:ERROR`);\r\n\r\n const log = console.log.bind(console);\r\n\r\n this._debug.log = log;\r\n this._info.log = log;\r\n this._warn.log = log;\r\n this._error.log = log;\r\n }\r\n\r\n debug(msg: string): void {\r\n this._debug(msg);\r\n }\r\n\r\n info(msg: string): void {\r\n this._info(msg);\r\n }\r\n\r\n warn(msg: string): void {\r\n this._warn(msg);\r\n }\r\n\r\n error(msg: string, err?: Error): void {\r\n const trace = err?.stack ?? 'N/A';\r\n\r\n this._error(`${msg} Trace: ${trace}`);\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,QAAAD,GAAA,IAAAJ,GAAA,IAAAM,MAAA,CAAAC,cAAA,CAAAP,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAG,UAAA,Q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AAQ;IAAA,IAAAC,UAAA;IAClC,MAAMC,KAAK,IAAAD,UAAA,GAAGD,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEG,KAAK,cAAAF,UAAA,cAAAA,UAAA,GAAI,KAAK;IAEjC,IAAI,CAACT,MAAM,CAAE,GAAEI,GAAI,WAAUM,KAAM,EAAC,CAAC;EACzC;AACJ;AAACE,OAAA,CAAA/B,OAAA,GAAAS,MAAA;AAAAR,eAAA,CA7CoBQ,MAAM,iBACF,WAAW"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = require("event-target-shim/index");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _getDisplayMedia = _interopRequireDefault(require("./getDisplayMedia"));
|
|
10
|
+
var _getUserMedia = _interopRequireDefault(require("./getUserMedia"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const {
|
|
13
|
+
WebRTCModule
|
|
14
|
+
} = _reactNative.NativeModules;
|
|
15
|
+
class MediaDevices extends _index.EventTarget {
|
|
16
|
+
/**
|
|
17
|
+
* W3C "Media Capture and Streams" compatible {@code enumerateDevices}
|
|
18
|
+
* implementation.
|
|
19
|
+
*/
|
|
20
|
+
enumerateDevices() {
|
|
21
|
+
return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* W3C "Screen Capture" compatible {@code getDisplayMedia} implementation.
|
|
26
|
+
* See: https://w3c.github.io/mediacapture-screen-share/
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise}
|
|
29
|
+
*/
|
|
30
|
+
getDisplayMedia() {
|
|
31
|
+
return (0, _getDisplayMedia.default)();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* W3C "Media Capture and Streams" compatible {@code getUserMedia}
|
|
36
|
+
* implementation.
|
|
37
|
+
* See: https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-enumeratedevices
|
|
38
|
+
*
|
|
39
|
+
* @param {*} constraints
|
|
40
|
+
* @returns {Promise}
|
|
41
|
+
*/
|
|
42
|
+
getUserMedia(constraints) {
|
|
43
|
+
return (0, _getUserMedia.default)(constraints);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Define the `onxxx` event handlers.
|
|
49
|
+
*/
|
|
50
|
+
const proto = MediaDevices.prototype;
|
|
51
|
+
(0, _index.defineEventAttribute)(proto, 'devicechange');
|
|
52
|
+
var _default = new MediaDevices();
|
|
53
|
+
exports.default = _default;
|
|
54
|
+
//# sourceMappingURL=MediaDevices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_reactNative","_getDisplayMedia","_interopRequireDefault","_getUserMedia","obj","__esModule","default","WebRTCModule","NativeModules","MediaDevices","EventTarget","enumerateDevices","Promise","resolve","getDisplayMedia","getUserMedia","constraints","proto","prototype","defineEventAttribute","_default","exports"],"sources":["MediaDevices.ts"],"sourcesContent":["import { EventTarget, Event, defineEventAttribute } from 'event-target-shim/index';\r\nimport { NativeModules } from 'react-native';\r\n\r\nimport getDisplayMedia from './getDisplayMedia';\r\nimport getUserMedia, { Constraints } from './getUserMedia';\r\n\r\nconst { WebRTCModule } = NativeModules;\r\n\r\ntype MediaDevicesEventMap = {\r\n devicechange: Event<'devicechange'>\r\n}\r\n\r\nclass MediaDevices extends EventTarget<MediaDevicesEventMap> {\r\n /**\r\n * W3C \"Media Capture and Streams\" compatible {@code enumerateDevices}\r\n * implementation.\r\n */\r\n enumerateDevices() {\r\n return new Promise(resolve => WebRTCModule.enumerateDevices(resolve));\r\n }\r\n\r\n /**\r\n * W3C \"Screen Capture\" compatible {@code getDisplayMedia} implementation.\r\n * See: https://w3c.github.io/mediacapture-screen-share/\r\n *\r\n * @returns {Promise}\r\n */\r\n getDisplayMedia() {\r\n return getDisplayMedia();\r\n }\r\n\r\n /**\r\n * W3C \"Media Capture and Streams\" compatible {@code getUserMedia}\r\n * implementation.\r\n * See: https://www.w3.org/TR/mediacapture-streams/#dom-mediadevices-enumeratedevices\r\n *\r\n * @param {*} constraints\r\n * @returns {Promise}\r\n */\r\n getUserMedia(constraints: Constraints) {\r\n return getUserMedia(constraints);\r\n }\r\n}\r\n\r\n/**\r\n * Define the `onxxx` event handlers.\r\n */\r\nconst proto = MediaDevices.prototype;\r\n\r\ndefineEventAttribute(proto, 'devicechange');\r\n\r\n\r\nexport default new MediaDevices();\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA2D,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3D,MAAM;EAAEG;AAAa,CAAC,GAAGC,0BAAa;AAMtC,MAAMC,YAAY,SAASC,kBAAW,CAAuB;EACzD;AACJ;AACA;AACA;EACIC,gBAAgBA,CAAA,EAAG;IACf,OAAO,IAAIC,OAAO,CAACC,OAAO,IAAIN,YAAY,CAACI,gBAAgB,CAACE,OAAO,CAAC,CAAC;EACzE;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACIC,eAAeA,CAAA,EAAG;IACd,OAAO,IAAAA,wBAAe,EAAC,CAAC;EAC5B;;EAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,YAAYA,CAACC,WAAwB,EAAE;IACnC,OAAO,IAAAD,qBAAY,EAACC,WAAW,CAAC;EACpC;AACJ;;AAEA;AACA;AACA;AACA,MAAMC,KAAK,GAAGR,YAAY,CAACS,SAAS;AAEpC,IAAAC,2BAAoB,EAACF,KAAK,EAAE,cAAc,CAAC;AAAC,IAAAG,QAAA,GAG7B,IAAIX,YAAY,CAAC,CAAC;AAAAY,OAAA,CAAAf,OAAA,GAAAc,QAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = require("event-target-shim/index");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _MediaStreamTrack = _interopRequireDefault(require("./MediaStreamTrack"));
|
|
10
|
+
var _RTCUtil = require("./RTCUtil");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
const {
|
|
14
|
+
WebRTCModule
|
|
15
|
+
} = _reactNative.NativeModules;
|
|
16
|
+
class MediaStream extends _index.EventTarget {
|
|
17
|
+
/**
|
|
18
|
+
* The identifier of this MediaStream unique within the associated
|
|
19
|
+
* WebRTCModule instance. As the id of a remote MediaStream instance is unique
|
|
20
|
+
* only within the associated RTCPeerConnection, it is not sufficiently unique
|
|
21
|
+
* to identify this MediaStream across multiple RTCPeerConnections and to
|
|
22
|
+
* unambiguously differentiate it from a local MediaStream instance not added
|
|
23
|
+
* to an RTCPeerConnection.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A MediaStream can be constructed in several ways, depending on the parameters
|
|
28
|
+
* that are passed here.
|
|
29
|
+
*
|
|
30
|
+
* - undefined: just a new stream, with no tracks.
|
|
31
|
+
* - MediaStream instance: a new stream, with a copy of the tracks of the passed stream.
|
|
32
|
+
* - Array of MediaStreamTrack: a new stream with a copy of the tracks in the array.
|
|
33
|
+
* - object: a new stream instance, represented by the passed info object, this is always
|
|
34
|
+
* done internally, when the stream is first created in native and the JS wrapper is
|
|
35
|
+
* built afterwards.
|
|
36
|
+
*/
|
|
37
|
+
constructor(arg) {
|
|
38
|
+
super();
|
|
39
|
+
|
|
40
|
+
// Assign a UUID to start with. It will get overridden for remote streams.
|
|
41
|
+
_defineProperty(this, "_tracks", []);
|
|
42
|
+
_defineProperty(this, "_id", void 0);
|
|
43
|
+
_defineProperty(this, "_reactTag", void 0);
|
|
44
|
+
this._id = (0, _RTCUtil.uniqueID)();
|
|
45
|
+
|
|
46
|
+
// Local MediaStreams are created by WebRTCModule to have their id and
|
|
47
|
+
// reactTag equal because WebRTCModule follows the respective standard's
|
|
48
|
+
// recommendation for id generation i.e. uses UUID which is unique enough
|
|
49
|
+
// for the purposes of reactTag.
|
|
50
|
+
this._reactTag = this._id;
|
|
51
|
+
if (typeof arg === 'undefined') {
|
|
52
|
+
WebRTCModule.mediaStreamCreate(this.id);
|
|
53
|
+
} else if (arg instanceof MediaStream) {
|
|
54
|
+
WebRTCModule.mediaStreamCreate(this.id);
|
|
55
|
+
for (const track of arg.getTracks()) {
|
|
56
|
+
this.addTrack(track);
|
|
57
|
+
}
|
|
58
|
+
} else if (Array.isArray(arg)) {
|
|
59
|
+
WebRTCModule.mediaStreamCreate(this.id);
|
|
60
|
+
for (const track of arg) {
|
|
61
|
+
this.addTrack(track);
|
|
62
|
+
}
|
|
63
|
+
} else if (typeof arg === 'object' && arg.streamId && arg.streamReactTag && arg.tracks) {
|
|
64
|
+
this._id = arg.streamId;
|
|
65
|
+
this._reactTag = arg.streamReactTag;
|
|
66
|
+
for (const trackInfo of arg.tracks) {
|
|
67
|
+
// We are not using addTrack here because the track is already part of the
|
|
68
|
+
// stream, so there is no need to add it on the native side.
|
|
69
|
+
this._tracks.push(new _MediaStreamTrack.default(trackInfo));
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
throw new TypeError(`invalid type: ${typeof arg}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
get id() {
|
|
76
|
+
return this._id;
|
|
77
|
+
}
|
|
78
|
+
get active() {
|
|
79
|
+
// TODO: can we reliably report this value?
|
|
80
|
+
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
addTrack(track) {
|
|
84
|
+
const index = this._tracks.indexOf(track);
|
|
85
|
+
if (index !== -1) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this._tracks.push(track);
|
|
89
|
+
WebRTCModule.mediaStreamAddTrack(this._reactTag, track.remote ? track._peerConnectionId : -1, track.id);
|
|
90
|
+
}
|
|
91
|
+
removeTrack(track) {
|
|
92
|
+
const index = this._tracks.indexOf(track);
|
|
93
|
+
if (index === -1) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this._tracks.splice(index, 1);
|
|
97
|
+
WebRTCModule.mediaStreamRemoveTrack(this._reactTag, track.remote ? track._peerConnectionId : -1, track.id);
|
|
98
|
+
}
|
|
99
|
+
getTracks() {
|
|
100
|
+
return this._tracks.slice();
|
|
101
|
+
}
|
|
102
|
+
getTrackById(trackId) {
|
|
103
|
+
return this._tracks.find(track => track.id === trackId);
|
|
104
|
+
}
|
|
105
|
+
getAudioTracks() {
|
|
106
|
+
return this._tracks.filter(track => track.kind === 'audio');
|
|
107
|
+
}
|
|
108
|
+
getVideoTracks() {
|
|
109
|
+
return this._tracks.filter(track => track.kind === 'video');
|
|
110
|
+
}
|
|
111
|
+
clone() {
|
|
112
|
+
throw new Error('Not implemented.');
|
|
113
|
+
}
|
|
114
|
+
toURL() {
|
|
115
|
+
return this._reactTag;
|
|
116
|
+
}
|
|
117
|
+
release() {
|
|
118
|
+
let releaseTracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
119
|
+
const tracks = [...this._tracks];
|
|
120
|
+
for (const track of tracks) {
|
|
121
|
+
this.removeTrack(track);
|
|
122
|
+
if (releaseTracks) {
|
|
123
|
+
track.release();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
WebRTCModule.mediaStreamRelease(this._reactTag);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Define the `onxxx` event handlers.
|
|
132
|
+
*/
|
|
133
|
+
exports.default = MediaStream;
|
|
134
|
+
const proto = MediaStream.prototype;
|
|
135
|
+
(0, _index.defineEventAttribute)(proto, 'addtrack');
|
|
136
|
+
(0, _index.defineEventAttribute)(proto, 'removetrack');
|
|
137
|
+
//# sourceMappingURL=MediaStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_reactNative","_MediaStreamTrack","_interopRequireDefault","_RTCUtil","obj","__esModule","default","_defineProperty","key","value","Object","defineProperty","enumerable","configurable","writable","WebRTCModule","NativeModules","MediaStream","EventTarget","constructor","arg","_id","uniqueID","_reactTag","mediaStreamCreate","id","track","getTracks","addTrack","Array","isArray","streamId","streamReactTag","tracks","trackInfo","_tracks","push","MediaStreamTrack","TypeError","active","index","indexOf","mediaStreamAddTrack","remote","_peerConnectionId","removeTrack","splice","mediaStreamRemoveTrack","slice","getTrackById","trackId","find","getAudioTracks","filter","kind","getVideoTracks","clone","Error","toURL","release","releaseTracks","arguments","length","undefined","mediaStreamRelease","exports","proto","prototype","defineEventAttribute"],"sources":["MediaStream.ts"],"sourcesContent":["import { EventTarget, defineEventAttribute } from 'event-target-shim/index';\r\nimport { NativeModules } from 'react-native';\r\n\r\nimport MediaStreamTrack, { MediaStreamTrackInfo } from './MediaStreamTrack';\r\nimport MediaStreamTrackEvent from './MediaStreamTrackEvent';\r\nimport { uniqueID } from './RTCUtil';\r\n\r\nconst { WebRTCModule } = NativeModules;\r\n\r\ntype MediaStreamEventMap = {\r\n addtrack: MediaStreamTrackEvent<'addtrack'>\r\n removetrack: MediaStreamTrackEvent<'removetrack'>\r\n}\r\n\r\nexport default class MediaStream extends EventTarget<MediaStreamEventMap> {\r\n _tracks: MediaStreamTrack[] = [];\r\n _id: string;\r\n\r\n /**\r\n * The identifier of this MediaStream unique within the associated\r\n * WebRTCModule instance. As the id of a remote MediaStream instance is unique\r\n * only within the associated RTCPeerConnection, it is not sufficiently unique\r\n * to identify this MediaStream across multiple RTCPeerConnections and to\r\n * unambiguously differentiate it from a local MediaStream instance not added\r\n * to an RTCPeerConnection.\r\n */\r\n _reactTag: string;\r\n\r\n /**\r\n * A MediaStream can be constructed in several ways, depending on the parameters\r\n * that are passed here.\r\n *\r\n * - undefined: just a new stream, with no tracks.\r\n * - MediaStream instance: a new stream, with a copy of the tracks of the passed stream.\r\n * - Array of MediaStreamTrack: a new stream with a copy of the tracks in the array.\r\n * - object: a new stream instance, represented by the passed info object, this is always\r\n * done internally, when the stream is first created in native and the JS wrapper is\r\n * built afterwards.\r\n */\r\n constructor(arg?:\r\n MediaStream |\r\n MediaStreamTrack[] |\r\n { streamId: string, streamReactTag: string, tracks: MediaStreamTrackInfo[] }\r\n ) {\r\n super();\r\n\r\n // Assign a UUID to start with. It will get overridden for remote streams.\r\n this._id = uniqueID();\r\n\r\n // Local MediaStreams are created by WebRTCModule to have their id and\r\n // reactTag equal because WebRTCModule follows the respective standard's\r\n // recommendation for id generation i.e. uses UUID which is unique enough\r\n // for the purposes of reactTag.\r\n this._reactTag = this._id;\r\n\r\n if (typeof arg === 'undefined') {\r\n WebRTCModule.mediaStreamCreate(this.id);\r\n } else if (arg instanceof MediaStream) {\r\n WebRTCModule.mediaStreamCreate(this.id);\r\n\r\n for (const track of arg.getTracks()) {\r\n this.addTrack(track);\r\n }\r\n } else if (Array.isArray(arg)) {\r\n WebRTCModule.mediaStreamCreate(this.id);\r\n\r\n for (const track of arg) {\r\n this.addTrack(track);\r\n }\r\n } else if (typeof arg === 'object' && arg.streamId && arg.streamReactTag && arg.tracks) {\r\n this._id = arg.streamId;\r\n this._reactTag = arg.streamReactTag;\r\n\r\n for (const trackInfo of arg.tracks) {\r\n // We are not using addTrack here because the track is already part of the\r\n // stream, so there is no need to add it on the native side.\r\n this._tracks.push(new MediaStreamTrack(trackInfo));\r\n }\r\n } else {\r\n throw new TypeError(`invalid type: ${typeof arg}`);\r\n }\r\n }\r\n\r\n get id(): string {\r\n return this._id;\r\n }\r\n\r\n get active(): boolean {\r\n // TODO: can we reliably report this value?\r\n\r\n return true;\r\n }\r\n\r\n addTrack(track: MediaStreamTrack): void {\r\n const index = this._tracks.indexOf(track);\r\n\r\n if (index !== -1) {\r\n return;\r\n }\r\n\r\n this._tracks.push(track);\r\n WebRTCModule.mediaStreamAddTrack(this._reactTag, track.remote ? track._peerConnectionId : -1, track.id);\r\n }\r\n\r\n removeTrack(track: MediaStreamTrack): void {\r\n const index = this._tracks.indexOf(track);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n this._tracks.splice(index, 1);\r\n WebRTCModule.mediaStreamRemoveTrack(this._reactTag, track.remote ? track._peerConnectionId : -1, track.id);\r\n }\r\n\r\n getTracks(): MediaStreamTrack[] {\r\n return this._tracks.slice();\r\n }\r\n\r\n getTrackById(trackId): MediaStreamTrack | undefined {\r\n return this._tracks.find(track => track.id === trackId);\r\n }\r\n\r\n getAudioTracks(): MediaStreamTrack[] {\r\n return this._tracks.filter(track => track.kind === 'audio');\r\n }\r\n\r\n getVideoTracks(): MediaStreamTrack[] {\r\n return this._tracks.filter(track => track.kind === 'video');\r\n }\r\n\r\n clone(): never {\r\n throw new Error('Not implemented.');\r\n }\r\n\r\n toURL(): string {\r\n return this._reactTag;\r\n }\r\n\r\n release(releaseTracks = true): void {\r\n const tracks = [ ...this._tracks ];\r\n\r\n for (const track of tracks) {\r\n this.removeTrack(track);\r\n\r\n if (releaseTracks) {\r\n track.release();\r\n }\r\n }\r\n\r\n WebRTCModule.mediaStreamRelease(this._reactTag);\r\n }\r\n}\r\n\r\n/**\r\n * Define the `onxxx` event handlers.\r\n */\r\nconst proto = MediaSt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,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IACxB,MAAM5B,MAAM,GAAG,CAAE,GAAG,IAAI,CAACE,OAAO,CAAE;IAElC,KAAK,MAAMT,KAAK,IAAIO,MAAM,EAAE;MACxB,IAAI,CAACY,WAAW,CAACnB,KAAK,CAAC;MAEvB,IAAIkC,aAAa,EAAE;QACflC,KAAK,CAACiC,OAAO,CAAC,CAAC;MACnB;IACJ;IAEA5C,YAAY,CAACiD,kBAAkB,CAAC,IAAI,CAACzC,SAAS,CAAC;EACnD;AACJ;;AAEA;AACA;AACA;AAFA0C,OAAA,CAAA3D,OAAA,GAAAW,WAAA;AAGA,MAAMiD,KAAK,GAAGjD,WAAW,CAACkD,SAAS;AAEnC,IAAAC,2BAAoB,EAACF,KAAK,EAAE,UAAU,CAAC;AACvC,IAAAE,2BAAoB,EAACF,KAAK,EAAE,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
class MediaStreamError {
|
|
9
|
+
constructor(error) {
|
|
10
|
+
_defineProperty(this, "name", void 0);
|
|
11
|
+
_defineProperty(this, "message", void 0);
|
|
12
|
+
_defineProperty(this, "constraintName", void 0);
|
|
13
|
+
this.name = error.name;
|
|
14
|
+
this.message = error.message;
|
|
15
|
+
this.constraintName = error.constraintName;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = MediaStreamError;
|
|
19
|
+
//# sourceMappingURL=MediaStreamError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MediaStreamError","constructor","error","_defineProperty","name","message","constraintName","exports","default"],"sources":["MediaStreamError.ts"],"sourcesContent":["\r\nexport default class MediaStreamError {\r\n name: string;\r\n message?: string;\r\n constraintName?: string;\r\n\r\n constructor(error) {\r\n this.name = error.name;\r\n this.message = error.message;\r\n this.constraintName = error.constraintName;\r\n }\r\n}\r\n"],"mappings":";;;;;;;AACe,MAAMA,gBAAgB,CAAC;EAKlCC,WAAWA,CAACC,KAAK,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACf,IAAI,CAACC,IAAI,GAAGF,KAAK,CAACE,IAAI;IACtB,IAAI,CAACC,OAAO,GAAGH,KAAK,CAACG,OAAO;IAC5B,IAAI,CAACC,cAAc,GAAGJ,KAAK,CAACI,cAAc;EAC9C;AACJ;AAACC,OAAA,CAAAC,OAAA,GAAAR,gBAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
class MediaStreamErrorEvent {
|
|
9
|
+
constructor(type, eventInitDict) {
|
|
10
|
+
_defineProperty(this, "type", void 0);
|
|
11
|
+
_defineProperty(this, "error", void 0);
|
|
12
|
+
this.type = type.toString();
|
|
13
|
+
Object.assign(this, eventInitDict);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = MediaStreamErrorEvent;
|
|
17
|
+
//# sourceMappingURL=MediaStreamErrorEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MediaStreamErrorEvent","constructor","type","eventInitDict","_defineProperty","toString","Object","assign","exports","default"],"sources":["MediaStreamErrorEvent.ts"],"sourcesContent":["\r\nimport type MediaStreamError from './MediaStreamError';\r\n\r\nexport default class MediaStreamErrorEvent {\r\n type: string;\r\n error?: MediaStreamError;\r\n constructor(type, eventInitDict) {\r\n this.type = type.toString();\r\n Object.assign(this, eventInitDict);\r\n }\r\n}\r\n"],"mappings":";;;;;;;AAGe,MAAMA,qBAAqB,CAAC;EAGvCC,WAAWA,CAACC,IAAI,EAAEC,aAAa,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAC7B,IAAI,CAACF,IAAI,GAAGA,IAAI,CAACG,QAAQ,CAAC,CAAC;IAC3BC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEJ,aAAa,CAAC;EACtC;AACJ;AAACK,OAAA,CAAAC,OAAA,GAAAT,qBAAA"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = require("event-target-shim/index");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _EventEmitter = require("./EventEmitter");
|
|
10
|
+
var _Logger = _interopRequireDefault(require("./Logger"));
|
|
11
|
+
var _RTCUtil = require("./RTCUtil");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
const log = new _Logger.default('pc');
|
|
15
|
+
const {
|
|
16
|
+
WebRTCModule
|
|
17
|
+
} = _reactNative.NativeModules;
|
|
18
|
+
class MediaStreamTrack extends _index.EventTarget {
|
|
19
|
+
constructor(info) {
|
|
20
|
+
super();
|
|
21
|
+
_defineProperty(this, "_constraints", void 0);
|
|
22
|
+
_defineProperty(this, "_enabled", void 0);
|
|
23
|
+
_defineProperty(this, "_settings", void 0);
|
|
24
|
+
_defineProperty(this, "_muted", void 0);
|
|
25
|
+
_defineProperty(this, "_peerConnectionId", void 0);
|
|
26
|
+
_defineProperty(this, "_readyState", void 0);
|
|
27
|
+
_defineProperty(this, "id", void 0);
|
|
28
|
+
_defineProperty(this, "kind", void 0);
|
|
29
|
+
_defineProperty(this, "label", '');
|
|
30
|
+
_defineProperty(this, "remote", void 0);
|
|
31
|
+
this._constraints = info.constraints || {};
|
|
32
|
+
this._enabled = info.enabled;
|
|
33
|
+
this._settings = info.settings || {};
|
|
34
|
+
this._muted = false;
|
|
35
|
+
this._peerConnectionId = info.peerConnectionId;
|
|
36
|
+
this._readyState = info.readyState;
|
|
37
|
+
this.id = info.id;
|
|
38
|
+
this.kind = info.kind;
|
|
39
|
+
this.remote = info.remote;
|
|
40
|
+
if (!this.remote) {
|
|
41
|
+
this._registerEvents();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get enabled() {
|
|
45
|
+
return this._enabled;
|
|
46
|
+
}
|
|
47
|
+
set enabled(enabled) {
|
|
48
|
+
if (enabled === this._enabled) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this._enabled = Boolean(enabled);
|
|
52
|
+
if (this._readyState === 'ended') {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
WebRTCModule.mediaStreamTrackSetEnabled(this.remote ? this._peerConnectionId : -1, this.id, this._enabled);
|
|
56
|
+
}
|
|
57
|
+
get muted() {
|
|
58
|
+
return this._muted;
|
|
59
|
+
}
|
|
60
|
+
get readyState() {
|
|
61
|
+
return this._readyState;
|
|
62
|
+
}
|
|
63
|
+
stop() {
|
|
64
|
+
this.enabled = false;
|
|
65
|
+
this._readyState = 'ended';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Private / custom API for switching the cameras on the fly, without the
|
|
70
|
+
* need for adding / removing tracks or doing any SDP renegotiation.
|
|
71
|
+
*
|
|
72
|
+
* This is how the reference application (AppRTCMobile) implements camera
|
|
73
|
+
* switching.
|
|
74
|
+
*
|
|
75
|
+
* @deprecated Use applyConstraints instead.
|
|
76
|
+
*/
|
|
77
|
+
_switchCamera() {
|
|
78
|
+
if (this.remote) {
|
|
79
|
+
throw new Error('Not implemented for remote tracks');
|
|
80
|
+
}
|
|
81
|
+
if (this.kind !== 'video') {
|
|
82
|
+
throw new Error('Only implemented for video tracks');
|
|
83
|
+
}
|
|
84
|
+
const constraints = (0, _RTCUtil.deepClone)(this._settings);
|
|
85
|
+
delete constraints.deviceId;
|
|
86
|
+
constraints.facingMode = this._settings.facingMode === 'user' ? 'environment' : 'user';
|
|
87
|
+
this.applyConstraints(constraints);
|
|
88
|
+
}
|
|
89
|
+
_setVideoEffects(names) {
|
|
90
|
+
if (this.remote) {
|
|
91
|
+
throw new Error('Not implemented for remote tracks');
|
|
92
|
+
}
|
|
93
|
+
if (this.kind !== 'video') {
|
|
94
|
+
throw new Error('Only implemented for video tracks');
|
|
95
|
+
}
|
|
96
|
+
WebRTCModule.mediaStreamTrackSetVideoEffects(this.id, names);
|
|
97
|
+
}
|
|
98
|
+
_setVideoEffect(name) {
|
|
99
|
+
this._setVideoEffects([name]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Internal function which is used to set the muted state on remote tracks and
|
|
104
|
+
* emit the mute / unmute event.
|
|
105
|
+
*
|
|
106
|
+
* @param muted Whether the track should be marked as muted / unmuted.
|
|
107
|
+
*/
|
|
108
|
+
_setMutedInternal(muted) {
|
|
109
|
+
if (!this.remote) {
|
|
110
|
+
throw new Error('Track is not remote!');
|
|
111
|
+
}
|
|
112
|
+
this._muted = muted;
|
|
113
|
+
this.dispatchEvent(new _index.Event(muted ? 'mute' : 'unmute'));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Custom API for setting the volume on an individual audio track.
|
|
118
|
+
*
|
|
119
|
+
* @param volume a gain value in the range of 0-10. defaults to 1.0
|
|
120
|
+
*/
|
|
121
|
+
_setVolume(volume) {
|
|
122
|
+
if (this.kind !== 'audio') {
|
|
123
|
+
throw new Error('Only implemented for audio tracks');
|
|
124
|
+
}
|
|
125
|
+
WebRTCModule.mediaStreamTrackSetVolume(this.remote ? this._peerConnectionId : -1, this.id, volume);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Applies a new set of constraints to the track.
|
|
130
|
+
*
|
|
131
|
+
* @param constraints An object listing the constraints
|
|
132
|
+
* to apply to the track's constrainable properties; any existing
|
|
133
|
+
* constraints are replaced with the new values specified, and any
|
|
134
|
+
* constrainable properties not included are restored to their default
|
|
135
|
+
* constraints. If this parameter is omitted, all currently set custom
|
|
136
|
+
* constraints are cleared.
|
|
137
|
+
*/
|
|
138
|
+
async applyConstraints(constraints) {
|
|
139
|
+
if (this.kind !== 'video') {
|
|
140
|
+
log.info(`Only implemented for video tracks, ignoring applyConstraints for ${this.id}`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const normalized = (0, _RTCUtil.normalizeConstraints)({
|
|
144
|
+
video: constraints !== null && constraints !== void 0 ? constraints : true
|
|
145
|
+
});
|
|
146
|
+
this._settings = await WebRTCModule.mediaStreamTrackApplyConstraints(this.id, normalized.video);
|
|
147
|
+
this._constraints = constraints !== null && constraints !== void 0 ? constraints : {};
|
|
148
|
+
}
|
|
149
|
+
clone() {
|
|
150
|
+
throw new Error('Not implemented.');
|
|
151
|
+
}
|
|
152
|
+
getCapabilities() {
|
|
153
|
+
throw new Error('Not implemented.');
|
|
154
|
+
}
|
|
155
|
+
async startPalabraTranslation(config) {
|
|
156
|
+
if (!this.remote) {
|
|
157
|
+
throw new Error('only_remote_tracks');
|
|
158
|
+
}
|
|
159
|
+
if (this.kind !== 'audio') {
|
|
160
|
+
throw new Error('only_audio_tracks');
|
|
161
|
+
}
|
|
162
|
+
if (this._readyState === 'ended') {
|
|
163
|
+
throw new Error('track_ended');
|
|
164
|
+
}
|
|
165
|
+
return WebRTCModule.startPalabraTranslation(this._peerConnectionId, this.id, config.clientId, config.clientSecret, config.sourceLang, config.targetLang, config.apiUrl || 'https://api.palabra.ai');
|
|
166
|
+
}
|
|
167
|
+
async stopPalabraTranslation() {
|
|
168
|
+
return WebRTCModule.stopPalabraTranslation();
|
|
169
|
+
}
|
|
170
|
+
getConstraints() {
|
|
171
|
+
return (0, _RTCUtil.deepClone)(this._constraints);
|
|
172
|
+
}
|
|
173
|
+
getSettings() {
|
|
174
|
+
return (0, _RTCUtil.deepClone)(this._settings);
|
|
175
|
+
}
|
|
176
|
+
_registerEvents() {
|
|
177
|
+
(0, _EventEmitter.addListener)(this, 'mediaStreamTrackEnded', ev => {
|
|
178
|
+
if (ev.trackId !== this.id || this._readyState === 'ended') {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
log.debug(`${this.id} mediaStreamTrackEnded`);
|
|
182
|
+
this._readyState = 'ended';
|
|
183
|
+
this.dispatchEvent(new _index.Event('ended'));
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
release() {
|
|
187
|
+
if (this.remote) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
(0, _EventEmitter.removeListener)(this);
|
|
191
|
+
WebRTCModule.mediaStreamTrackRelease(this.id);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Define the `onxxx` event handlers.
|
|
197
|
+
*/
|
|
198
|
+
exports.default = MediaStreamTrack;
|
|
199
|
+
const proto = MediaStreamTrack.prototype;
|
|
200
|
+
(0, _index.defineEventAttribute)(proto, 'ended');
|
|
201
|
+
(0, _index.defineEventAttribute)(proto, 'mute');
|
|
202
|
+
(0, _index.defineEventAttribute)(proto, 'unmute');
|
|
203
|
+
//# sourceMappingURL=MediaStreamTrack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_reactNative","_EventEmitter","_Logger","_interopRequireDefault","_RTCUtil","obj","__esModule","default","_defineProperty","key","value","Object","defineProperty","enumerable","configurable","writable","log","Logger","WebRTCModule","NativeModules","MediaStreamTrack","EventTarget","constructor","info","_constraints","constraints","_enabled","enabled","_settings","settings","_muted","_peerConnectionId","peerConnectionId","_readyState","readyState","id","kind","remote","_registerEvents","Boolean","mediaStreamTrackSetEnabled","muted","stop","_switchCamera","Error","deepClone","deviceId","facingMode","applyConstraints","_setVideoEffects","names","mediaStreamTrackSetVideoEffects","_setVideoEffect","name","_setMutedInternal","dispatchEvent","Event","_setVolume","volume","mediaStreamTrackSetVolume","normalized","normalizeConstraints","video","mediaStreamTrackApplyConstraints","clone","getCapabilities","startPalabraTranslation","config","clientId","clientSecret","sourceLang","targetLang","apiUrl","stopPalabraTranslation","getConstraints","getSettings","addListener","ev","trackId","debug","release","removeListener","mediaStreamTrackRelease","exports","proto","prototype","defineEventAttribute"],"sources":["MediaStreamTrack.ts"],"sourcesContent":["import { EventTarget, Event, defineEventAttribute } from 'event-target-shim/index';\r\nimport { NativeModules } from 'react-native';\r\n\r\nimport { MediaTrackConstraints } from './Constraints';\r\nimport { addListener, removeListener } from './EventEmitter';\r\nimport Logger from './Logger';\r\nimport { deepClone, normalizeConstraints } from './RTCUtil';\r\n\r\nconst log = new Logger('pc');\r\nconst { WebRTCModule } = NativeModules;\r\n\r\nexport type PalabraConfig = {\r\n clientId: string;\r\n clientSecret: string;\r\n sourceLang: string;\r\n targetLang: string;\r\n apiUrl?: string;\r\n};\r\n\r\nexport type PalabraTranscription = {\r\n text: string;\r\n lang: string;\r\n isFinal: boolean;\r\n};\r\n\r\ntype MediaStreamTrackState = 'live' | 'ended';\r\n\r\nexport type MediaStreamTrackInfo = {\r\n id: string;\r\n kind: string;\r\n remote: boolean;\r\n constraints: object;\r\n enabled: boolean;\r\n settings: object;\r\n peerConnectionId: number;\r\n readyState: MediaStreamTrackState;\r\n}\r\n\r\nexport type MediaTrackSettings = {\r\n width?: number;\r\n height?: number;\r\n frameRate?: number;\r\n facingMode?: string;\r\n deviceId?: string;\r\n groupId?: string;\r\n}\r\n\r\ntype MediaStreamTrackEventMap = {\r\n ended: Event<'ended'>;\r\n mute: Event<'mute'>;\r\n unmute: Event<'unmute'>;\r\n}\r\n\r\nexport default class MediaStreamTrack extends EventTarget<MediaStreamTrackEventMap> {\r\n _constraints: MediaTrackConstraints;\r\n _enabled: boolean;\r\n _settings: MediaTrackSettings;\r\n _muted: boolean;\r\n _peerConnectionId: number;\r\n _readyState: MediaStreamTrackState;\r\n\r\n readonly id: string;\r\n readonly kind: string;\r\n readonly label: string = '';\r\n readonly remote: boolean;\r\n\r\n constructor(info: MediaStreamTrackInfo) {\r\n super();\r\n\r\n this._constraints = info.constraints || {};\r\n this._enabled = info.enabled;\r\n this._settings = info.settings || {};\r\n this._muted = false;\r\n this._peerConnectionId = info.peerConnectionId;\r\n this._readyState = info.readyState;\r\n\r\n this.id = info.id;\r\n this.kind = info.kind;\r\n this.remote = info.remote;\r\n\r\n if (!this.remote) {\r\n this._registerEvents();\r\n }\r\n }\r\n\r\n get enabled(): boolean {\r\n return this._enabled;\r\n }\r\n\r\n set enabled(enabled: boolean) {\r\n if (enabled === this._enabled) {\r\n return;\r\n }\r\n\r\n this._enabled = Boolean(enabled);\r\n\r\n if (this._readyState === 'ended') {\r\n return;\r\n }\r\n\r\n WebRTCModule.mediaStreamTrackSetEnabled(this.remote ? this._peerConnectionId : -1, this.id, this._enabled);\r\n }\r\n\r\n get muted(): boolean {\r\n return this._muted;\r\n }\r\n\r\n get readyState(): string {\r\n return this._readyState;\r\n }\r\n\r\n stop(): void {\r\n this.enabled = false;\r\n this._readyState = 'ended';\r\n }\r\n\r\n /**\r\n * Private / custom API for switching the cameras on the fly, without the\r\n * need for adding / removing tracks or doing any SDP renegotiation.\r\n *\r\n * This is how the reference application (AppRTCMobile) implements camera\r\n * switching.\r\n *\r\n * @deprecated Use applyConstraints instead.\r\n */\r\n _switchCamera(): void {\r\n if (this.remote) {\r\n throw new Error('Not implemented for remote tracks');\r\n }\r\n\r\n if (this.kind !== 'video') {\r\n throw new Error('Only implemented for video tracks');\r\n }\r\n\r\n const constraints = deepClone(this._settings);\r\n\r\n delete constraints.deviceId;\r\n constraints.facingMode = this._settings.facingMode === 'user' ? 'environment' : 'user';\r\n\r\n this.applyConstraints(constraints);\r\n }\r\n\r\n _setVideoEffects(names: string[]) {\r\n if (this.remote) {\r\n throw new Error('Not implemented for remote tracks');\r\n }\r\n\r\n if (this.kind !== 'video') {\r\n throw new Error('Only implemented for video tracks');\r\n }\r\n\r\n WebRTCModule.mediaStreamTrackSetVideoEffects(this.id, names);\r\n }\r\n\r\n _setVideoEffect(name: string) {\r\n this._setVideoEffects([ name ]);\r\n }\r\n\r\n /**\r\n * Internal function which is used to set the muted state on remote tracks and\r\n * emit the mute / unmute event.\r\n *\r\n * @param muted Whether the track should be marked as muted / unmuted.\r\n */\r\n _setMutedInternal(muted: boolean) {\r\n if (!this.remote) {\r\n throw new Error('Track is not remote!');\r\n }\r\n\r\n this._muted = muted;\r\n this.dispatchEvent(new Event(muted ? 'mute' : 'unmute'));\r\n }\r\n\r\n /**\r\n * Custom API for setting the volume on an individual audio track.\r\n *\r\n * @param volume a gain value in the range of 0-10. defaults to 1.0\r\n */\r\n _setVolume(volume: number) {\r\n if (this.kind !== 'audio') {\r\n throw new Error('Only implemented for audio tracks');\r\n }\r\n\r\n WebRTCModule.mediaStreamTrackSetVolume(this.remote ? this._peerConnectionId : -1, this.id, volume);\r\n }\r\n\r\n /**\r\n * Applies a new set of constraints to the track.\r\n *\r\n * @param constraints An object listing the constraints\r\n * to apply to the track's constrainable properties; any existing\r\n * constraints are replaced with the new values specified, and any\r\n * constrainable properties not included are restored to their default\r\n * constraints. If this parameter is omitted, all currently set custom\r\n * constraints are cleared.\r\n */\r\n async applyConstraints(constraints?: MediaTrackConstraints): Promise<void> {\r\n if (this.kind !== 'video') {\r\n log.info(`Only implemented for video tracks, ignoring applyConstraints for ${this.id}`);\r\n\r\n return;\r\n }\r\n\r\n const normalized = normalizeConstraints({ video: constraints ?? true });\r\n\r\n this._settings = await WebRTCModule.mediaStreamTrackApplyConstraints(this.id, normalized.video);\r\n this._constraints = constraints ?? {};\r\n }\r\n\r\n clone(): never {\r\n throw new Error('Not implemented.');\r\n }\r\n\r\n getCapabilities(): never {\r\n throw new Error('Not implemented.');\r\n }\r\n\r\n async startPalabraTranslation(config: PalabraConfig): Promise<void> {\r\n if (!this.remote) {\r\n throw new Error('only_remote_tracks');\r\n }\n\r\n if (this.kind !== 'audio') {\r\n throw new Error('only_audio_tracks');\r\n }\n\r\n if (this._readyState === 'ended') {\r\n throw new Error('track_ended');\r\n }\r\n\r\n return WebRTCModule.startPalabraTranslation(\r\n this._peerConnectionId,\r\n this.id,\r\n config.clientId,\r\n config.clientSecret,\r\n config.sourceLang,\r\n config.targetLang,\r\n config.apiUrl || 'https://api.palabra.ai'\r\n );\r\n }\r\n\r\n async stopPalabraTranslation(): Promise<void> {\r\n return WebRTCModule.stopPalabraTranslation();\r\n }\r\n\r\n getConstraints() {\r\n return deepClone(this._constraints);\r\n }\r\n\r\n getSettings(): MediaTrackSettings {\r\n return deepClone(this._settings);\r\n }\r\n\r\n _registerEvents(): void {\r\n addListener(this, 'mediaStreamTrackEnded', (ev: any) => {\r\n if (ev.trackId !== this.id || this._readyState === 'ended') {\r\n return;\r\n }\r\n\r\n log.debug(`${this.id} mediaStreamTrackEnded`);\r\n this._readyState = 'ended';\r\n\r\n this.dispatchEvent(new Event('ended'));\r\n });\r\n }\r\n\r\n release(): void {\r\n if (this.remote) {\r\n return;\r\n }\r\n\r\n removeListener(this);\r\n WebRTCModule.mediaStreamTrackRelease(this.id);\r\n }\r\n}\r\n\r\n/**\r\n * Define the `onxxx` event handlers.\r\n */\r\nconst proto = MediaStreamTrack.prototype;\r\n\r\ndefineEventAttribute(proto, 'ended');\r\ndefineEventAttribute(proto, 'mute');\r\ndefineEventAttribute(proto, 'unmute');\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAA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"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = require("event-target-shim/index");
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
/**
|
|
10
|
+
* @eventClass
|
|
11
|
+
* This event is fired whenever the MediaStreamTrack has changed in any way.
|
|
12
|
+
* @param {MEDIA_STREAM_EVENTS} type - The type of event.
|
|
13
|
+
* @param {IMediaStreamTrackEventInitDict} eventInitDict - The event init properties.
|
|
14
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream#events MDN} for details.
|
|
15
|
+
*/
|
|
16
|
+
class MediaStreamTrackEvent extends _index.Event {
|
|
17
|
+
/** @eventProperty */
|
|
18
|
+
|
|
19
|
+
constructor(type, eventInitDict) {
|
|
20
|
+
super(type, eventInitDict);
|
|
21
|
+
_defineProperty(this, "track", void 0);
|
|
22
|
+
this.track = eventInitDict.track;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = MediaStreamTrackEvent;
|
|
26
|
+
//# sourceMappingURL=MediaStreamTrackEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_defineProperty","obj","key","value","Object","defineProperty","enumerable","configurable","writable","MediaStreamTrackEvent","Event","constructor","type","eventInitDict","track","exports","default"],"sources":["MediaStreamTrackEvent.ts"],"sourcesContent":["import { Event } from 'event-target-shim/index';\r\n\r\nimport type MediaStreamTrack from './MediaStreamTrack';\r\n\r\ntype MEDIA_STREAM_EVENTS = 'addtrack'| 'removetrack'\r\n\r\ninterface IMediaStreamTrackEventInitDict extends Event.EventInit {\r\n track: MediaStreamTrack;\r\n}\r\n\r\n/**\r\n * @eventClass\r\n * This event is fired whenever the MediaStreamTrack has changed in any way.\r\n * @param {MEDIA_STREAM_EVENTS} type - The type of event.\r\n * @param {IMediaStreamTrackEventInitDict} eventInitDict - The event init properties.\r\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream#events MDN} for details.\r\n */\r\nexport default class MediaStreamTrackEvent<TEventType extends MEDIA_STREAM_EVENTS> extends Event<TEventType> {\r\n /** @eventProperty */\r\n track: MediaStreamTrack;\r\n constructor(type: TEventType, eventInitDict: IMediaStreamTrackEventInitDict) {\r\n super(type, eventInitDict);\r\n this.track = eventInitDict.track;\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAgD,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,QAAAD,GAAA,IAAAD,GAAA,IAAAG,MAAA,CAAAC,cAAA,CAAAJ,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAG,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAP,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAUhD;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMQ,qBAAqB,SAAiDC,YAAK,CAAa;EACzG;;EAEAC,WAAWA,CAACC,IAAgB,EAAEC,aAA6C,EAAE;IACzE,KAAK,CAACD,IAAI,EAAEC,aAAa,CAAC;IAACb,eAAA;IAC3B,IAAI,CAACc,KAAK,GAAGD,aAAa,CAACC,KAAK;EACpC;AACJ;AAACC,OAAA,CAAAC,OAAA,GAAAP,qBAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = require("event-target-shim/index");
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
/**
|
|
10
|
+
* @eventClass
|
|
11
|
+
* This event is fired whenever the RTCDataChannel send message.
|
|
12
|
+
* @param {MESSAGE_EVENTS} type - The type of event.
|
|
13
|
+
* @param {IMessageEventInitDict} eventInitDict - The event init properties.
|
|
14
|
+
* @see
|
|
15
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/message_event#event_type MDN} for details.
|
|
16
|
+
*/
|
|
17
|
+
class MessageEvent extends _index.Event {
|
|
18
|
+
/** @eventProperty */
|
|
19
|
+
|
|
20
|
+
constructor(type, eventInitDict) {
|
|
21
|
+
super(type, eventInitDict);
|
|
22
|
+
_defineProperty(this, "data", void 0);
|
|
23
|
+
this.data = eventInitDict.data;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = MessageEvent;
|
|
27
|
+
//# sourceMappingURL=MessageEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_defineProperty","obj","key","value","Object","defineProperty","enumerable","configurable","writable","MessageEvent","Event","constructor","type","eventInitDict","data","exports","default"],"sources":["MessageEvent.ts"],"sourcesContent":["import { Event } from 'event-target-shim/index';\r\n\r\nexport type MessageEventData = string | ArrayBuffer | Blob;\r\n\r\ntype MESSAGE_EVENTS = 'message' | 'messageerror';\r\n\r\ninterface IMessageEventInitDict extends Event.EventInit {\r\n data: MessageEventData;\r\n}\r\n\r\n/**\r\n * @eventClass\r\n * This event is fired whenever the RTCDataChannel send message.\r\n * @param {MESSAGE_EVENTS} type - The type of event.\r\n * @param {IMessageEventInitDict} eventInitDict - The event init properties.\r\n * @see\r\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/message_event#event_type MDN} for details.\r\n */\r\nexport default class MessageEvent<TEventType extends MESSAGE_EVENTS> extends Event<TEventType> {\r\n /** @eventProperty */\r\n data: MessageEventData;\r\n constructor(type: TEventType, eventInitDict: IMessageEventInitDict) {\r\n super(type, eventInitDict);\r\n this.data = eventInitDict.data;\r\n }\r\n}\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAgD,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,QAAAD,GAAA,IAAAD,GAAA,IAAAG,MAAA,CAAAC,cAAA,CAAAJ,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAG,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAP,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAUhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMQ,YAAY,SAA4CC,YAAK,CAAa;EAC3F;;EAEAC,WAAWA,CAACC,IAAgB,EAAEC,aAAoC,EAAE;IAChE,KAAK,CAACD,IAAI,EAAEC,aAAa,CAAC;IAACb,eAAA;IAC3B,IAAI,CAACc,IAAI,GAAGD,aAAa,CAACC,IAAI;EAClC;AACJ;AAACC,OAAA,CAAAC,OAAA,GAAAP,YAAA"}
|