@stream-io/video-react-native-sdk 1.45.2 → 1.46.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/dist/commonjs/components/Call/CallContent/CallContent.js +1 -1
  3. package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
  4. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +78 -7
  5. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  6. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +3 -0
  7. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  8. package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js +4 -12
  9. package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
  10. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +27 -4
  11. package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
  12. package/dist/commonjs/index.js +14 -1
  13. package/dist/commonjs/index.js.map +1 -1
  14. package/dist/commonjs/modules/encryption/EncryptionManager.js +305 -0
  15. package/dist/commonjs/modules/encryption/EncryptionManager.js.map +1 -0
  16. package/dist/commonjs/modules/encryption/eventMapping.js +143 -0
  17. package/dist/commonjs/modules/encryption/eventMapping.js.map +1 -0
  18. package/dist/commonjs/modules/encryption/index.js +13 -0
  19. package/dist/commonjs/modules/encryption/index.js.map +1 -0
  20. package/dist/commonjs/modules/encryption/parity.js +6 -0
  21. package/dist/commonjs/modules/encryption/parity.js.map +1 -0
  22. package/dist/commonjs/utils/StreamVideoRN/index.js +23 -0
  23. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  24. package/dist/commonjs/utils/internal/callingx/callingx.js +29 -4
  25. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -1
  26. package/dist/commonjs/utils/internal/iosPipTrack.js +41 -0
  27. package/dist/commonjs/utils/internal/iosPipTrack.js.map +1 -0
  28. package/dist/commonjs/utils/internal/registerSDKGlobals.js +6 -0
  29. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  30. package/dist/commonjs/utils/internal/ringingCallLifecycle.js +142 -0
  31. package/dist/commonjs/utils/internal/ringingCallLifecycle.js.map +1 -0
  32. package/dist/commonjs/utils/push/internal/utils.js +4 -0
  33. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  34. package/dist/commonjs/version.js +1 -1
  35. package/dist/module/components/Call/CallContent/CallContent.js +1 -1
  36. package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
  37. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +80 -9
  38. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  39. package/dist/module/components/Call/CallContent/RTCViewPipNative.js +3 -0
  40. package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  41. package/dist/module/components/Call/RingingCallContent/OutgoingCall.js +4 -12
  42. package/dist/module/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
  43. package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js +28 -5
  44. package/dist/module/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.js.map +1 -1
  45. package/dist/module/index.js +5 -0
  46. package/dist/module/index.js.map +1 -1
  47. package/dist/module/modules/encryption/EncryptionManager.js +301 -0
  48. package/dist/module/modules/encryption/EncryptionManager.js.map +1 -0
  49. package/dist/module/modules/encryption/eventMapping.js +135 -0
  50. package/dist/module/modules/encryption/eventMapping.js.map +1 -0
  51. package/dist/module/modules/encryption/index.js +4 -0
  52. package/dist/module/modules/encryption/index.js.map +1 -0
  53. package/dist/module/modules/encryption/parity.js +4 -0
  54. package/dist/module/modules/encryption/parity.js.map +1 -0
  55. package/dist/module/utils/StreamVideoRN/index.js +23 -0
  56. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  57. package/dist/module/utils/internal/callingx/callingx.js +29 -4
  58. package/dist/module/utils/internal/callingx/callingx.js.map +1 -1
  59. package/dist/module/utils/internal/iosPipTrack.js +35 -0
  60. package/dist/module/utils/internal/iosPipTrack.js.map +1 -0
  61. package/dist/module/utils/internal/registerSDKGlobals.js +6 -0
  62. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  63. package/dist/module/utils/internal/ringingCallLifecycle.js +134 -0
  64. package/dist/module/utils/internal/ringingCallLifecycle.js.map +1 -0
  65. package/dist/module/utils/push/internal/utils.js +4 -0
  66. package/dist/module/utils/push/internal/utils.js.map +1 -1
  67. package/dist/module/version.js +1 -1
  68. package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
  69. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts +12 -0
  70. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
  71. package/dist/typescript/components/Call/RingingCallContent/OutgoingCall.d.ts.map +1 -1
  72. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts +11 -0
  73. package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.d.ts.map +1 -1
  74. package/dist/typescript/index.d.ts +1 -0
  75. package/dist/typescript/index.d.ts.map +1 -1
  76. package/dist/typescript/modules/encryption/EncryptionManager.d.ts +190 -0
  77. package/dist/typescript/modules/encryption/EncryptionManager.d.ts.map +1 -0
  78. package/dist/typescript/modules/encryption/eventMapping.d.ts +38 -0
  79. package/dist/typescript/modules/encryption/eventMapping.d.ts.map +1 -0
  80. package/dist/typescript/modules/encryption/index.d.ts +2 -0
  81. package/dist/typescript/modules/encryption/index.d.ts.map +1 -0
  82. package/dist/typescript/modules/encryption/parity.d.ts +55 -0
  83. package/dist/typescript/modules/encryption/parity.d.ts.map +1 -0
  84. package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -1
  85. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  86. package/dist/typescript/utils/StreamVideoRN/types.d.ts +67 -0
  87. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  88. package/dist/typescript/utils/internal/callingx/callingx.d.ts +1 -1
  89. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -1
  90. package/dist/typescript/utils/internal/iosPipTrack.d.ts +9 -0
  91. package/dist/typescript/utils/internal/iosPipTrack.d.ts.map +1 -0
  92. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  93. package/dist/typescript/utils/internal/ringingCallLifecycle.d.ts +27 -0
  94. package/dist/typescript/utils/internal/ringingCallLifecycle.d.ts.map +1 -0
  95. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  96. package/dist/typescript/version.d.ts +1 -1
  97. package/ios/RTCViewPip.swift +33 -8
  98. package/ios/RTCViewPipManager.mm +1 -0
  99. package/package.json +7 -7
  100. package/src/components/Call/CallContent/CallContent.tsx +1 -1
  101. package/src/components/Call/CallContent/RTCViewPipIOS.tsx +92 -10
  102. package/src/components/Call/CallContent/RTCViewPipNative.tsx +13 -0
  103. package/src/components/Call/RingingCallContent/OutgoingCall.tsx +4 -12
  104. package/src/components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx +58 -5
  105. package/src/index.ts +5 -0
  106. package/src/modules/encryption/EncryptionManager.ts +360 -0
  107. package/src/modules/encryption/eventMapping.ts +151 -0
  108. package/src/modules/encryption/index.ts +1 -0
  109. package/src/modules/encryption/parity.ts +83 -0
  110. package/src/utils/StreamVideoRN/index.ts +24 -1
  111. package/src/utils/StreamVideoRN/types.ts +68 -0
  112. package/src/utils/internal/callingx/callingx.ts +37 -2
  113. package/src/utils/internal/iosPipTrack.ts +39 -0
  114. package/src/utils/internal/registerSDKGlobals.ts +2 -0
  115. package/src/utils/internal/ringingCallLifecycle.ts +148 -0
  116. package/src/utils/push/internal/utils.ts +4 -0
  117. package/src/version.ts +1 -1
