@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.1.4 → 0.3.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/.eslintrc.js +1 -1
- package/.prettierrc.json +1 -0
- package/dist/commonjs/AFK/AFKController.js +110 -0
- package/dist/commonjs/AFK/AFKController.js.map +1 -0
- package/dist/commonjs/Config/Config.js +560 -0
- package/dist/commonjs/Config/Config.js.map +1 -0
- package/dist/commonjs/Config/SettingBase.js +99 -0
- package/dist/commonjs/Config/SettingBase.js.map +1 -0
- package/dist/commonjs/Config/SettingFlag.js +50 -0
- package/dist/commonjs/Config/SettingFlag.js.map +1 -0
- package/dist/commonjs/Config/SettingNumber.js +84 -0
- package/dist/commonjs/Config/SettingNumber.js.map +1 -0
- package/dist/commonjs/Config/SettingOption.js +85 -0
- package/dist/commonjs/Config/SettingOption.js.map +1 -0
- package/dist/commonjs/Config/SettingText.js +43 -0
- package/dist/commonjs/Config/SettingText.js.map +1 -0
- package/dist/commonjs/DataChannel/DataChannelController.js +107 -0
- package/dist/commonjs/DataChannel/DataChannelController.js.map +1 -0
- package/dist/commonjs/DataChannel/DataChannelLatencyTestController.js +95 -0
- package/dist/commonjs/DataChannel/DataChannelLatencyTestController.js.map +1 -0
- package/dist/commonjs/DataChannel/DataChannelLatencyTestResults.js +19 -0
- package/dist/commonjs/DataChannel/DataChannelLatencyTestResults.js.map +1 -0
- package/dist/commonjs/DataChannel/DataChannelSender.js +44 -0
- package/dist/commonjs/DataChannel/DataChannelSender.js.map +1 -0
- package/dist/commonjs/DataChannel/InitialSettings.js +42 -0
- package/dist/commonjs/DataChannel/InitialSettings.js.map +1 -0
- package/dist/commonjs/DataChannel/LatencyTestResults.js +61 -0
- package/dist/commonjs/DataChannel/LatencyTestResults.js.map +1 -0
- package/dist/commonjs/FreezeFrame/FreezeFrame.js +94 -0
- package/dist/commonjs/FreezeFrame/FreezeFrame.js.map +1 -0
- package/dist/commonjs/FreezeFrame/FreezeFrameController.js +96 -0
- package/dist/commonjs/FreezeFrame/FreezeFrameController.js.map +1 -0
- package/dist/commonjs/Inputs/GamepadController.js +189 -0
- package/dist/commonjs/Inputs/GamepadController.js.map +1 -0
- package/dist/commonjs/Inputs/GamepadTypes.js +22 -0
- package/dist/commonjs/Inputs/GamepadTypes.js.map +1 -0
- package/dist/commonjs/Inputs/IInputController.js +3 -0
- package/dist/commonjs/Inputs/IInputController.js.map +1 -0
- package/dist/commonjs/Inputs/InputClassesFactory.js +97 -0
- package/dist/commonjs/Inputs/InputClassesFactory.js.map +1 -0
- package/dist/commonjs/Inputs/KeyCodes.js +113 -0
- package/dist/commonjs/Inputs/KeyCodes.js.map +1 -0
- package/dist/commonjs/Inputs/KeyboardController.js +138 -0
- package/dist/commonjs/Inputs/KeyboardController.js.map +1 -0
- package/dist/commonjs/Inputs/MouseButtons.js +29 -0
- package/dist/commonjs/Inputs/MouseButtons.js.map +1 -0
- package/dist/commonjs/Inputs/MouseController.js +98 -0
- package/dist/commonjs/Inputs/MouseController.js.map +1 -0
- package/dist/commonjs/Inputs/MouseControllerHovering.js +94 -0
- package/dist/commonjs/Inputs/MouseControllerHovering.js.map +1 -0
- package/dist/commonjs/Inputs/MouseControllerLocked.js +154 -0
- package/dist/commonjs/Inputs/MouseControllerLocked.js.map +1 -0
- package/dist/commonjs/Inputs/SpecialKeyCodes.js +20 -0
- package/dist/commonjs/Inputs/SpecialKeyCodes.js.map +1 -0
- package/dist/commonjs/Inputs/TouchController.js +124 -0
- package/dist/commonjs/Inputs/TouchController.js.map +1 -0
- package/dist/commonjs/Inputs/TouchControllerFake.js +92 -0
- package/dist/commonjs/Inputs/TouchControllerFake.js.map +1 -0
- package/dist/commonjs/Inputs/XRGamepadController.js +125 -0
- package/dist/commonjs/Inputs/XRGamepadController.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/AggregatedStats.js +253 -0
- package/dist/commonjs/PeerConnectionController/AggregatedStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/CandidatePairStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/CandidatePairStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/CandidateStat.js +11 -0
- package/dist/commonjs/PeerConnectionController/CandidateStat.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/CodecStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/CodecStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/DataChannelStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/DataChannelStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/InboundRTPStats.js +23 -0
- package/dist/commonjs/PeerConnectionController/InboundRTPStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/InboundTrackStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/InboundTrackStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/OutBoundRTPStats.js +17 -0
- package/dist/commonjs/PeerConnectionController/OutBoundRTPStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/PeerConnectionController.js +585 -0
- package/dist/commonjs/PeerConnectionController/PeerConnectionController.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/SessionStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/SessionStats.js.map +1 -0
- package/dist/commonjs/PeerConnectionController/StreamStats.js +11 -0
- package/dist/commonjs/PeerConnectionController/StreamStats.js.map +1 -0
- package/dist/commonjs/PixelStreaming/PixelStreaming.js +608 -0
- package/dist/commonjs/PixelStreaming/PixelStreaming.js.map +1 -0
- package/dist/commonjs/UI/OnScreenKeyboard.js +83 -0
- package/dist/commonjs/UI/OnScreenKeyboard.js.map +1 -0
- package/dist/commonjs/UeInstanceMessage/ResponseController.js +39 -0
- package/dist/commonjs/UeInstanceMessage/ResponseController.js.map +1 -0
- package/dist/commonjs/UeInstanceMessage/SendMessageController.js +121 -0
- package/dist/commonjs/UeInstanceMessage/SendMessageController.js.map +1 -0
- package/dist/commonjs/UeInstanceMessage/StreamMessageController.js +211 -0
- package/dist/commonjs/UeInstanceMessage/StreamMessageController.js.map +1 -0
- package/dist/commonjs/UeInstanceMessage/ToStreamerMessagesController.js +50 -0
- package/dist/commonjs/UeInstanceMessage/ToStreamerMessagesController.js.map +1 -0
- package/dist/commonjs/Util/EventEmitter.js +387 -0
- package/dist/commonjs/Util/EventEmitter.js.map +1 -0
- package/dist/commonjs/Util/FileUtil.js +109 -0
- package/dist/commonjs/Util/FileUtil.js.map +1 -0
- package/dist/commonjs/Util/IURLSearchParams.js +26 -0
- package/dist/commonjs/Util/IURLSearchParams.js.map +1 -0
- package/dist/commonjs/Util/InputCoordTranslator.js +50 -0
- package/dist/commonjs/Util/InputCoordTranslator.js.map +1 -0
- package/dist/commonjs/Util/RTCUtils.js +41 -0
- package/dist/commonjs/Util/RTCUtils.js.map +1 -0
- package/dist/commonjs/VideoPlayer/StreamController.js +68 -0
- package/dist/commonjs/VideoPlayer/StreamController.js.map +1 -0
- package/dist/commonjs/VideoPlayer/VideoPlayer.js +178 -0
- package/dist/commonjs/VideoPlayer/VideoPlayer.js.map +1 -0
- package/dist/commonjs/WebRtcPlayer/WebRtcPlayerController.js +1224 -0
- package/dist/commonjs/WebRtcPlayer/WebRtcPlayerController.js.map +1 -0
- package/dist/commonjs/WebXR/WebXRController.js +361 -0
- package/dist/commonjs/WebXR/WebXRController.js.map +1 -0
- package/dist/commonjs/pixelstreamingfrontend.js +71 -0
- package/dist/commonjs/pixelstreamingfrontend.js.map +1 -0
- package/dist/esm/AFK/AFKController.js +106 -0
- package/dist/esm/AFK/AFKController.js.map +1 -0
- package/dist/esm/Config/Config.js +552 -0
- package/dist/esm/Config/Config.js.map +1 -0
- package/dist/esm/Config/SettingBase.js +95 -0
- package/dist/esm/Config/SettingBase.js.map +1 -0
- package/dist/esm/Config/SettingFlag.js +46 -0
- package/dist/esm/Config/SettingFlag.js.map +1 -0
- package/dist/esm/Config/SettingNumber.js +80 -0
- package/dist/esm/Config/SettingNumber.js.map +1 -0
- package/dist/esm/Config/SettingOption.js +81 -0
- package/dist/esm/Config/SettingOption.js.map +1 -0
- package/dist/esm/Config/SettingText.js +39 -0
- package/dist/esm/Config/SettingText.js.map +1 -0
- package/dist/esm/DataChannel/DataChannelController.js +103 -0
- package/dist/esm/DataChannel/DataChannelController.js.map +1 -0
- package/dist/esm/DataChannel/DataChannelLatencyTestController.js +91 -0
- package/dist/esm/DataChannel/DataChannelLatencyTestController.js.map +1 -0
- package/dist/esm/DataChannel/DataChannelLatencyTestResults.js +15 -0
- package/dist/esm/DataChannel/DataChannelLatencyTestResults.js.map +1 -0
- package/dist/esm/DataChannel/DataChannelSender.js +40 -0
- package/dist/esm/DataChannel/DataChannelSender.js.map +1 -0
- package/dist/esm/DataChannel/InitialSettings.js +35 -0
- package/dist/esm/DataChannel/InitialSettings.js.map +1 -0
- package/dist/esm/DataChannel/LatencyTestResults.js +57 -0
- package/dist/esm/DataChannel/LatencyTestResults.js.map +1 -0
- package/dist/esm/FreezeFrame/FreezeFrame.js +90 -0
- package/dist/esm/FreezeFrame/FreezeFrame.js.map +1 -0
- package/dist/esm/FreezeFrame/FreezeFrameController.js +92 -0
- package/dist/esm/FreezeFrame/FreezeFrameController.js.map +1 -0
- package/dist/esm/Inputs/GamepadController.js +185 -0
- package/dist/esm/Inputs/GamepadController.js.map +1 -0
- package/dist/esm/Inputs/GamepadTypes.js +18 -0
- package/dist/esm/Inputs/GamepadTypes.js.map +1 -0
- package/dist/esm/Inputs/IInputController.js +2 -0
- package/dist/esm/Inputs/IInputController.js.map +1 -0
- package/dist/esm/Inputs/InputClassesFactory.js +92 -0
- package/dist/esm/Inputs/InputClassesFactory.js.map +1 -0
- package/dist/esm/Inputs/KeyCodes.js +110 -0
- package/dist/esm/Inputs/KeyCodes.js.map +1 -0
- package/dist/esm/Inputs/KeyboardController.js +134 -0
- package/dist/esm/Inputs/KeyboardController.js.map +1 -0
- package/dist/esm/Inputs/MouseButtons.js +24 -0
- package/dist/esm/Inputs/MouseButtons.js.map +1 -0
- package/dist/esm/Inputs/MouseController.js +94 -0
- package/dist/esm/Inputs/MouseController.js.map +1 -0
- package/dist/esm/Inputs/MouseControllerHovering.js +90 -0
- package/dist/esm/Inputs/MouseControllerHovering.js.map +1 -0
- package/dist/esm/Inputs/MouseControllerLocked.js +150 -0
- package/dist/esm/Inputs/MouseControllerLocked.js.map +1 -0
- package/dist/esm/Inputs/SpecialKeyCodes.js +16 -0
- package/dist/esm/Inputs/SpecialKeyCodes.js.map +1 -0
- package/dist/esm/Inputs/TouchController.js +120 -0
- package/dist/esm/Inputs/TouchController.js.map +1 -0
- package/dist/esm/Inputs/TouchControllerFake.js +88 -0
- package/dist/esm/Inputs/TouchControllerFake.js.map +1 -0
- package/dist/esm/Inputs/XRGamepadController.js +121 -0
- package/dist/esm/Inputs/XRGamepadController.js.map +1 -0
- package/dist/esm/PeerConnectionController/AggregatedStats.js +249 -0
- package/dist/esm/PeerConnectionController/AggregatedStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/CandidatePairStats.js +7 -0
- package/dist/esm/PeerConnectionController/CandidatePairStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/CandidateStat.js +7 -0
- package/dist/esm/PeerConnectionController/CandidateStat.js.map +1 -0
- package/dist/esm/PeerConnectionController/CodecStats.js +7 -0
- package/dist/esm/PeerConnectionController/CodecStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/DataChannelStats.js +7 -0
- package/dist/esm/PeerConnectionController/DataChannelStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/InboundRTPStats.js +17 -0
- package/dist/esm/PeerConnectionController/InboundRTPStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/InboundTrackStats.js +7 -0
- package/dist/esm/PeerConnectionController/InboundTrackStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/OutBoundRTPStats.js +12 -0
- package/dist/esm/PeerConnectionController/OutBoundRTPStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/PeerConnectionController.js +581 -0
- package/dist/esm/PeerConnectionController/PeerConnectionController.js.map +1 -0
- package/dist/esm/PeerConnectionController/SessionStats.js +7 -0
- package/dist/esm/PeerConnectionController/SessionStats.js.map +1 -0
- package/dist/esm/PeerConnectionController/StreamStats.js +7 -0
- package/dist/esm/PeerConnectionController/StreamStats.js.map +1 -0
- package/dist/esm/PixelStreaming/PixelStreaming.js +604 -0
- package/dist/esm/PixelStreaming/PixelStreaming.js.map +1 -0
- package/dist/esm/UI/OnScreenKeyboard.js +79 -0
- package/dist/esm/UI/OnScreenKeyboard.js.map +1 -0
- package/dist/esm/UeInstanceMessage/ResponseController.js +35 -0
- package/dist/esm/UeInstanceMessage/ResponseController.js.map +1 -0
- package/dist/esm/UeInstanceMessage/SendMessageController.js +117 -0
- package/dist/esm/UeInstanceMessage/SendMessageController.js.map +1 -0
- package/dist/esm/UeInstanceMessage/StreamMessageController.js +206 -0
- package/dist/esm/UeInstanceMessage/StreamMessageController.js.map +1 -0
- package/dist/esm/UeInstanceMessage/ToStreamerMessagesController.js +46 -0
- package/dist/esm/UeInstanceMessage/ToStreamerMessagesController.js.map +1 -0
- package/dist/esm/Util/EventEmitter.js +346 -0
- package/dist/esm/Util/EventEmitter.js.map +1 -0
- package/dist/esm/Util/FileUtil.js +104 -0
- package/dist/esm/Util/FileUtil.js.map +1 -0
- package/dist/esm/Util/IURLSearchParams.js +22 -0
- package/dist/esm/Util/IURLSearchParams.js.map +1 -0
- package/dist/esm/Util/InputCoordTranslator.js +46 -0
- package/dist/esm/Util/InputCoordTranslator.js.map +1 -0
- package/dist/esm/Util/RTCUtils.js +37 -0
- package/dist/esm/Util/RTCUtils.js.map +1 -0
- package/dist/esm/VideoPlayer/StreamController.js +64 -0
- package/dist/esm/VideoPlayer/StreamController.js.map +1 -0
- package/dist/esm/VideoPlayer/VideoPlayer.js +174 -0
- package/dist/esm/VideoPlayer/VideoPlayer.js.map +1 -0
- package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js +1220 -0
- package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js.map +1 -0
- package/dist/esm/WebXR/WebXRController.js +357 -0
- package/dist/esm/WebXR/WebXRController.js.map +1 -0
- package/dist/esm/pixelstreamingfrontend.js +25 -0
- package/dist/esm/pixelstreamingfrontend.js.map +1 -0
- package/{types → dist/types}/AFK/AFKController.d.ts +38 -39
- package/{types → dist/types}/Config/Config.d.ts +220 -219
- package/{types → dist/types}/Config/SettingBase.d.ts +43 -30
- package/{types → dist/types}/Config/SettingFlag.d.ts +24 -33
- package/{types → dist/types}/Config/SettingNumber.d.ts +41 -45
- package/{types → dist/types}/Config/SettingOption.d.ts +41 -43
- package/{types → dist/types}/Config/SettingText.d.ts +21 -29
- package/{types → dist/types}/DataChannel/DataChannelController.d.ts +59 -59
- package/{types → dist/types}/DataChannel/DataChannelLatencyTestController.d.ts +25 -26
- package/{types → dist/types}/DataChannel/DataChannelLatencyTestResults.d.ts +46 -46
- package/{types → dist/types}/DataChannel/DataChannelSender.d.ts +21 -21
- package/{types → dist/types}/DataChannel/InitialSettings.d.ts +44 -44
- package/{types → dist/types}/DataChannel/LatencyTestResults.d.ts +31 -31
- package/{types → dist/types}/FreezeFrame/FreezeFrame.d.ts +36 -36
- package/{types → dist/types}/FreezeFrame/FreezeFrameController.d.ts +37 -37
- package/dist/types/Inputs/GamepadController.d.ts +61 -0
- package/dist/types/Inputs/GamepadTypes.d.ts +15 -0
- package/dist/types/Inputs/IInputController.d.ts +16 -0
- package/{types → dist/types}/Inputs/InputClassesFactory.d.ts +53 -54
- package/dist/types/Inputs/KeyCodes.d.ts +5 -0
- package/dist/types/Inputs/KeyboardController.d.ts +34 -0
- package/{types → dist/types}/Inputs/MouseButtons.d.ts +22 -22
- package/dist/types/Inputs/MouseController.d.ts +40 -0
- package/dist/types/Inputs/MouseControllerHovering.d.ts +26 -0
- package/dist/types/Inputs/MouseControllerLocked.d.ts +31 -0
- package/{types → dist/types}/Inputs/SpecialKeyCodes.d.ts +14 -14
- package/dist/types/Inputs/TouchController.d.ts +28 -0
- package/dist/types/Inputs/TouchControllerFake.d.ts +29 -0
- package/{types → dist/types}/Inputs/XRGamepadController.d.ts +15 -22
- package/{types → dist/types}/PeerConnectionController/AggregatedStats.d.ts +82 -84
- package/{types → dist/types}/PeerConnectionController/CandidatePairStats.d.ts +22 -22
- package/{types → dist/types}/PeerConnectionController/CandidateStat.d.ts +13 -13
- package/{types → dist/types}/PeerConnectionController/CodecStats.d.ts +14 -14
- package/{types → dist/types}/PeerConnectionController/DataChannelStats.d.ts +15 -15
- package/{types → dist/types}/PeerConnectionController/InboundRTPStats.d.ts +141 -141
- package/{types → dist/types}/PeerConnectionController/InboundTrackStats.d.ts +32 -32
- package/{types → dist/types}/PeerConnectionController/OutBoundRTPStats.d.ts +23 -23
- package/{types → dist/types}/PeerConnectionController/PeerConnectionController.d.ts +143 -140
- package/{types → dist/types}/PeerConnectionController/SessionStats.d.ts +8 -8
- package/{types → dist/types}/PeerConnectionController/StreamStats.d.ts +9 -9
- package/{types → dist/types}/PixelStreaming/PixelStreaming.d.ts +271 -259
- package/{types → dist/types}/UI/OnScreenKeyboard.d.ts +30 -30
- package/{types → dist/types}/UeInstanceMessage/ResponseController.d.ts +19 -19
- package/{types → dist/types}/UeInstanceMessage/SendMessageController.d.ts +18 -18
- package/{types → dist/types}/UeInstanceMessage/StreamMessageController.d.ts +29 -29
- package/{types → dist/types}/UeInstanceMessage/ToStreamerMessagesController.d.ts +32 -32
- package/{types → dist/types}/Util/EventEmitter.d.ts +429 -429
- package/{types → dist/types}/Util/FileUtil.d.ts +32 -32
- package/dist/types/Util/IURLSearchParams.d.ts +9 -0
- package/dist/types/Util/InputCoordTranslator.d.ts +29 -0
- package/{types → dist/types}/Util/RTCUtils.d.ts +8 -8
- package/{types → dist/types}/VideoPlayer/StreamController.d.ts +22 -24
- package/{types → dist/types}/VideoPlayer/VideoPlayer.d.ts +78 -78
- package/{types → dist/types}/WebRtcPlayer/WebRtcPlayerController.d.ts +379 -377
- package/{types → dist/types}/WebXR/WebXRController.d.ts +42 -42
- package/{types → dist/types}/pixelstreamingfrontend.d.ts +23 -22
- package/package.json +14 -17
- package/readme.md +9 -1
- package/src/AFK/AFKController.ts +10 -32
- package/src/Config/Config.ts +232 -205
- package/src/Config/SettingBase.ts +61 -2
- package/src/Config/SettingFlag.ts +10 -48
- package/src/Config/SettingNumber.ts +23 -33
- package/src/Config/SettingOption.ts +41 -56
- package/src/Config/SettingText.ts +9 -37
- package/src/DataChannel/DataChannelController.ts +6 -26
- package/src/DataChannel/DataChannelLatencyTestController.ts +43 -38
- package/src/DataChannel/DataChannelLatencyTestResults.ts +8 -10
- package/src/DataChannel/DataChannelSender.ts +5 -15
- package/src/DataChannel/LatencyTestResults.ts +5 -15
- package/src/FreezeFrame/FreezeFrame.ts +7 -19
- package/src/FreezeFrame/FreezeFrameController.ts +3 -14
- package/src/Inputs/GamepadController.ts +123 -221
- package/src/Inputs/GamepadTypes.ts +23 -0
- package/src/Inputs/IInputController.ts +17 -0
- package/src/Inputs/InputClassesFactory.ts +38 -45
- package/src/Inputs/KeyCodes.ts +114 -0
- package/src/Inputs/KeyboardController.ts +49 -232
- package/src/Inputs/MouseController.ts +71 -297
- package/src/Inputs/MouseControllerHovering.ts +118 -0
- package/src/Inputs/MouseControllerLocked.ts +194 -0
- package/src/Inputs/TouchController.ts +49 -105
- package/src/Inputs/TouchControllerFake.ts +132 -0
- package/src/Inputs/XRGamepadController.ts +35 -44
- package/src/PeerConnectionController/AggregatedStats.ts +46 -75
- package/src/PeerConnectionController/CandidatePairStats.ts +1 -1
- package/src/PeerConnectionController/CandidateStat.ts +1 -1
- package/src/PeerConnectionController/PeerConnectionController.ts +214 -170
- package/src/PixelStreaming/PixelStreaming.ts +174 -226
- package/src/UI/OnScreenKeyboard.ts +14 -9
- package/src/UeInstanceMessage/ResponseController.ts +6 -15
- package/src/UeInstanceMessage/SendMessageController.ts +16 -18
- package/src/UeInstanceMessage/StreamMessageController.ts +3 -12
- package/src/UeInstanceMessage/ToStreamerMessagesController.ts +3 -9
- package/src/Util/EventEmitter.ts +17 -22
- package/src/Util/FileUtil.ts +11 -34
- package/src/Util/IURLSearchParams.ts +25 -0
- package/src/Util/InputCoordTranslator.ts +73 -0
- package/src/Util/RTCUtils.ts +23 -15
- package/src/VideoPlayer/StreamController.ts +6 -23
- package/src/VideoPlayer/VideoPlayer.ts +9 -30
- package/src/WebRtcPlayer/WebRtcPlayerController.ts +328 -690
- package/src/WebXR/WebXRController.ts +82 -94
- package/src/pixelstreamingfrontend.ts +8 -6
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +4 -6
- package/dist/lib-pixelstreamingfrontend.esm.js +0 -1
- package/dist/lib-pixelstreamingfrontend.js +0 -1
- package/src/Inputs/FakeTouchController.ts +0 -199
- package/src/Inputs/HoveringMouseEvents.ts +0 -192
- package/src/Inputs/IMouseEvents.ts +0 -64
- package/src/Inputs/ITouchController.ts +0 -29
- package/src/Inputs/LockedMouseEvents.ts +0 -287
- package/src/Util/CoordinateConverter.ts +0 -290
- package/src/Util/EventListenerTracker.ts +0 -29
- package/types/Inputs/FakeTouchController.d.ts +0 -61
- package/types/Inputs/GamepadController.d.ts +0 -85
- package/types/Inputs/GamepadTypes.d.ts +0 -8
- package/types/Inputs/HoveringMouseEvents.d.ts +0 -56
- package/types/Inputs/IMouseEvents.d.ts +0 -53
- package/types/Inputs/ITouchController.d.ts +0 -24
- package/types/Inputs/KeyboardController.d.ts +0 -62
- package/types/Inputs/LockedMouseEvents.d.ts +0 -80
- package/types/Inputs/MouseController.d.ts +0 -75
- package/types/Inputs/TouchController.d.ts +0 -53
- package/types/Util/CoordinateConverter.d.ts +0 -100
- package/types/Util/EventListenerTracker.d.ts +0 -14
- package/webpack.common.js +0 -35
- package/webpack.dev.js +0 -35
- package/webpack.prod.js +0 -36
|
@@ -5,6 +5,7 @@ import { Config, OptionParameters, Flags } from '../Config/Config';
|
|
|
5
5
|
import { AggregatedStats } from './AggregatedStats';
|
|
6
6
|
import { parseRtpParameters, splitSections } from 'sdp';
|
|
7
7
|
import { RTCUtils } from '../Util/RTCUtils';
|
|
8
|
+
import { CodecStats } from './CodecStats';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Handles the Peer Connection
|
|
@@ -23,11 +24,7 @@ export class PeerConnectionController {
|
|
|
23
24
|
* @param options - Peer connection Options
|
|
24
25
|
* @param config - The config for our PS experience.
|
|
25
26
|
*/
|
|
26
|
-
constructor(
|
|
27
|
-
options: RTCConfiguration,
|
|
28
|
-
config: Config,
|
|
29
|
-
preferredCodec: string
|
|
30
|
-
) {
|
|
27
|
+
constructor(options: RTCConfiguration, config: Config, preferredCodec: string) {
|
|
31
28
|
this.config = config;
|
|
32
29
|
this.createPeerConnection(options, preferredCodec);
|
|
33
30
|
}
|
|
@@ -36,26 +33,18 @@ export class PeerConnectionController {
|
|
|
36
33
|
// Set the ICE transport to relay if TURN enabled
|
|
37
34
|
if (this.config.isFlagEnabled(Flags.ForceTURN)) {
|
|
38
35
|
options.iceTransportPolicy = 'relay';
|
|
39
|
-
Logger.
|
|
40
|
-
Logger.GetStackTrace(),
|
|
41
|
-
'Forcing TURN usage by setting ICE Transport Policy in peer connection config.'
|
|
42
|
-
);
|
|
36
|
+
Logger.Info('Forcing TURN usage by setting ICE Transport Policy in peer connection config.');
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
// build a new peer connection with the options
|
|
46
40
|
this.peerConnection = new RTCPeerConnection(options);
|
|
47
|
-
this.peerConnection.onsignalingstatechange = (ev: Event) =>
|
|
48
|
-
this.handleSignalStateChange(ev);
|
|
41
|
+
this.peerConnection.onsignalingstatechange = (ev: Event) => this.handleSignalStateChange(ev);
|
|
49
42
|
this.peerConnection.oniceconnectionstatechange = (ev: Event) =>
|
|
50
43
|
this.handleIceConnectionStateChange(ev);
|
|
51
|
-
this.peerConnection.onicegatheringstatechange = (ev: Event) =>
|
|
52
|
-
|
|
53
|
-
this.peerConnection.
|
|
54
|
-
|
|
55
|
-
this.peerConnection.onicecandidate = (ev: RTCPeerConnectionIceEvent) =>
|
|
56
|
-
this.handleIceCandidate(ev);
|
|
57
|
-
this.peerConnection.ondatachannel = (ev: RTCDataChannelEvent) =>
|
|
58
|
-
this.handleDataChannel(ev);
|
|
44
|
+
this.peerConnection.onicegatheringstatechange = (ev: Event) => this.handleIceGatheringStateChange(ev);
|
|
45
|
+
this.peerConnection.ontrack = (ev: RTCTrackEvent) => this.handleOnTrack(ev);
|
|
46
|
+
this.peerConnection.onicecandidate = (ev: RTCPeerConnectionIceEvent) => this.handleIceCandidate(ev);
|
|
47
|
+
this.peerConnection.ondatachannel = (ev: RTCDataChannelEvent) => this.handleDataChannel(ev);
|
|
59
48
|
this.aggregatedStats = new AggregatedStats();
|
|
60
49
|
this.preferredCodec = preferredCodec;
|
|
61
50
|
this.updateCodecSelection = true;
|
|
@@ -66,26 +55,24 @@ export class PeerConnectionController {
|
|
|
66
55
|
* @param offerOptions - RTC Offer Options
|
|
67
56
|
*/
|
|
68
57
|
async createOffer(offerOptions: RTCOfferOptions, config: Config) {
|
|
69
|
-
Logger.
|
|
58
|
+
Logger.Info('Create Offer');
|
|
70
59
|
|
|
71
|
-
const isLocalhostConnection =
|
|
72
|
-
location.hostname === 'localhost' ||
|
|
73
|
-
location.hostname === '127.0.0.1';
|
|
60
|
+
const isLocalhostConnection = location.hostname === 'localhost' || location.hostname === '127.0.0.1';
|
|
74
61
|
const isHttpsConnection = location.protocol === 'https:';
|
|
75
62
|
let useMic = config.isFlagEnabled(Flags.UseMic);
|
|
76
|
-
|
|
63
|
+
let useCamera = config.isFlagEnabled(Flags.UseCamera);
|
|
64
|
+
if ((useMic || useCamera) && !(isLocalhostConnection || isHttpsConnection)) {
|
|
77
65
|
useMic = false;
|
|
66
|
+
useCamera = false;
|
|
78
67
|
Logger.Error(
|
|
79
|
-
|
|
80
|
-
'Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access.'
|
|
68
|
+
'Microphone and Webcam access in the browser will not work if you are not on HTTPS or localhost. Disabling mic and webcam access.'
|
|
81
69
|
);
|
|
82
70
|
Logger.Error(
|
|
83
|
-
Logger.GetStackTrace(),
|
|
84
71
|
"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'"
|
|
85
72
|
);
|
|
86
73
|
}
|
|
87
74
|
|
|
88
|
-
this.setupTransceiversAsync(useMic).finally(() => {
|
|
75
|
+
this.setupTransceiversAsync(useMic, useCamera).finally(() => {
|
|
89
76
|
this.peerConnection
|
|
90
77
|
?.createOffer(offerOptions)
|
|
91
78
|
.then((offer: RTCSessionDescriptionInit) => {
|
|
@@ -104,31 +91,32 @@ export class PeerConnectionController {
|
|
|
104
91
|
*
|
|
105
92
|
*/
|
|
106
93
|
async receiveOffer(offer: RTCSessionDescriptionInit, config: Config) {
|
|
107
|
-
|
|
108
|
-
Logger.Log(Logger.GetStackTrace(), 'Receive Offer', 6);
|
|
94
|
+
Logger.Info('Receive Offer');
|
|
109
95
|
|
|
110
96
|
this.peerConnection?.setRemoteDescription(offer).then(() => {
|
|
111
97
|
const isLocalhostConnection =
|
|
112
|
-
location.hostname === 'localhost' ||
|
|
113
|
-
location.hostname === '127.0.0.1';
|
|
98
|
+
location.hostname === 'localhost' || location.hostname === '127.0.0.1';
|
|
114
99
|
const isHttpsConnection = location.protocol === 'https:';
|
|
115
100
|
let useMic = config.isFlagEnabled(Flags.UseMic);
|
|
116
|
-
|
|
101
|
+
let useCamera = config.isFlagEnabled(Flags.UseCamera);
|
|
102
|
+
if ((useMic || useCamera) && !(isLocalhostConnection || isHttpsConnection)) {
|
|
117
103
|
useMic = false;
|
|
104
|
+
useCamera = false;
|
|
118
105
|
Logger.Error(
|
|
119
|
-
|
|
120
|
-
'Microphone access in the browser will not work if you are not on HTTPS or localhost. Disabling mic access.'
|
|
106
|
+
'Microphone and Webcam access in the browser will not work if you are not on HTTPS or localhost. Disabling mic and webcam access.'
|
|
121
107
|
);
|
|
122
108
|
Logger.Error(
|
|
123
|
-
Logger.GetStackTrace(),
|
|
124
109
|
"For testing you can enable HTTP microphone access Chrome by visiting chrome://flags/ and enabling 'unsafely-treat-insecure-origin-as-secure'"
|
|
125
110
|
);
|
|
126
111
|
}
|
|
127
112
|
|
|
128
113
|
// Add our list of preferred codecs, in order of preference
|
|
129
|
-
this.config.setOptionSettingOptions(
|
|
114
|
+
this.config.setOptionSettingOptions(
|
|
115
|
+
OptionParameters.PreferredCodec,
|
|
116
|
+
this.fuzzyIntersectUEAndBrowserCodecs(offer)
|
|
117
|
+
);
|
|
130
118
|
|
|
131
|
-
this.setupTransceiversAsync(useMic).finally(() => {
|
|
119
|
+
this.setupTransceiversAsync(useMic, useCamera).finally(() => {
|
|
132
120
|
this.peerConnection
|
|
133
121
|
?.createAnswer()
|
|
134
122
|
.then((Answer: RTCSessionDescriptionInit) => {
|
|
@@ -136,21 +124,16 @@ export class PeerConnectionController {
|
|
|
136
124
|
return this.peerConnection?.setLocalDescription(Answer);
|
|
137
125
|
})
|
|
138
126
|
.then(() => {
|
|
139
|
-
this.onSendWebRTCAnswer(
|
|
140
|
-
this.peerConnection?.currentLocalDescription
|
|
141
|
-
);
|
|
127
|
+
this.onSendWebRTCAnswer(this.peerConnection?.currentLocalDescription);
|
|
142
128
|
})
|
|
143
129
|
.catch(() => {
|
|
144
|
-
Logger.Error(
|
|
145
|
-
Logger.GetStackTrace(),
|
|
146
|
-
'createAnswer() failed'
|
|
147
|
-
);
|
|
130
|
+
Logger.Error('createAnswer() failed');
|
|
148
131
|
});
|
|
149
132
|
});
|
|
150
133
|
});
|
|
151
134
|
}
|
|
152
135
|
|
|
153
|
-
|
|
136
|
+
/**
|
|
154
137
|
* Set the Remote Descriptor from the signaling server to the RTC Peer Connection
|
|
155
138
|
* @param answer - RTC Session Descriptor from the Signaling Server
|
|
156
139
|
*/
|
|
@@ -158,30 +141,59 @@ export class PeerConnectionController {
|
|
|
158
141
|
this.peerConnection?.setRemoteDescription(answer);
|
|
159
142
|
|
|
160
143
|
// Add our list of preferred codecs, in order of preference
|
|
161
|
-
this.config.setOptionSettingOptions(
|
|
144
|
+
this.config.setOptionSettingOptions(
|
|
145
|
+
OptionParameters.PreferredCodec,
|
|
146
|
+
this.fuzzyIntersectUEAndBrowserCodecs(answer)
|
|
147
|
+
);
|
|
162
148
|
}
|
|
163
149
|
|
|
164
150
|
/**
|
|
165
151
|
* Generate Aggregated Stats and then fire a onVideo Stats event
|
|
166
152
|
*/
|
|
167
153
|
generateStats() {
|
|
168
|
-
const
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const videoPromise = this.
|
|
154
|
+
const audioPromise = this.audioTrack
|
|
155
|
+
? this.peerConnection?.getStats(this.audioTrack).then((statsData: RTCStatsReport) => {
|
|
156
|
+
this.aggregatedStats.processStats(statsData);
|
|
157
|
+
})
|
|
158
|
+
: Promise.resolve();
|
|
159
|
+
const videoPromise = this.videoTrack
|
|
160
|
+
? this.peerConnection?.getStats(this.videoTrack).then((statsData: RTCStatsReport) => {
|
|
161
|
+
this.aggregatedStats.processStats(statsData);
|
|
162
|
+
})
|
|
163
|
+
: Promise.resolve();
|
|
174
164
|
|
|
175
165
|
Promise.allSettled([audioPromise, videoPromise]).then(() => {
|
|
176
166
|
this.onVideoStats(this.aggregatedStats);
|
|
177
167
|
// Update the preferred codec selection based on what was actually negotiated
|
|
178
168
|
if (this.updateCodecSelection && !!this.aggregatedStats.inboundVideoStats.codecId) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.aggregatedStats.
|
|
182
|
-
|
|
183
|
-
|
|
169
|
+
// Construct the qualified codec name from the mimetype and fmtp
|
|
170
|
+
const codecStats: CodecStats = this.aggregatedStats.codecs.get(
|
|
171
|
+
this.aggregatedStats.inboundVideoStats.codecId
|
|
172
|
+
);
|
|
173
|
+
const codecShortname = codecStats.mimeType.replace('video/', '');
|
|
174
|
+
let fullCodecName = codecShortname;
|
|
175
|
+
if (codecStats.sdpFmtpLine && codecStats.sdpFmtpLine.trim() !== '') {
|
|
176
|
+
fullCodecName = `${codecShortname} ${codecStats.sdpFmtpLine.trim()}`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const allBrowserCodecs: string[] = this.config.getSettingOption(
|
|
180
|
+
OptionParameters.PreferredCodec
|
|
181
|
+
).options;
|
|
182
|
+
|
|
183
|
+
// The list of codecs directly contains the one that was negotiated, select that
|
|
184
|
+
if (allBrowserCodecs.includes(fullCodecName)) {
|
|
185
|
+
this.config.setOptionSettingValue(OptionParameters.PreferredCodec, fullCodecName);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// If we couldn't match on the full name, try to match on just the codec shortname
|
|
190
|
+
const filteredList = allBrowserCodecs.filter(
|
|
191
|
+
(option: string) => option.indexOf(codecShortname) !== -1
|
|
184
192
|
);
|
|
193
|
+
if (filteredList.length > 0) {
|
|
194
|
+
this.config.setOptionSettingValue(OptionParameters.PreferredCodec, filteredList[0]);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
185
197
|
}
|
|
186
198
|
});
|
|
187
199
|
}
|
|
@@ -217,9 +229,7 @@ export class PeerConnectionController {
|
|
|
217
229
|
}
|
|
218
230
|
|
|
219
231
|
// Force mono or stereo based on whether ?forceMono was passed or not
|
|
220
|
-
audioSDP += this.config.isFlagEnabled(Flags.ForceMonoAudio)
|
|
221
|
-
? 'stereo=0;'
|
|
222
|
-
: 'stereo=1;';
|
|
232
|
+
audioSDP += this.config.isFlagEnabled(Flags.ForceMonoAudio) ? 'stereo=0;' : 'stereo=1;';
|
|
223
233
|
|
|
224
234
|
// enable in-band forward error correction for opus audio
|
|
225
235
|
audioSDP += 'useinbandfec=1';
|
|
@@ -235,16 +245,14 @@ export class PeerConnectionController {
|
|
|
235
245
|
* @param iceCandidate - RTC Ice Candidate from the Signaling Server
|
|
236
246
|
*/
|
|
237
247
|
handleOnIce(iceCandidate: RTCIceCandidate) {
|
|
238
|
-
Logger.
|
|
248
|
+
Logger.Info('peerconnection handleOnIce');
|
|
239
249
|
|
|
240
250
|
// // if forcing TURN, reject any candidates not relay
|
|
241
251
|
if (this.config.isFlagEnabled(Flags.ForceTURN)) {
|
|
242
252
|
// check if no relay address is found, if so, we are assuming it means no TURN server
|
|
243
253
|
if (iceCandidate.candidate.indexOf('relay') < 0) {
|
|
244
254
|
Logger.Info(
|
|
245
|
-
|
|
246
|
-
`Dropping candidate because it was not TURN relay. | Type= ${iceCandidate.type} | Protocol= ${iceCandidate.protocol} | Address=${iceCandidate.address} | Port=${iceCandidate.port} |`,
|
|
247
|
-
6
|
|
255
|
+
`Dropping candidate because it was not TURN relay. | Type= ${iceCandidate.type} | Protocol= ${iceCandidate.protocol} | Address=${iceCandidate.address} | Port=${iceCandidate.port} |`
|
|
248
256
|
);
|
|
249
257
|
return;
|
|
250
258
|
}
|
|
@@ -258,11 +266,7 @@ export class PeerConnectionController {
|
|
|
258
266
|
* @param state - Signaling Server State Change Event
|
|
259
267
|
*/
|
|
260
268
|
handleSignalStateChange(state: Event) {
|
|
261
|
-
Logger.
|
|
262
|
-
Logger.GetStackTrace(),
|
|
263
|
-
'signaling state change: ' + state,
|
|
264
|
-
6
|
|
265
|
-
);
|
|
269
|
+
Logger.Info('signaling state change: ' + state);
|
|
266
270
|
}
|
|
267
271
|
|
|
268
272
|
/**
|
|
@@ -270,11 +274,7 @@ export class PeerConnectionController {
|
|
|
270
274
|
* @param state - Ice Connection State
|
|
271
275
|
*/
|
|
272
276
|
handleIceConnectionStateChange(state: Event) {
|
|
273
|
-
Logger.
|
|
274
|
-
Logger.GetStackTrace(),
|
|
275
|
-
'ice connection state change: ' + state,
|
|
276
|
-
6
|
|
277
|
-
);
|
|
277
|
+
Logger.Info('ice connection state change: ' + state);
|
|
278
278
|
this.onIceConnectionStateChange(state);
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -283,11 +283,7 @@ export class PeerConnectionController {
|
|
|
283
283
|
* @param state - Ice Gathering State Change
|
|
284
284
|
*/
|
|
285
285
|
handleIceGatheringStateChange(state: Event) {
|
|
286
|
-
Logger.
|
|
287
|
-
Logger.GetStackTrace(),
|
|
288
|
-
'ice gathering state change: ' + JSON.stringify(state),
|
|
289
|
-
6
|
|
290
|
-
);
|
|
286
|
+
Logger.Info('ice gathering state change: ' + JSON.stringify(state));
|
|
291
287
|
}
|
|
292
288
|
|
|
293
289
|
/**
|
|
@@ -364,23 +360,25 @@ export class PeerConnectionController {
|
|
|
364
360
|
* @param sdp The remote sdp
|
|
365
361
|
* @returns The intersection between browser supported codecs and ue supported codecs.
|
|
366
362
|
*/
|
|
367
|
-
fuzzyIntersectUEAndBrowserCodecs(sdp: RTCSessionDescriptionInit)
|
|
363
|
+
fuzzyIntersectUEAndBrowserCodecs(sdp: RTCSessionDescriptionInit): string[] {
|
|
368
364
|
// We want to build an array of all supported codecs on both sides
|
|
369
365
|
const allSupportedCodecs: Array<string> = new Array<string>();
|
|
370
366
|
const allUECodecs: string[] = this.parseAvailableCodecs(sdp);
|
|
371
|
-
const allBrowserCodecs: string[] = this.config.getSettingOption(
|
|
372
|
-
|
|
367
|
+
const allBrowserCodecs: string[] = this.config.getSettingOption(
|
|
368
|
+
OptionParameters.PreferredCodec
|
|
369
|
+
).options;
|
|
370
|
+
for (const ueCodec of allUECodecs) {
|
|
373
371
|
// Check if browser codecs directly matches UE codec (with parameters and everything)
|
|
374
|
-
if(allBrowserCodecs.includes(ueCodec)) {
|
|
372
|
+
if (allBrowserCodecs.includes(ueCodec)) {
|
|
375
373
|
allSupportedCodecs.push(ueCodec);
|
|
376
374
|
continue;
|
|
377
375
|
}
|
|
378
376
|
// Otherwise check if browser codec at least contains a match for the UE codec name (without parameters).
|
|
379
377
|
else {
|
|
380
|
-
const ueCodecNameAndParams: string[] = ueCodec.split(
|
|
378
|
+
const ueCodecNameAndParams: string[] = ueCodec.split(' ');
|
|
381
379
|
const ueCodecName = ueCodecNameAndParams[0];
|
|
382
|
-
for(const browserCodec of allBrowserCodecs) {
|
|
383
|
-
if(browserCodec.includes(ueCodecName)) {
|
|
380
|
+
for (const browserCodec of allBrowserCodecs) {
|
|
381
|
+
if (browserCodec.includes(ueCodecName)) {
|
|
384
382
|
// We pass browser codec here as they option contain extra parameters.
|
|
385
383
|
allSupportedCodecs.push(browserCodec);
|
|
386
384
|
break;
|
|
@@ -394,22 +392,31 @@ export class PeerConnectionController {
|
|
|
394
392
|
/**
|
|
395
393
|
* Setup tracks on the RTC Peer Connection
|
|
396
394
|
* @param useMic - is mic in use
|
|
395
|
+
* @param useCamera - is webcam in use
|
|
397
396
|
*/
|
|
398
|
-
async setupTransceiversAsync(useMic: boolean) {
|
|
399
|
-
|
|
400
|
-
// Setup a transceiver for receiving video (if we need to)
|
|
397
|
+
async setupTransceiversAsync(useMic: boolean, useCamera: boolean) {
|
|
401
398
|
let hasVideoReceiver = false;
|
|
402
399
|
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
|
|
403
|
-
if (
|
|
400
|
+
if (
|
|
401
|
+
transceiver &&
|
|
402
|
+
transceiver.receiver &&
|
|
403
|
+
transceiver.receiver.track &&
|
|
404
|
+
transceiver.receiver.track.kind === 'video'
|
|
405
|
+
) {
|
|
404
406
|
hasVideoReceiver = true;
|
|
405
407
|
break;
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
+
|
|
411
|
+
// Setup a transceiver for sending webcam video to UE and receiving video from UE
|
|
412
|
+
if (!useCamera) {
|
|
413
|
+
if (!hasVideoReceiver) {
|
|
414
|
+
this.peerConnection?.addTransceiver('video', { direction: 'recvonly' });
|
|
415
|
+
}
|
|
416
|
+
} else {
|
|
417
|
+
await this.setupVideoSender(hasVideoReceiver);
|
|
410
418
|
}
|
|
411
419
|
|
|
412
|
-
// We can only set preferred codec on Chrome
|
|
413
420
|
if (RTCRtpReceiver.getCapabilities && this.preferredCodec != '') {
|
|
414
421
|
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
|
|
415
422
|
if (
|
|
@@ -419,51 +426,52 @@ export class PeerConnectionController {
|
|
|
419
426
|
transceiver.receiver.track.kind === 'video' &&
|
|
420
427
|
transceiver.setCodecPreferences
|
|
421
428
|
) {
|
|
429
|
+
// Get our preferred codec from the codecs options drop down
|
|
422
430
|
const preferredRTPCodec = this.preferredCodec.split(' ');
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
+
const preferredRTCRtpCodecCapability: RTCRtpCodecCapability = {
|
|
432
|
+
mimeType: 'video/' + preferredRTPCodec[0] /* Name */,
|
|
433
|
+
clockRate: 90000 /* All current video formats in browsers have 90khz clock rate */,
|
|
434
|
+
sdpFmtpLine: preferredRTPCodec[1] ? preferredRTPCodec[1] : ''
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// Populate a list of codecs we will support with our preferred one in the first position
|
|
438
|
+
const ourSupportedCodecs: Array<RTCRtpCodecCapability> = [preferredRTCRtpCodecCapability];
|
|
439
|
+
|
|
440
|
+
// Go through all codecs the browser supports and add them to the list (in any order)
|
|
441
|
+
RTCRtpReceiver.getCapabilities('video').codecs.forEach(
|
|
442
|
+
(browserSupportedCodec: RTCRtpCodecCapability) => {
|
|
443
|
+
// Don't add our preferred codec again, but add everything else
|
|
444
|
+
if (browserSupportedCodec.mimeType != preferredRTCRtpCodecCapability.mimeType) {
|
|
445
|
+
ourSupportedCodecs.push(browserSupportedCodec);
|
|
446
|
+
} else if (
|
|
447
|
+
browserSupportedCodec?.sdpFmtpLine !=
|
|
448
|
+
preferredRTCRtpCodecCapability?.sdpFmtpLine
|
|
449
|
+
) {
|
|
450
|
+
ourSupportedCodecs.push(browserSupportedCodec);
|
|
451
|
+
}
|
|
431
452
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
this.config
|
|
435
|
-
.getSettingOption(OptionParameters.PreferredCodec)
|
|
436
|
-
.options.filter((option) => {
|
|
437
|
-
// Remove the preferred codec from the list of possible codecs as we've set it already
|
|
438
|
-
return option != this.preferredCodec;
|
|
439
|
-
})
|
|
440
|
-
.forEach((option) => {
|
|
441
|
-
// Amend the rest of the browsers supported codecs
|
|
442
|
-
const altCodec = option.split(' ');
|
|
443
|
-
codecs.push({
|
|
444
|
-
mimeType: 'video/' + altCodec[0] /* Name */,
|
|
445
|
-
clockRate: 90000,
|
|
446
|
-
sdpFmtpLine: altCodec[1] /* sdpFmtpLine */
|
|
447
|
-
? altCodec[1]
|
|
448
|
-
: ''
|
|
449
|
-
});
|
|
450
|
-
});
|
|
453
|
+
);
|
|
451
454
|
|
|
452
|
-
for (const codec of
|
|
453
|
-
if (codec.sdpFmtpLine === '') {
|
|
455
|
+
for (const codec of ourSupportedCodecs) {
|
|
456
|
+
if (codec?.sdpFmtpLine === undefined || codec.sdpFmtpLine === '') {
|
|
454
457
|
// We can't dynamically add members to the codec, so instead remove the field if it's empty
|
|
455
458
|
delete codec.sdpFmtpLine;
|
|
456
459
|
}
|
|
457
460
|
}
|
|
458
461
|
|
|
459
|
-
transceiver.setCodecPreferences(
|
|
462
|
+
transceiver.setCodecPreferences(ourSupportedCodecs);
|
|
460
463
|
}
|
|
461
464
|
}
|
|
462
465
|
}
|
|
463
466
|
|
|
464
467
|
let hasAudioReceiver = false;
|
|
465
468
|
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
|
|
466
|
-
if (
|
|
469
|
+
if (
|
|
470
|
+
transceiver &&
|
|
471
|
+
transceiver.receiver &&
|
|
472
|
+
transceiver.receiver.track &&
|
|
473
|
+
transceiver.receiver.track.kind === 'audio'
|
|
474
|
+
) {
|
|
467
475
|
hasAudioReceiver = true;
|
|
468
476
|
break;
|
|
469
477
|
}
|
|
@@ -471,62 +479,101 @@ export class PeerConnectionController {
|
|
|
471
479
|
|
|
472
480
|
// Setup a transceiver for sending mic audio to UE and receiving audio from UE
|
|
473
481
|
if (!useMic) {
|
|
474
|
-
if(!hasAudioReceiver) {
|
|
482
|
+
if (!hasAudioReceiver) {
|
|
475
483
|
this.peerConnection?.addTransceiver('audio', {
|
|
476
484
|
direction: 'recvonly'
|
|
477
485
|
});
|
|
478
486
|
}
|
|
479
487
|
} else {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
channelCount: 1,
|
|
484
|
-
echoCancellation: false,
|
|
485
|
-
latency: 0,
|
|
486
|
-
noiseSuppression: false,
|
|
487
|
-
sampleRate: 48000,
|
|
488
|
-
sampleSize: 16,
|
|
489
|
-
volume: 1.0
|
|
490
|
-
}
|
|
488
|
+
await this.setupAudioSender(hasAudioReceiver);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
491
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
492
|
+
async setupVideoSender(hasVideoReceiver: boolean) {
|
|
493
|
+
// set the media send options
|
|
494
|
+
const mediaSendOptions: MediaStreamConstraints = {
|
|
495
|
+
video: true
|
|
496
|
+
};
|
|
497
497
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
transceiver.direction = 'sendrecv';
|
|
510
|
-
}
|
|
498
|
+
// Note using webcam on android chrome requires SSL or chrome://flags/ "unsafely-treat-insecure-origin-as-secure"
|
|
499
|
+
const stream = await navigator.mediaDevices.getUserMedia(mediaSendOptions);
|
|
500
|
+
|
|
501
|
+
if (stream) {
|
|
502
|
+
if (hasVideoReceiver) {
|
|
503
|
+
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
|
|
504
|
+
if (RTCUtils.canTransceiverReceiveVideo(transceiver)) {
|
|
505
|
+
for (const track of stream.getTracks()) {
|
|
506
|
+
if (track.kind && track.kind == 'video') {
|
|
507
|
+
transceiver.sender.replaceTrack(track);
|
|
508
|
+
transceiver.direction = 'sendrecv';
|
|
511
509
|
}
|
|
512
510
|
}
|
|
513
511
|
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
512
|
+
}
|
|
513
|
+
} else {
|
|
514
|
+
for (const track of stream.getTracks()) {
|
|
515
|
+
if (track.kind && track.kind == 'video') {
|
|
516
|
+
this.peerConnection?.addTransceiver(track, {
|
|
517
|
+
direction: 'sendrecv'
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
if (!hasVideoReceiver) {
|
|
524
|
+
this.peerConnection?.addTransceiver('video', { direction: 'recvonly' });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
async setupAudioSender(hasAudioReceiver: boolean) {
|
|
530
|
+
// set the audio options based on mic usage
|
|
531
|
+
const audioOptions = {
|
|
532
|
+
autoGainControl: false,
|
|
533
|
+
channelCount: 1,
|
|
534
|
+
echoCancellation: false,
|
|
535
|
+
latency: 0,
|
|
536
|
+
noiseSuppression: false,
|
|
537
|
+
sampleRate: 48000,
|
|
538
|
+
sampleSize: 16,
|
|
539
|
+
volume: 1.0
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
// set the media send options
|
|
543
|
+
const mediaSendOptions: MediaStreamConstraints = {
|
|
544
|
+
video: false,
|
|
545
|
+
audio: audioOptions
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
// Note using mic on android chrome requires SSL or chrome://flags/ "unsafely-treat-insecure-origin-as-secure"
|
|
549
|
+
const stream = await navigator.mediaDevices.getUserMedia(mediaSendOptions);
|
|
550
|
+
if (stream) {
|
|
551
|
+
if (hasAudioReceiver) {
|
|
552
|
+
for (const transceiver of this.peerConnection?.getTransceivers() ?? []) {
|
|
553
|
+
if (RTCUtils.canTransceiverReceiveAudio(transceiver)) {
|
|
554
|
+
for (const track of stream.getTracks()) {
|
|
555
|
+
if (track.kind && track.kind == 'audio') {
|
|
556
|
+
transceiver.sender.replaceTrack(track);
|
|
557
|
+
transceiver.direction = 'sendrecv';
|
|
558
|
+
}
|
|
520
559
|
}
|
|
521
560
|
}
|
|
522
561
|
}
|
|
523
562
|
} else {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
563
|
+
for (const track of stream.getTracks()) {
|
|
564
|
+
if (track.kind && track.kind == 'audio') {
|
|
565
|
+
this.peerConnection?.addTransceiver(track, {
|
|
566
|
+
direction: 'sendrecv'
|
|
567
|
+
});
|
|
568
|
+
}
|
|
528
569
|
}
|
|
529
570
|
}
|
|
571
|
+
} else {
|
|
572
|
+
if (!hasAudioReceiver) {
|
|
573
|
+
this.peerConnection?.addTransceiver('audio', {
|
|
574
|
+
direction: 'recvonly'
|
|
575
|
+
});
|
|
576
|
+
}
|
|
530
577
|
}
|
|
531
578
|
}
|
|
532
579
|
|
|
@@ -571,12 +618,9 @@ export class PeerConnectionController {
|
|
|
571
618
|
// Default Functionality: Do Nothing
|
|
572
619
|
}
|
|
573
620
|
|
|
574
|
-
parseAvailableCodecs(
|
|
575
|
-
rtcSessionDescription: RTCSessionDescriptionInit
|
|
576
|
-
): Array<string> {
|
|
621
|
+
parseAvailableCodecs(rtcSessionDescription: RTCSessionDescriptionInit): Array<string> {
|
|
577
622
|
// No point in updating the available codecs if on FF
|
|
578
|
-
if (!RTCRtpReceiver.getCapabilities)
|
|
579
|
-
return ['Only available on Chrome'];
|
|
623
|
+
if (!RTCRtpReceiver.getCapabilities) return ['Only available on Chrome'];
|
|
580
624
|
|
|
581
625
|
const ueSupportedCodecs: Array<string> = [];
|
|
582
626
|
const sections = splitSections(rtcSessionDescription.sdp);
|