@@ -40,6 +40,9 @@ export const RTCViewPipNative = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwa
40
40
  onPiPChange: props.onPiPChange
41
41
  // eslint-disable-next-line react/prop-types
42
42
  ,
43
+ onPiPBoundsChange: props.onPiPBoundsChange
44
+ // eslint-disable-next-line react/prop-types
45
+ ,
43
46
  participantName: props.participantName
44
47
  // eslint-disable-next-line react/prop-types
45
48
  ,
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","requireNativeComponent","StyleSheet","UIManager","videoLoggerSystem","jsx","_jsx","COMPONENT_NAME","NativeComponent","onNativeCallClosed","reactTag","getLogger","debug","commandId","getViewManagerConfig","Commands","onCallClosed","dispatchViewManagerCommand","onNativeDimensionsUpdated","width","height","setPreferredContentSize","RTCViewPipNative","memo","forwardRef","props","ref","OS","style","absoluteFill","pointerEvents","streamURL","mirror","onPiPChange","participantName","participantImageURL","isReconnecting","isScreenSharing","hasAudio","isTrackPaused","isPinned","isSpeaking","connectionQuality"],"sourceRoot":"../../../../../src","sources":["components/Call/CallContent/RTCViewPipNative.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,QAAQ,EACRC,sBAAsB,EACtBC,UAAU,EACVC,SAAS,QACJ,cAAc;AACrB,SAASC,iBAAiB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,MAAMC,cAAc,GAAG,YAAY;AA8BnC,MAAMC,eAAqD,GACzDP,sBAAsB,CAACM,cAAc,CAAC;AAExC,OAAO,SAASE,kBAAkBA,CAACC,QAAgB,EAAE;EACnDN,iBAAiB,CAACO,SAAS,CAAC,kBAAkB,CAAC,CAACC,KAAK,CAAC,oBAAoB,CAAC;EAC3E,MAAMC,SAAS,GACbV,SAAS,CAACW,oBAAoB,CAACP,cAAc,CAAC,CAACQ,QAAQ,CAACC,YAAY;EACtE,IAAI,CAACH,SAAS,EAAE;EAChBV,SAAS,CAACc,0BAA0B,CAACP,QAAQ,EAAEG,SAAS,EAAE,EAAE,CAAC;AAC/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B,KAAK,CAACiB;IACzB;IAAA;IACAhB,GAAG,EAAEA;EAAI,CACV,CAAC;AAEN,CAAC,CACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Platform","requireNativeComponent","StyleSheet","UIManager","videoLoggerSystem","jsx","_jsx","COMPONENT_NAME","NativeComponent","onNativeCallClosed","reactTag","getLogger","debug","commandId","getViewManagerConfig","Commands","onCallClosed","dispatchViewManagerCommand","onNativeDimensionsUpdated","width","height","setPreferredContentSize","RTCViewPipNative","memo","forwardRef","props","ref","OS","style","absoluteFill","pointerEvents","streamURL","mirror","onPiPChange","onPiPBoundsChange","participantName","participantImageURL","isReconnecting","isScreenSharing","hasAudio","isTrackPaused","isPinned","isSpeaking","connectionQuality"],"sourceRoot":"../../../../../src","sources":["components/Call/CallContent/RTCViewPipNative.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,QAAQ,EACRC,sBAAsB,EACtBC,UAAU,EACVC,SAAS,QACJ,cAAc;AACrB,SAASC,iBAAiB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,MAAMC,cAAc,GAAG,YAAY;AAyCnC,MAAMC,eAAqD,GACzDP,sBAAsB,CAACM,cAAc,CAAC;AAExC,OAAO,SAASE,kBAAkBA,CAACC,QAAgB,EAAE;EACnDN,iBAAiB,CAACO,SAAS,CAAC,kBAAkB,CAAC,CAACC,KAAK,CAAC,oBAAoB,CAAC;EAC3E,MAAMC,SAAS,GACbV,SAAS,CAACW,oBAAoB,CAACP,cAAc,CAAC,CAACQ,QAAQ,CAACC,YAAY;EACtE,IAAI,CAACH,SAAS,EAAE;EAChBV,SAAS,CAACc,0BAA0B,CAACP,QAAQ,EAAEG,SAAS,EAAE,EAAE,CAAC;AAC/D;AAEA,OAAO,SAASK,yBAAyBA,CACvCR,QAAgB,EAChBS,KAAa,EACbC,MAAc,EACd;EACAhB,iBAAiB,CACdO,SAAS,CAAC,kBAAkB,CAAC,CA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ACH,CAAC","ignoreList":[]}
@@ -5,9 +5,9 @@ import { StyleSheet, Text, View } from 'react-native';
5
5
  import { UserInfo } from './UserInfo';
6
6
  import { Z_INDEX } from '../../../constants';
7
7
  import { useCallStateHooks, useI18n } from '@stream-io/video-react-bindings';
8
- import { RTCView } from '@stream-io/react-native-webrtc';
9
8
  import { useTheme } from '../../../contexts/ThemeContext';
10
9
  import { OutgoingCallControls as DefaultOutgoingCallControls } from '../CallControls';
10
+ import { LobbyCameraPreview } from '../Lobby';
11
11
 
12
12
  /**
13
13
  * Props for the OutgoingCall Component.
@@ -79,11 +79,9 @@ const Background = () => {
79
79
  useCameraState
80
80
  } = useCallStateHooks();
81
81
  const {
82
- isMute,
83
- camera
82
+ optimisticIsMute
84
83
  } = useCameraState();
85
- const localVideoStream = camera.state.mediaStream;
86
- if (isMute || !localVideoStream) {
84
+ if (optimisticIsMute) {
87
85
  return /*#__PURE__*/_jsx(View, {
88
86
  style: [styles.background, {
89
87
  backgroundColor: colors.sheetSecondary
@@ -94,13 +92,7 @@ const Background = () => {
94
92
  style: [styles.background, {
95
93
  backgroundColor: colors.sheetSecondary
96
94
  }, outgoingCall.background],
97
- children: /*#__PURE__*/_jsx(RTCView, {
98
- streamURL: localVideoStream.toURL(),
99
- zOrder: Z_INDEX.IN_BACK,
100
- style: StyleSheet.absoluteFill,
101
- mirror: true,
102
- objectFit: "cover"
103
- })
95
+ children: /*#__PURE__*/_jsx(LobbyCameraPreview, {})
104
96
  });
105
97
  };
106
98
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"names":["React","StyleSheet","Text","View","UserInfo","Z_INDEX","useCallStateHooks","useI18n","RTCView","useTheme","OutgoingCallControls","DefaultOutgoingCallControls","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","OutgoingCall","onHangupCallHandler","landscape","theme","colors","typefaces","outgoingCall","variants","t","landscapeContentStyles","flexDirection","insetStyles","paddingTop","insets","top","paddingBottom","bottom","paddingLeft","left","paddingRight","right","children","style","absoluteFill","styles","container","content","topContainer","callingText","color","textPrimary","heading6","bottomContainer","outgoingCallControls","Background","useCameraState","isMute","camera","localVideoStream","state","mediaStream","background","backgroundColor","sheetSecondary","streamURL","toURL","zOrder","IN_BACK","mirror","objectFit","create","flex","zIndex","IN_MIDDLE","justifyContent","marginTop","textAlign","alignSelf"],"sourceRoot":"../../../../../src","sources":["components/Call/RingingCallContent/OutgoingCall.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAwB,cAAc;AACrE,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,iBAAiB,EAAEC,OAAO,QAAQ,iCAAiC;AAC5E,SAAsBC,OAAO,QAAQ,gCAAgC;AACrE,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SACEC,oBAAoB,IAAIC,2BAA2B,QAE9C,iBAAiB;;AAExB;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAeA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAAC;EAC3BC,mBAAmB;EACnBT,oBAAoB,GAAGC,2BAA2B;EAClDS;AACiB,CAAC,KAAK;EACvB,MAAM;IACJC,KAAK,EAAE;MAAEC,MAAM;MAAEC,SAAS;MAAEC,YAAY;MAAEC;IAAS;EACrD,CAAC,GAAGhB,QAAQ,CAAC,CAAC;EACd,MAAM;IAAEiB;EAAE,CAAC,GAAGnB,OAAO,CAAC,CAAC;EAEvB,MAAMoB,sBAAiC,GAAG;IACxCC,aAAa,EAAER,SAAS,GAAG,KAAK,GAAG;EACrC,CAAC;EAED,MAAMS,WAAsB,GAAG;IAC7BC,UAAU,EAAEL,QAAQ,CAACM,MAAM,CAACC,GAAG;IAC/BC,aAAa,EAAER,QAAQ,CAACM,MAAM,CAACG,M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B,YAAY,EAAE;IAAEwB,IAAI,EAAE,CAAC;IAAEG,cAAc,EAAE;EAAS,CAAC;EACnD5B,OAAO,EAAE;IACPyB,IAAI,EAAE;EACR,CAAC;EACDvB,WAAW,EAAE;IACX2B,SAAS,EAAE,EAAE;IACbC,SAAS,EAAE;EACb,CAAC;EACDxB,eAAe,EAAE;IAAEmB,IAAI,EAAE,CAAC;IAAEM,SAAS,EAAE,QAAQ;IAAEH,cAAc,EAAE;EAAS,CAAC;EAC3ErB,oBAAoB,EAAE;IACpBqB,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","StyleSheet","Text","View","UserInfo","Z_INDEX","useCallStateHooks","useI18n","useTheme","OutgoingCallControls","DefaultOutgoingCallControls","LobbyCameraPreview","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","OutgoingCall","onHangupCallHandler","landscape","theme","colors","typefaces","outgoingCall","variants","t","landscapeContentStyles","flexDirection","insetStyles","paddingTop","insets","top","paddingBottom","bottom","paddingLeft","left","paddingRight","right","children","style","absoluteFill","styles","container","content","topContainer","callingText","color","textPrimary","heading6","bottomContainer","outgoingCallControls","Background","useCameraState","optimisticIsMute","background","backgroundColor","sheetSecondary","create","flex","zIndex","IN_MIDDLE","justifyContent","marginTop","textAlign","alignSelf"],"sourceRoot":"../../../../../src","sources":["components/Call/RingingCallContent/OutgoingCall.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAwB,cAAc;AACrE,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,iBAAiB,EAAEC,OAAO,QAAQ,iCAAiC;AAC5E,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SACEC,oBAAoB,IAAIC,2BAA2B,QAE9C,iBAAiB;AACxB,SAASC,kBAAkB,QAAQ,UAAU;;AAE7C;AACA;AACA;AAF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ACjB;MAAEC,eAAe,EAAElC,MAAM,CAACmC;IAAe,CAAC,EAC1CjC,YAAY,CAAC+B,UAAU,CACvB;IAAAhB,QAAA,eAEF1B,IAAA,CAACF,kBAAkB,IAAE;EAAC,CAClB,CAAC;AAEX,CAAC;AAED,MAAM+B,MAAM,GAAGzC,UAAU,CAACyD,MAAM,CAAC;EAC/BH,UAAU,EAAE;IACVI,IAAI,EAAE;EACR,CAAC;EACDhB,SAAS,EAAE;IACTiB,MAAM,EAAEvD,OAAO,CAACwD;EAClB,CAAC;EACDhB,YAAY,EAAE;IAAEc,IAAI,EAAE,CAAC;IAAEG,cAAc,EAAE;EAAS,CAAC;EACnDlB,OAAO,EAAE;IACPe,IAAI,EAAE;EACR,CAAC;EACDb,WAAW,EAAE;IACXiB,SAAS,EAAE,EAAE;IACbC,SAAS,EAAE;EACb,CAAC;EACDd,eAAe,EAAE;IAAES,IAAI,EAAE,CAAC;IAAEM,SAAS,EAAE,QAAQ;IAAEH,cAAc,EAAE;EAAS,CAAC;EAC3EX,oBAAoB,EAAE;IACpBW,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import { useEffect } from 'react';
4
+ import { Platform } from 'react-native';
4
5
  import { CallingState, DebounceType, hasScreenShare, hasVideo } from '@stream-io/video-client';
5
- import { combineLatest, distinctUntilChanged, distinctUntilKeyChanged, filter, map } from 'rxjs';
6
+ import { combineLatest, distinctUntilChanged, distinctUntilKeyChanged, filter, map, of } from 'rxjs';
7
+ import { getIosPipTrack$, setIosPipTrack } from '../../../../utils/internal/iosPipTrack';
6
8
  /**
7
9
  * This component is used to subscribe to the video + audio track of the participant in the following cases:
8
10
  * 1. When the participant starts publishing the video track
@@ -13,6 +15,10 @@ import { combineLatest, distinctUntilChanged, distinctUntilKeyChanged, filter, m
13
15
  * This component is used to unsubscribe to video track and subscribe only to the audio track of the participant (by passing undefined dimensions) in the following cases:
14
16
  * 1. When the participant stops publishing the video track
15
17
  * 2. When the participant becomes invisible
18
+ *
19
+ * The same component serves the native iOS Picture in Picture window, which
20
+ * renders one of the tracks too. Its bounds take precedence over the inline
21
+ * views of that track for as long as it is on screen.
16
22
  */
17
23
  const TrackSubscriber = props => {
18
24
  const {
@@ -20,7 +26,8 @@ const TrackSubscriber = props => {
20
26
  participantSessionId,
21
27
  trackType,
22
28
  isVisible,
23
- dimensions$
29
+ dimensions$,
30
+ isPipWriter
24
31
  } = props;
25
32
  useEffect(() => {
26
33
  const requestTrackWithDimensions = (debounceType, dimension) => {
@@ -40,8 +47,18 @@ const TrackSubscriber = props => {
40
47
  };
41
48
  const isPublishingTrack$ = call.state.participants$.pipe(map(ps => ps.find(p => p.sessionId === participantSessionId)), filter(p => !!p), distinctUntilKeyChanged('publishedTracks'), map(p => trackType === 'videoTrack' ? hasVideo(p) : hasScreenShare(p)), distinctUntilChanged());
42
49
  const isJoinedState$ = call.state.callingState$.pipe(map(callingState => callingState === CallingState.JOINED));
43
- const subscription = combineLatest([dimensions$, isPublishingTrack$, isJoinedState$]).subscribe(([dimension, isPublishing, isJoined]) => {
44
- if (isJoined) {
50
+ const trackKey = {
51
+ sessionId: participantSessionId,
52
+ trackType
53
+ };
54
+ const pipTrack$ = Platform.OS === 'ios' ? getIosPipTrack$(call) : undefined;
55
+ if (isPipWriter && pipTrack$) setIosPipTrack(call, trackKey);
56
+ const canWrite$ = pipTrack$ ? pipTrack$.pipe(map(track => {
57
+ const sameTrack = track?.sessionId === participantSessionId && track?.trackType === trackType;
58
+ return isPipWriter ? sameTrack : !sameTrack;
59
+ }), distinctUntilChanged()) : of(true);
60
+ const subscription = combineLatest([dimensions$, isPublishingTrack$, isJoinedState$, canWrite$]).subscribe(([dimension, isPublishing, isJoined, canWrite]) => {
61
+ if (isJoined && canWrite) {
45
62
  if (!isVisible || !isPublishing) {
46
63
  requestTrackWithDimensions(DebounceType.MEDIUM, undefined);
47
64
  } else if (dimension) {
@@ -51,8 +68,14 @@ const TrackSubscriber = props => {
51
68
  });
52
69
  return () => {
53
70
  subscription.unsubscribe();
71
+ if (isPipWriter && pipTrack$) {
72
+ // Let sibling inline views finish unmounting before handing back demand.
73
+ queueMicrotask(() => {
74
+ if (pipTrack$.getValue() === trackKey) setIosPipTrack(call, undefined);
75
+ });
76
+ }
54
77
  };
55
- }, [call, participantSessionId, trackType, isVisible, dimensions$]);
78
+ }, [call, participantSessionId, trackType, isVisible, dimensions$, isPipWriter]);
56
79
  return null;
57
80
  };
58
81
  TrackSubscriber.displayName = 'TrackSubscriber';
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","CallingState","DebounceType","hasScreenShare","hasVideo","combineLatest","distinctUntilChanged","distinctUntilKeyChanged","filter","map","TrackSubscriber","props","call","participantSessionId","trackType","isVisible","dimensions$","requestTrackWithDimensions","debounceType","dimension","width","height","undefined","state","updateParticipantTracks","trackSubscriptionManager","apply","isPublishingTrack$","participants$","pipe","ps","find","p","sessionId","isJoinedState$","callingState$","callingState","JOINED","subscription","subscribe","isPublishing","isJoined","MEDIUM","IMMEDIATE","unsubscribe","displayName"],"sourceRoot":"../../../../../../src","sources":["components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAEEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,QAAQ,QAIH,yBAAyB;AAChC,SAEEC,aAAa,EACbC,oBAAoB,EACpBC,uBAAuB,EACvBC,MAAM,EACNC,GAAG,QACE,MAAM;AAcb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,KAA2B,IAAK;EACvD,MAAM;IAAEC,IAAI;IAAEC,oBAAoB;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAY,CAAC,GACrEL,KAAK;EAEPX,SAAS,CAAC,MAAM;IACd,MAAMiB,0BAA0B,GAAGA,CACjCC,YAA0B,EAC1BC,SAA+C,K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wC,MAAM,EAAEpB,SAAS,CAAC;QAC5D,CAAC,MAAM,IAAIH,SAAS,EAAE;UACpBF,0BAA0B,CAACf,YAAY,CAACyC,SAAS,EAAExB,SAAS,CAAC;QAC/D;MACF;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXmB,YAAY,CAACM,WAAW,CAAC,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAAChC,IAAI,EAAEC,oBAAoB,EAAEC,SAAS,EAAEC,SAAS,EAAEC,WAAW,CAAC,CAAC;EAEnE,OAAO,IAAI;AACb,CAAC;AAEDN,eAAe,CAACmC,WAAW,GAAG,iBAAiB;AAE/C,eAAenC,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","Platform","CallingState","DebounceType","hasScreenShare","hasVideo","combineLatest","distinctUntilChanged","distinctUntilKeyChanged","filter","map","of","getIosPipTrack$","setIosPipTrack","TrackSubscriber","props","call","participantSessionId","trackType","isVisible","dimensions$","isPipWriter","requestTrackWithDimensions","debounceType","dimension","width","height","undefined","state","updateParticipantTracks","trackSubscriptionManager","apply","isPublishingTrack$","participants$","pipe","ps","find","p","sessionId","isJoinedState$","callingState$","callingState","JOINED","trackKey","pipTrack$","OS","canWrite$","track","sameTrack","subscription","subscribe","isPublishing","isJoined","canWrite","MEDIUM","IMMEDIATE","unsubscribe","queueMicrotask","getValue","displayName"],"sourceRoot":"../../../../../../src","sources":["components/Participant/ParticipantView/VideoRenderer/TrackSubscriber.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAEEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,QAAQ,QAIH,yBAAyB;AAChC,SAEEC,aAAa,EACbC,oBAAoB,EACpBC,uBAAuB,EACvBC,MAAM,EACNC,GAAG,EACHC,EAAE,QACG,MAAM;AACb,SACEC,eAAe,EACfC,cAAc,QACT,wCAAwC;AAqB/C;AACA;AACA;AACA;AACA;AACA;AACA;A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AC,KAAKf,QAAQ,EACnC9B,cAAc,CAACG,IAAI,EAAEW,SAAS,CAAC;QACnC,CAAC,CAAC;MACJ;IACF,CAAC;EACH,CAAC,EAAE,CACDX,IAAI,EACJC,oBAAoB,EACpBC,SAAS,EACTC,SAAS,EACTC,WAAW,EACXC,WAAW,CACZ,CAAC;EAEF,OAAO,IAAI;AACb,CAAC;AAEDP,eAAe,CAAC6C,WAAW,GAAG,iBAAiB;AAE/C,eAAe7C,eAAe","ignoreList":[]}
@@ -37,6 +37,11 @@ export * from './modules/call-manager';
37
37
  // Explicitly re-exporting to resolve ambiguity.
38
38
  export { StreamVideo } from './providers/StreamVideo';
39
39
  export { StreamCall } from './providers/StreamCall';
40
+ // Overriding 'EncryptionManager' from '@stream-io/video-client' with the React
41
+ // Native implementation, which is backed by the native WebRTC transform. React
42
+ // Native Web is not supported: `isSupported()` returns false there rather than
43
+ // falling back to the web manager.
44
+ export { EncryptionManager } from './modules/encryption';
40
45
  export * from './providers/NoiseCancellation';
41
46
  setClientDetails();
42
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mCAAmC;;AAE1C;AACA;AACA;AACA,IAAID,QAAQ,CAACE,EAAE,KAAK,KAAK,EAAE;EACzBJ,eAAe,CAAC,CAAC;EACjBG,kBAAkB,CAAC,CAAC;AACtB;;AAEA;AACAF,MAAM,CAACI,MAAM,CAAC,GAAGJ,MAAM,CAACK,WAAW,eAAe,CAAC;AAEnD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;;AAEtC;AACA;AACA,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,wBAAwB;AACnD,cAAc,+BAA+B;AAE7CT,gBAAgB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall","EncryptionManager"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mCAAmC;;AAE1C;AACA;AACA;AACA,IAAID,QAAQ,CAACE,EAAE,KAAK,KAAK,EAAE;EACzBJ,eAAe,CAAC,CAAC;EACjBG,kBAAkB,CAAC,CAAC;AACtB;;AAEA;AACAF,MAAM,CAACI,MAAM,CAAC,GAAGJ,MAAM,CAACK,WAAW,eAAe,CAAC;AAEnD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;;AAEtC;AACA;AACA,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,wBAAwB;AACnD;AACA;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,cAAc,+BAA+B;AAE7CV,gBAAgB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+
3
+ import { RTCEncryptionManager } from '@stream-io/react-native-webrtc';
4
+ import { TypedEventEmitter, videoLoggerSystem } from '@stream-io/video-client';
5
+ import { algorithmToNative, E2EE_EVENT_TYPES, mapNativeEvent, trackTypeToNative } from './eventMapping';
6
+
7
+ /**
8
+ * Distributes keys to the native encryption manager and attaches
9
+ * encrypt/decrypt transforms to RTCRtpSenders and RTCRtpReceivers.
10
+ *
11
+ * The public surface matches the web
12
+ * {@link https://github.com/GetStream/stream-video-js/blob/main/packages/client/src/rtc/e2ee/EncryptionManager.ts | EncryptionManager}
13
+ * method for method, so host code is portable between the two SDKs.
14
+ *
15
+ * The crypto itself lives in the WebRTC binary, not here: frames never cross
16
+ * the React Native bridge. This class carries key and attach commands over it,
17
+ * and diagnostic events back.
18
+ *
19
+ * Like the keys it installs, the manager is application-owned: create one per
20
+ * call, attach it before {@link https://github.com/GetStream/stream-video-js/blob/main/packages/client/src/Call.ts | Call}`.join()`,
21
+ * and {@link EncryptionManager.dispose | dispose} it when that call is done.
22
+ * Nothing in the SDK will do it for you, and on React Native the leak is native
23
+ * rather than collectable.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * if (EncryptionManager.isSupported()) {
28
+ * const e2ee = await EncryptionManager.create(call.currentUserId);
29
+ * e2ee.setSharedKey(0, keyBytes);
30
+ * call.setE2EEManager(e2ee); // must happen before call.join()
31
+ * }
32
+ * ```
33
+ */
34
+ export class EncryptionManager {
35
+ bridged = [];
36
+ disposed = false;
37
+ constructor(native, algorithm) {
38
+ this.native = native;
39
+ this.algorithm = algorithm;
40
+ this.logger = videoLoggerSystem.getLogger('EncryptionManager');
41
+ this.events = new TypedEventEmitter(this.logger);
42
+ // Native dispatches per event name, so the one handler is registered under
43
+ // each of them, and each registration has to be undone on dispose.
44
+ for (const type of E2EE_EVENT_TYPES) {
45
+ this.native.on(type, this.handleNativeEvent);
46
+ this.bridged.push([type, this.handleNativeEvent]);
47
+ }
48
+ }
49
+ handleNativeEvent = data => {
50
+ const event = mapNativeEvent(data);
51
+ if (!event) return;
52
+ this.events.emit(event.type, event.payload);
53
+ };
54
+
55
+ /**
56
+ * Whether E2EE can run here. Use it to guard UI, or to avoid calling
57
+ * {@link create} where it would throw.
58
+ *
59
+ * `false` means the installed `@stream-io/react-native-webrtc` predates E2EE
60
+ * support.
61
+ */
62
+ static isSupported = () => RTCEncryptionManager?.isSupported() ?? false;
63
+
64
+ /**
65
+ * Create an EncryptionManager and initialize the underlying native manager.
66
+ *
67
+ * Attach it with `call.setE2EEManager()` **before** `call.join()`: the join
68
+ * request carries the E2EE flag, and the peer connections are built with the
69
+ * transforms in place.
70
+ *
71
+ * Resolves rather than returning directly because every Stream SDK exposes
72
+ * this as a promise; nothing here is actually asynchronous, since a blocking
73
+ * native create is what keeps a sender from ever existing unencrypted.
74
+ *
75
+ * @param userId - The local user's ID, normally `call.currentUserId`.
76
+ * @param options - the create options.
77
+ * @throws {Error} If E2EE is unavailable. It never degrades to plaintext.
78
+ */
79
+ static create = async (userId, options) => {
80
+ if (!RTCEncryptionManager) {
81
+ throw new Error('E2EE requires a version of @stream-io/react-native-webrtc that supports RTCEncryptionManager');
82
+ }
83
+ if (!RTCEncryptionManager.isSupported()) {
84
+ throw new Error('E2EE is not supported on this device');
85
+ }
86
+ const algorithm = options?.algorithm ?? 'AES-128-GCM';
87
+ const native = RTCEncryptionManager.create(userId, {
88
+ algorithm: algorithmToNative(algorithm)
89
+ });
90
+ return new EncryptionManager(native, algorithm);
91
+ };
92
+
93
+ /**
94
+ * Subscribe to an E2EE event.
95
+ *
96
+ * @returns a function that unsubscribes the listener.
97
+ */
98
+ on = (event, fn) => this.events.on(event, fn);
99
+
100
+ /** Unsubscribe a listener registered with {@link on}. */
101
+ off = (event, fn) => this.events.off(event, fn);
102
+
103
+ /** Drop every listener, or every listener of one event. */
104
+ removeAllListeners = event => this.events.removeAllListeners(event);
105
+
106
+ /**
107
+ * Set a per-user AES-GCM encryption key in the native key store.
108
+ *
109
+ * Use it when each participant has their own key from a central authority.
110
+ * The receiver picks the right one by the `keyIndex` in the frame trailer.
111
+ *
112
+ * @param userId - The key owner.
113
+ * @param keyIndex - Increases with each rotation.
114
+ * @param rawKey - 16 bytes for AES-128-GCM, 32 for AES-256-GCM.
115
+ */
116
+ setKey = (userId, keyIndex, rawKey) => {
117
+ this.assertUsable();
118
+ this.validateKeyIndex(keyIndex);
119
+ this.validateKeyLength(rawKey);
120
+ this.native.setKey(userId, keyIndex, this.copyKey(rawKey));
121
+ };
122
+
123
+ /**
124
+ * Fallback key for any user without a per-user key. The simplest E2EE mode:
125
+ * one key for everyone, usually passphrase-derived, no distribution needed.
126
+ * Setting an epoch makes it active for encryption while older epochs remain
127
+ * available to decrypt in-flight frames until {@link removeSharedKey}.
128
+ *
129
+ * @param keyIndex - An integer 0-255, since one trailer byte carries it.
130
+ * @param rawKey - 16 bytes for AES-128-GCM, 32 for AES-256-GCM.
131
+ */
132
+ setSharedKey = (keyIndex, rawKey) => {
133
+ this.assertUsable();
134
+ this.validateKeyIndex(keyIndex);
135
+ this.validateKeyLength(rawKey);
136
+ this.native.setSharedKey(keyIndex, this.copyKey(rawKey));
137
+ };
138
+
139
+ /**
140
+ * Retire one of a user's key epochs, leaving their other epochs usable.
141
+ *
142
+ * @param userId - The key owner.
143
+ * @param keyIndex - The exact epoch to remove. Absent epochs are a no-op.
144
+ */
145
+ removeKey = (userId, keyIndex) => {
146
+ this.assertUsable();
147
+ this.validateKeyIndex(keyIndex);
148
+ this.native.removeKey(userId, keyIndex);
149
+ };
150
+
151
+ /**
152
+ * Drop every key a user holds from the local key store, so later frames of
153
+ * theirs no longer decrypt.
154
+ *
155
+ * This is local cleanup, not remote revocation: it cannot stop that
156
+ * participant from decrypting anything, and a shared key still decrypts them.
157
+ * Revoking access means withholding future keys, which the application owns.
158
+ *
159
+ * To retire one rotated epoch instead, use {@link removeKey}.
160
+ */
161
+ removeAllKeys = userId => {
162
+ this.assertUsable();
163
+ this.native.removeAllKeys(userId);
164
+ };
165
+
166
+ /**
167
+ * Remove one shared-key epoch from the native receive key ring.
168
+ *
169
+ * If this is the active epoch, shared-key encryption stops until
170
+ * {@link setSharedKey} succeeds again. An older epoch is not reactivated.
171
+ *
172
+ * @param keyIndex - The exact shared-key epoch to remove.
173
+ */
174
+ removeSharedKey = keyIndex => {
175
+ this.assertUsable();
176
+ this.validateKeyIndex(keyIndex);
177
+ this.native.removeSharedKey(keyIndex);
178
+ };
179
+
180
+ /**
181
+ * Called by the Publisher when it adds a transceiver.
182
+ *
183
+ * Synchronous all the way to the native `SetFrameTransformer` call: were it
184
+ * async, the sender would exist before its transform did, which is a
185
+ * plaintext window. A failure throws instead of publishing cleartext.
186
+ *
187
+ * @param sender - The sender to encrypt.
188
+ * @param codec - Codec name, e.g. 'vp8', selecting the clear-byte rules.
189
+ * @param trackType - `TrackType` enum name, e.g. 'SCREEN_SHARE_AUDIO'.
190
+ * @internal
191
+ */
192
+ encrypt = (sender, codec, trackType) => {
193
+ this.assertUsable();
194
+ this.native.encrypt(sender, codec, trackTypeToNative(trackType));
195
+ };
196
+
197
+ /**
198
+ * Called by the Subscriber when a remote track arrives.
199
+ *
200
+ * @param receiver - The receiver to decrypt.
201
+ * @param userId - The remote user, for key lookup.
202
+ * @param trackType - `TrackType` enum name, e.g. 'SCREEN_SHARE_AUDIO'.
203
+ * @internal
204
+ */
205
+ decrypt = (receiver, userId, trackType) => {
206
+ this.assertUsable();
207
+ this.native.decrypt(receiver, userId, trackTypeToNative(trackType));
208
+ };
209
+
210
+ /**
211
+ * Toggle periodic performance reporting.
212
+ *
213
+ * While on, `e2ee.perf_report` is emitted once per second with per-track FPS
214
+ * and crypto timings. Useful for debugging throughput.
215
+ */
216
+ enablePerformanceReporting = enabled => {
217
+ this.assertUsable();
218
+ // Observational, so it is the one native call that need not block. Kept
219
+ // void-returning to match the web manager.
220
+ this.native.enablePerformanceReporting(enabled).catch(err => this.logger.warn('Failed to toggle performance reporting', err));
221
+ };
222
+
223
+ /**
224
+ * Request a snapshot of the installed keys. It arrives later as the
225
+ * `e2ee.key_state` event, listing fingerprints only, never key material.
226
+ */
227
+ requestKeyState = () => {
228
+ this.assertUsable();
229
+ this.native.requestKeyState().catch(err => this.logger.warn('Failed to request key state', err));
230
+ };
231
+
232
+ /**
233
+ * Release the native manager and all resources.
234
+ *
235
+ * **The application owns this object's lifetime — the SDK never disposes it.**
236
+ * Nothing releases the native manager when a peer connection closes, and there
237
+ * is no detach API, so an undisposed manager keeps its transforms and its key
238
+ * material alive for the lifetime of the process. Dispose it together with the
239
+ * call instance whose flow has ended; a later flow gets a fresh call and a
240
+ * fresh manager (see `Call.setE2EEManager`).
241
+ *
242
+ * In-flight frames are dropped rather than drained.
243
+ *
244
+ * The manager is unusable afterwards and every key or attach method throws.
245
+ * Call {@link create} for a new one. Safe to call more than once.
246
+ */
247
+ dispose = () => {
248
+ if (this.disposed) return;
249
+ this.disposed = true;
250
+ for (const [type, handler] of this.bridged) {
251
+ this.native.off(type, handler);
252
+ }
253
+ this.bridged.length = 0;
254
+ try {
255
+ this.native.dispose();
256
+ } catch (err) {
257
+ // Local cleanup still has to finish, or listeners outlive the manager.
258
+ this.logger.warn('Failed to dispose the native encryption manager', err);
259
+ }
260
+ this.events.removeAllListeners();
261
+ };
262
+
263
+ /**
264
+ * {@link dispose} releases the native manager, so an attached transform would
265
+ * point at nothing: frames would stall with no error and no event. Throwing
266
+ * is also fail-closed, since a caller that swallows it still publishes
267
+ * nothing rather than cleartext.
268
+ */
269
+ assertUsable = () => {
270
+ if (this.disposed) throw new Error(`EncryptionManager is disposed`);
271
+ };
272
+
273
+ /**
274
+ * The caller keeps ownership of its buffer and may re-import the same bytes,
275
+ * so hand native a copy rather than a view onto memory that can change.
276
+ */
277
+ copyKey = rawKey => {
278
+ const copy = new Uint8Array(rawKey.byteLength);
279
+ copy.set(new Uint8Array(rawKey));
280
+ return copy;
281
+ };
282
+ validateKeyLength = rawKey => {
283
+ const is256 = this.algorithm === 'AES-256-GCM';
284
+ const expected = is256 ? 32 : 16;
285
+ if (rawKey.byteLength !== expected) {
286
+ throw new Error(`Key must be exactly ${expected} bytes (${is256 ? 'AES-256' : 'AES-128'})`);
287
+ }
288
+ };
289
+
290
+ /**
291
+ * One trailer byte carries the keyIndex. A larger value would truncate to
292
+ * `keyIndex & 0xFF`, so the receiver would look up the wrong key and fail
293
+ * every decrypt. Reject it rather than ship a silently broken key epoch.
294
+ */
295
+ validateKeyIndex = keyIndex => {
296
+ if (!Number.isInteger(keyIndex) || keyIndex < 0 || keyIndex > 255) {
297
+ throw new Error(`keyIndex must be an integer between 0 and 255, got ${keyIndex}`);
298
+ }
299
+ };
300
+ }
301
+ //# sourceMappingURL=EncryptionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["RTCEncryptionManager","TypedEventEmitter","videoLoggerSystem","algorithmToNative","E2EE_EVENT_TYPES","mapNativeEvent","trackTypeToNative","EncryptionManager","bridged","disposed","constructor","native","algorithm","logger","getLogger","events","type","on","handleNativeEvent","push","data","event","emit","payload","isSupported","create","userId","options","Error","fn","off","removeAllListeners","setKey","keyIndex","rawKey","assertUsable","validateKeyIndex","validateKeyLength","copyKey","setSharedKey","removeKey","removeAllKeys","removeSharedKey","encrypt","sender","codec","trackType","decrypt","receiver","enablePerformanceReporting","enabled","catch","err","warn","requestKeyState","dispose","handler","length","copy","Uint8Array","byteLength","set","is256","expected","Number","isInteger"],"sourceRoot":"../../../../src","sources":["modules/encryption/EncryptionManager.ts"],"mappings":";;AAAA,SACEA,oBAAoB,QAGf,gCAAgC;AACvC,SACEC,iBAAiB,EACjBC,iBAAiB,QAOZ,yBAAyB;AAChC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,cAAc,EACdC,iBAAiB,QAC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CEncryptionAlgorithm, RTCEncryptionTrackType } from '@stream-io/react-native-webrtc';
4
+ /**
5
+ * The core RTC layer labels tracks with the `TrackType` enum *name*
6
+ * (`SfuModels.TrackType[trackType]`), while the native manager takes a numeric
7
+ * enum. Screen-share audio is deliberately its own value: native keeps replay
8
+ * state per (userId, trackType), so folding it into `AUDIO` mis-groups it.
9
+ *
10
+ * These read the native enums inside the function body on purpose. This module
11
+ * is reachable from the SDK's public entry point, so an app whose
12
+ * `@stream-io/react-native-webrtc` predates E2EE would crash on import if the
13
+ * enums were dereferenced at module scope - even if it never touches E2EE.
14
+ */
15
+ export const trackTypeToNative = trackType => {
16
+ switch (trackType) {
17
+ case 'AUDIO':
18
+ return RTCEncryptionTrackType.AUDIO;
19
+ case 'VIDEO':
20
+ return RTCEncryptionTrackType.VIDEO;
21
+ case 'SCREEN_SHARE':
22
+ return RTCEncryptionTrackType.SCREEN_SHARE;
23
+ case 'SCREEN_SHARE_AUDIO':
24
+ return RTCEncryptionTrackType.SCREEN_SHARE_AUDIO;
25
+ default:
26
+ // Native infers audio vs video from the sender rather than pinning a
27
+ // wrong value.
28
+ return undefined;
29
+ }
30
+ };
31
+
32
+ /** Map a native track type back to the name the web events carry. */
33
+ export const trackTypeFromNative = trackType => {
34
+ switch (trackType) {
35
+ case RTCEncryptionTrackType.AUDIO:
36
+ return 'AUDIO';
37
+ case RTCEncryptionTrackType.VIDEO:
38
+ return 'VIDEO';
39
+ case RTCEncryptionTrackType.SCREEN_SHARE:
40
+ return 'SCREEN_SHARE';
41
+ case RTCEncryptionTrackType.SCREEN_SHARE_AUDIO:
42
+ return 'SCREEN_SHARE_AUDIO';
43
+ default:
44
+ return undefined;
45
+ }
46
+ };
47
+
48
+ /** Map the public algorithm name to the native enum. */
49
+ export const algorithmToNative = algorithm => algorithm === 'AES-256-GCM' ? RTCEncryptionAlgorithm.AES_256_GCM : RTCEncryptionAlgorithm.AES_128_GCM;
50
+ const toTrackPerf = row => ({
51
+ userId: row.userId,
52
+ trackType: trackTypeFromNative(row.trackType) ?? '',
53
+ fps: row.fps,
54
+ maxCryptoMs: row.maxCryptoMs
55
+ });
56
+
57
+ /**
58
+ * Translate a native event into the payload the web manager emits, so a host
59
+ * can write one set of handlers for both platforms.
60
+ *
61
+ * Two things have to be reshaped rather than passed through: native track types
62
+ * are numeric, and native flattens `managerId`/`type`/`userId` alongside the
63
+ * payload of every event, including the two (`perf_report`, `key_state`) that
64
+ * are not about a single user. Fields the web types require but native leaves
65
+ * optional get an explicit default, so a handler never reads `undefined` where
66
+ * its type promises a value.
67
+ *
68
+ * @returns the mapped event, or `undefined` for an unrecognized event name.
69
+ */
70
+ export const mapNativeEvent = event => {
71
+ const {
72
+ type,
73
+ userId,
74
+ trackType,
75
+ keyIndex,
76
+ version,
77
+ reason
78
+ } = event;
79
+ const mapped = payload => ({
80
+ type,
81
+ payload
82
+ });
83
+ switch (type) {
84
+ case 'e2ee.decryption_failed':
85
+ case 'e2ee.decryption_resumed':
86
+ case 'e2ee.unencrypted_frame':
87
+ return mapped({
88
+ userId,
89
+ trackType: trackTypeFromNative(trackType)
90
+ });
91
+ case 'e2ee.missing_key':
92
+ return mapped({
93
+ userId,
94
+ keyIndex,
95
+ trackType: trackTypeFromNative(trackType)
96
+ });
97
+ case 'e2ee.decryption_stalled':
98
+ return mapped({
99
+ userId,
100
+ keyIndex: keyIndex ?? 0,
101
+ trackType: trackTypeFromNative(trackType)
102
+ });
103
+ case 'e2ee.encryption_failed':
104
+ return mapped({
105
+ userId,
106
+ trackType: trackTypeFromNative(trackType),
107
+ reason: reason ?? ''
108
+ });
109
+ case 'e2ee.unsupported_version':
110
+ return mapped({
111
+ userId,
112
+ trackType: trackTypeFromNative(trackType),
113
+ version: version ?? 0
114
+ });
115
+ case 'e2ee.perf_report':
116
+ return mapped({
117
+ encode: (event.encode ?? []).map(row => ({
118
+ ...toTrackPerf(row),
119
+ codec: row.codec ?? ''
120
+ })),
121
+ decode: (event.decode ?? []).map(toTrackPerf)
122
+ });
123
+ case 'e2ee.key_state':
124
+ return mapped(event.keyState ?? {
125
+ perUserKeys: [],
126
+ sharedKeys: []
127
+ });
128
+ default:
129
+ return undefined;
130
+ }
131
+ };
132
+
133
+ /** Every event the native manager emits, i.e. what the bridge subscribes to. */
134
+ export const E2EE_EVENT_TYPES = ['e2ee.decryption_failed', 'e2ee.decryption_resumed', 'e2ee.decryption_stalled', 'e2ee.encryption_failed', 'e2ee.missing_key', 'e2ee.unencrypted_frame', 'e2ee.unsupported_version', 'e2ee.perf_report', 'e2ee.key_state'];
135
+ //# sourceMappingURL=eventMapping.js.map