@cometchat/skills 4.3.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/LICENSE +21 -0
  2. package/bin/install.js +27 -0
  3. package/package.json +14 -1
  4. package/skills/cometchat/SKILL.md +233 -69
  5. package/skills/cometchat/references/asking-questions.md +48 -0
  6. package/skills/cometchat-a11y/SKILL.md +3 -2
  7. package/skills/cometchat-android-v5/SKILL.md +2 -1
  8. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  9. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  10. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  11. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  16. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  17. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  18. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  19. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  20. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  21. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  22. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  23. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  24. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  25. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  26. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  27. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  28. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  29. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  30. package/skills/cometchat-android-v5-core/SKILL.md +5 -3
  31. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  32. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  33. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  34. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  35. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  37. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  38. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  40. package/skills/cometchat-android-v6/SKILL.md +2 -1
  41. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  42. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  43. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  44. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  45. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  46. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  47. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  48. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  49. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  50. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  51. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  52. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  53. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  54. package/skills/cometchat-android-v6-core/SKILL.md +208 -28
  55. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  56. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  57. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  58. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  59. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  60. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  61. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  62. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  63. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  64. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  65. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  66. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  67. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  68. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  69. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  70. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  71. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  72. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  73. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  74. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  75. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  76. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  77. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  78. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  79. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  80. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  81. package/skills/cometchat-angular-components/SKILL.md +149 -620
  82. package/skills/cometchat-angular-core/SKILL.md +232 -312
  83. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  84. package/skills/cometchat-angular-features/SKILL.md +216 -334
  85. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  86. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  87. package/skills/cometchat-angular-production/SKILL.md +241 -92
  88. package/skills/cometchat-angular-push/SKILL.md +280 -294
  89. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  90. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  91. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  92. package/skills/cometchat-astro-patterns/SKILL.md +3 -2
  93. package/skills/cometchat-calls/SKILL.md +25 -19
  94. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  95. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  96. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  97. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  98. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  99. package/skills/cometchat-components/SKILL.md +163 -25
  100. package/skills/cometchat-core/SKILL.md +258 -20
  101. package/skills/cometchat-customization/SKILL.md +50 -25
  102. package/skills/cometchat-features/SKILL.md +314 -35
  103. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  104. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  105. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  106. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  107. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  108. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  109. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  110. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  111. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  112. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  113. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  114. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  115. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  116. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  117. package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
  118. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  119. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  120. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  122. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  123. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  124. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  125. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  126. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  127. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  128. package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
  129. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
  130. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  131. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  132. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  133. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  134. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  135. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  136. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  137. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  138. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  139. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  140. package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
  141. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  142. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  143. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  144. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  146. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  147. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  148. package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
  149. package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
  150. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  151. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  152. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  153. package/skills/cometchat-i18n/SKILL.md +140 -79
  154. package/skills/cometchat-ios/SKILL.md +4 -2
  155. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  156. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  157. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  158. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  159. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  160. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  161. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  162. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  163. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  164. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  165. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  166. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  167. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  168. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  169. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  170. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  171. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  172. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  173. package/skills/cometchat-ios-components/SKILL.md +200 -12
  174. package/skills/cometchat-ios-core/SKILL.md +173 -45
  175. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  176. package/skills/cometchat-ios-features/SKILL.md +64 -36
  177. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  178. package/skills/cometchat-ios-production/SKILL.md +12 -4
  179. package/skills/cometchat-ios-push/SKILL.md +53 -19
  180. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  181. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  182. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  183. package/skills/cometchat-native-bare-patterns/SKILL.md +36 -19
  184. package/skills/cometchat-native-calls/SKILL.md +29 -17
  185. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  186. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  187. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  188. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  189. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  190. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  191. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  192. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  193. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  194. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  195. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  196. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  197. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  198. package/skills/cometchat-native-components/SKILL.md +84 -52
  199. package/skills/cometchat-native-core/SKILL.md +102 -33
  200. package/skills/cometchat-native-customization/SKILL.md +150 -28
  201. package/skills/cometchat-native-expo-patterns/SKILL.md +60 -29
  202. package/skills/cometchat-native-features/SKILL.md +24 -17
  203. package/skills/cometchat-native-placement/SKILL.md +19 -10
  204. package/skills/cometchat-native-production/SKILL.md +9 -3
  205. package/skills/cometchat-native-push/SKILL.md +2 -1
  206. package/skills/cometchat-native-testing/SKILL.md +1 -2
  207. package/skills/cometchat-native-theming/SKILL.md +54 -29
  208. package/skills/cometchat-native-troubleshooting/SKILL.md +11 -5
  209. package/skills/cometchat-nextjs-patterns/SKILL.md +22 -8
  210. package/skills/cometchat-placement/SKILL.md +42 -3
  211. package/skills/cometchat-production/SKILL.md +12 -5
  212. package/skills/cometchat-react-calls/SKILL.md +220 -10
  213. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  214. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  215. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  216. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  217. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  218. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  219. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  220. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  221. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  222. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  223. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  224. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  225. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  226. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  227. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  228. package/skills/cometchat-react-patterns/SKILL.md +45 -5
  229. package/skills/cometchat-react-push/SKILL.md +258 -72
  230. package/skills/cometchat-react-router-patterns/SKILL.md +12 -6
  231. package/skills/cometchat-react-testing/SKILL.md +14 -5
  232. package/skills/cometchat-theming/SKILL.md +181 -18
  233. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -1,24 +1,30 @@
1
1
  # Device management on React Native
2
2
 
3
- Same SDK API as web. RN-specific: `react-native-incall-manager` for audio routing (speaker / earpiece / Bluetooth) the SDK's `setAudioOutputDevice` doesn't reach iOS/Android system audio routing the way it does in browsers.
3
+ **RN is NOT web.** The web `getVideoInputDevices()` / `getAudioInputDevices()` / `setVideoInputDevice()` enumeration getters **do not exist on the RN Calls SDK** — there is no `MediaDevices.enumerateDevices()` equivalent. On mobile there are only two cameras (front / rear) and a fixed set of audio routes (earpiece / speaker / Bluetooth / wired), so the RN SDK exposes:
4
+
5
+ - **Camera:** `CometChatCalls.switchCamera()` — toggles front ↔ rear (no device-id picker).
6
+ - **Audio output:** `CometChatCalls.setAudioMode(mode)` where `mode` is an `AUDIO_MODE` value (`"SPEAKER" | "EARPIECE" | "BLUETOOTH" | "HEADPHONES"`).
7
+
8
+ The thesis of this reference is therefore **`react-native-incall-manager`** for real-world routing UX.
4
9
 
5
10
  **Canonical docs:** https://www.cometchat.com/docs/calls/react-native/device-management
6
- **Read first:** `cometchat-react-calls/references/device-management.md` — pre-call picker pattern + empty-label gotcha + Bluetooth caveats.
11
+ **Read first:** `cometchat-react-calls/references/device-management.md` — pre-call picker pattern + empty-label gotcha + Bluetooth caveats (web-only enumeration semantics; do NOT carry the getters over to RN).
7
12
 
8
13
  ---
9
14
 
10
- ## SDK API
15
+ ## SDK API (RN)
11
16
 
12
17
  ```ts
13
- import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
18
+ import { CometChatCalls, AUDIO_MODE } from "@cometchat/calls-sdk-react-native";
14
19
 
15
- const cameras = await CometChatCalls.getVideoInputDevices();
16
- const mics = await CometChatCalls.getAudioInputDevices();
20
+ // Front rear camera toggle (no enumeration / no device ids on RN):
21
+ CometChatCalls.switchCamera();
17
22
 
18
- await CometChatCalls.setVideoInputDevice(deviceId);
23
+ // Audio output route (mobile only):
24
+ CometChatCalls.setAudioMode(AUDIO_MODE.SPEAKER); // or EARPIECE / BLUETOOTH / HEADPHONES
19
25
  ```
20
26
 
21
- Camera + mic enumeration works the same as web. Speaker/output is where it diverges.
27
+ There is no camera/mic device list to enumerate — `switchCamera()` flips between the two on-device cameras. For fine-grained audio routing (and reliable Bluetooth/headset detection) use `react-native-incall-manager` below.
22
28
 
23
29
  ---
24
30
 
@@ -68,39 +74,55 @@ InCallManager.startProximitySensor(); // optional — auto-screen-off when pho
68
74
 
69
75
  ---
70
76
 
71
- ## Camera picker UI
77
+ ## Camera switch UI (front ↔ rear)
78
+
79
+ There's no device picker on RN — just a flip button calling `switchCamera()`:
72
80
 
73
81
  ```tsx
74
- import { TouchableOpacity, Text, FlatList } from "react-native";
82
+ import { TouchableOpacity, Text } from "react-native";
83
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
75
84
 
76
- function CameraPicker({ onClose }: { onClose: () => void }) {
77
- const [cameras, setCameras] = useState<MediaDevice[]>([]);
85
+ function FlipCameraButton() {
86
+ return (
87
+ <TouchableOpacity
88
+ onPress={() => CometChatCalls.switchCamera()} // toggles front ↔ rear; returns void
89
+ accessibilityRole="button"
90
+ accessibilityLabel="Switch camera"
91
+ >
92
+ <Text>Flip camera</Text>
93
+ </TouchableOpacity>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ## Audio output picker (SPEAKER / EARPIECE / BLUETOOTH / HEADPHONES)
78
99
 
79
- useEffect(() => {
80
- CometChatCalls.getVideoInputDevices().then(setCameras);
81
- }, []);
100
+ ```tsx
101
+ import { TouchableOpacity, Text, View } from "react-native";
102
+ import { CometChatCalls, AUDIO_MODE } from "@cometchat/calls-sdk-react-native";
103
+
104
+ const MODES = [AUDIO_MODE.SPEAKER, AUDIO_MODE.EARPIECE, AUDIO_MODE.BLUETOOTH, AUDIO_MODE.HEADPHONES];
82
105
 
106
+ function AudioOutputPicker() {
83
107
  return (
84
- <FlatList
85
- data={cameras}
86
- keyExtractor={(d) => d.id}
87
- renderItem={({ item }) => (
108
+ <View>
109
+ {MODES.map((mode) => (
88
110
  <TouchableOpacity
89
- onPress={async () => {
90
- await CometChatCalls.setVideoInputDevice(item.id);
91
- onClose();
92
- }}
111
+ key={mode}
112
+ onPress={() => CometChatCalls.setAudioMode(mode)}
93
113
  accessibilityRole="button"
94
- accessibilityLabel={`Select ${item.label}`}
114
+ accessibilityLabel={`Route audio to ${mode}`}
95
115
  >
96
- <Text>{item.label || `Camera ${item.id.slice(0, 6)}`}</Text>
116
+ <Text>{mode}</Text>
97
117
  </TouchableOpacity>
98
- )}
99
- />
118
+ ))}
119
+ </View>
100
120
  );
101
121
  }
102
122
  ```
103
123
 
124
+ Note: `setAudioMode` is the SDK-level route hint; `react-native-incall-manager` (above) remains the most reliable cross-platform path for forcing speaker/Bluetooth and detecting headset plug/unplug.
125
+
104
126
  ---
105
127
 
106
128
  ## Anti-patterns
@@ -108,8 +130,8 @@ function CameraPicker({ onClose }: { onClose: () => void }) {
108
130
  Web sister rules apply, plus RN-specific:
109
131
 
110
132
  1. **Forgetting `InCallManager.stop()` on hangup.** Music + phone audio sound wrong until reboot.
111
- 2. **Switching cameras mid-call without checking `setVideoInputDevice` await.** SDK queues the switch; switching twice rapidly without awaiting causes the second switch to drop.
112
- 3. **Skipping permissions check before enumeration.** Empty labels (same as web).
133
+ 2. **Spamming `switchCamera()` rapidly.** The SDK queues the front/rear toggle; double-tapping can drop the second toggle. Debounce the flip button.
134
+ 3. **Assuming web-style device enumeration on RN.** There is no `getVideoInputDevices()`/`getAudioInputDevices()`/`setVideoInputDevice()` use `switchCamera()` + `setAudioMode()`.
113
135
  4. **Hardcoding speakerphone-on for voice calls.** User holding phone to ear wants earpiece. Default to earpiece for voice; speaker for video.
114
136
 
115
137
  ---
@@ -120,7 +142,8 @@ Web sister rules apply, plus RN-specific:
120
142
  - [ ] `InCallManager.start({ media: "video"|"audio" })` on call start
121
143
  - [ ] `InCallManager.stop()` on call end
122
144
  - [ ] `setForceSpeakerphoneOn(true)` for video; `false` for voice
123
- - [ ] Permissions checked before device enumeration
145
+ - [ ] Camera flip uses `CometChatCalls.switchCamera()` (no device enumeration on RN)
146
+ - [ ] Audio route changes use `CometChatCalls.setAudioMode(AUDIO_MODE.*)` and/or InCallManager
124
147
  - [ ] Real-device smoke: AirPods connect mid-call → audio routes to AirPods
125
148
  - [ ] Real-device smoke: speaker toggle on/off works
126
149
  - [ ] Hangup smoke: music app's playback resumes correctly after call end
@@ -96,16 +96,19 @@ CometChat plan-driven. Common ceilings:
96
96
  | Production | 25 |
97
97
  | Enterprise | configurable up to 100 |
98
98
 
99
- The SDK doesn't reject calls at capacity — it just stops admitting new joiners with `OngoingCallListener.onError` firing on the would-be joiner's side. Surface this to the user:
99
+ The SDK doesn't reject calls at capacity — it just stops admitting new joiners. In v5, observe the roster via `addEventListener('onParticipantListChanged', ...)` (returns the full list, not a delta — clone `skills/event-listeners`) and surface the ceiling to the user:
100
100
 
101
101
  ```ts
102
- const listener = new CometChatCalls.OngoingCallListener({
103
- onError: (error: { code: string; message: string }) => {
104
- if (error.code === "ERR_CALL_FULL") {
102
+ const MAX_PARTICIPANTS = 25; // your plan's ceiling
103
+ const off = CometChatCalls.addEventListener(
104
+ "onParticipantListChanged",
105
+ (participants: Array<{ uid: string; name: string }>) => {
106
+ if (participants.length >= MAX_PARTICIPANTS) {
105
107
  Alert.alert("Call is full", "This meeting has reached its participant limit.");
106
108
  }
107
109
  },
108
- });
110
+ );
111
+ // cleanup: off();
109
112
  ```
110
113
 
111
114
  ---
@@ -113,12 +116,16 @@ const listener = new CometChatCalls.OngoingCallListener({
113
116
  ## Roster — who's in the call
114
117
 
115
118
  ```ts
116
- const listener = new CometChatCalls.OngoingCallListener({
117
- onUserListUpdated: (users: Array<{ uid: string; name: string; avatar?: string }>) => {
119
+ // v5: addEventListener('onParticipantListChanged', ...) — the v4 OngoingCallListener.onUserListUpdated
120
+ // is deprecated (clone skills/event-listeners + skills/migration-v4-to-v5 mapping).
121
+ const off = CometChatCalls.addEventListener(
122
+ "onParticipantListChanged",
123
+ (users: Array<{ uid: string; name: string; avatar?: string }>) => {
118
124
  // Re-render the participant strip
119
125
  setParticipants(users);
120
126
  },
121
- });
127
+ );
128
+ // cleanup: off();
122
129
  ```
123
130
 
124
131
  Fires whenever a participant joins or leaves. The roster includes the local user — filter them out of the "remote participants" UI:
@@ -132,14 +139,13 @@ const remoteParticipants = users.filter((u) => u.uid !== localUid);
132
139
 
133
140
  ## Active speaker detection
134
141
 
135
- The SDK fires `onActiveSpeakerUpdated` when the dominant audio source changes:
142
+ The SDK fires `onDominantSpeakerChanged` when the dominant audio source changes (there is no `onActiveSpeakerUpdated` event). Prefer `addEventListener` (returns an unsubscribe fn); `OngoingCallListener` is the @deprecated v4 path:
136
143
 
137
144
  ```ts
138
- const listener = new CometChatCalls.OngoingCallListener({
139
- onActiveSpeakerUpdated: (uid: string) => {
140
- setActiveSpeakerUid(uid);
141
- },
145
+ const off = CometChatCalls.addEventListener("onDominantSpeakerChanged", (uid: string) => {
146
+ setActiveSpeakerUid(uid);
142
147
  });
148
+ // cleanup: off();
143
149
  ```
144
150
 
145
151
  Use this to drive a "spotlight" layout — large tile for the active speaker, small thumbnails for the rest:
@@ -162,7 +168,7 @@ function SpotlightLayout({ participants, activeSpeakerUid }: Props) {
162
168
  }
163
169
  ```
164
170
 
165
- **Throttle re-layout** — `onActiveSpeakerUpdated` can fire multiple times per second in a noisy room. Debounce the layout swap to ~500ms minimum, otherwise tiles jitter.
171
+ **Throttle re-layout** — `onDominantSpeakerChanged` can fire multiple times per second in a noisy room. Debounce the layout swap to ~500ms minimum, otherwise tiles jitter.
166
172
 
167
173
  ---
168
174
 
@@ -173,28 +179,27 @@ These require the local user to be a group **owner** or **moderator** (CometChat
173
179
  ```ts
174
180
  import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
175
181
 
176
- // Mute a specific participant (moderator action kicks them off audio)
177
- async function mutParticipant(uid: string) {
178
- await CometChatCalls.muteUser(uid);
182
+ // Mute a specific participant. The method is muteParticipant(participantId) synchronous,
183
+ // returns void. There is NO muteUser()/removeUser() on the RN SDK.
184
+ function muteParticipant(participantId: string) {
185
+ CometChatCalls.muteParticipant(participantId);
179
186
  }
180
187
 
181
188
  // Mute everyone except local user
182
- async function muteAll() {
189
+ function muteAll() {
183
190
  for (const p of participants) {
184
191
  if (p.uid === localUid) continue;
185
- await CometChatCalls.muteUser(p.uid);
192
+ CometChatCalls.muteParticipant(p.uid);
186
193
  }
187
194
  }
188
195
 
189
- // Kick a participant out of the call
190
- async function kickParticipant(uid: string) {
191
- await CometChatCalls.removeUser(uid);
192
- }
196
+ // NOTE: there is NO "kick / remove participant" API on the RN Calls SDK.
197
+ // Removal must be done via the Chat SDK group management (e.g. CometChat.kickGroupMember),
198
+ // which removes them from the group — not a per-call eject.
193
199
 
194
- // Local user "raises hand" — signals to moderator
195
- async function raiseHand() {
196
- await CometChatCalls.raiseHand();
197
- // The moderator's onUserRaisedHand listener fires
200
+ // Local user "raises hand" — signals to moderator (synchronous, returns void)
201
+ function raiseHand() {
202
+ CometChatCalls.raiseHand();
198
203
  }
199
204
  ```
200
205
 
@@ -234,7 +239,7 @@ import * as Battery from "expo-battery";
234
239
 
235
240
  const level = await Battery.getBatteryLevelAsync();
236
241
  if (level < 0.2) {
237
- await CometChatCalls.pauseVideo(true);
242
+ CometChatCalls.pauseVideo(); // no-arg; resumeVideo() to resume (synchronous, returns void)
238
243
  Alert.alert("Battery saver", "Video paused to save battery.");
239
244
  }
240
245
  ```
@@ -261,8 +266,8 @@ Use this to render a "Join meeting" button on the group screen during an active
261
266
  ## Anti-patterns
262
267
 
263
268
  1. **Rendering tiles for every participant.** At 25 people, you have 25 `<RTCView />` instances; that's where RN's bridge starts choking. Render the active speaker + max 6 thumbnails.
264
- 2. **Updating layout on every `onActiveSpeakerUpdated`.** Debounce to 500ms minimum.
265
- 3. **Allowing non-moderators to call `muteUser` / `removeUser`.** SDK rejects, but the UI shouldn't expose buttons for it.
269
+ 2. **Updating layout on every `onDominantSpeakerChanged`.** Debounce to 500ms minimum.
270
+ 3. **Allowing non-moderators to call `muteParticipant`.** Only owners/moderators should see the button. (Per-call "kick" doesn't exist on the RN SDK — see above.)
266
271
  4. **No bandwidth warning.** A user on cellular joining a 10-person call burns their data plan in minutes. Show a "Switch to audio-only" prompt at the threshold.
267
272
  5. **Forgetting to filter local user from the roster.** "Speaking with myself" tile.
268
273
  6. **Initiating group calls without group membership check.** Non-members get "ERR_NOT_GROUP_MEMBER" silently.
@@ -1,6 +1,6 @@
1
1
  # Idle timeout on React Native
2
2
 
3
- Same SDK API as web — `setIdleTimeoutPeriodBeforePrompt` + `setIdleTimeoutPeriodAfterPrompt` on CallSettings, `onSessionTimedOut` event. RN-specific deltas are background-handling integration (call doesn't time out while the app is foregrounded; needs special handling in background) and the alert UI surface.
3
+ Same SDK API as web — `idleTimeoutPeriodBeforePrompt` + `idleTimeoutPeriodAfterPrompt` are SessionSettings **object fields** (ms), `onSessionTimedOut` event. RN-specific deltas are background-handling integration (call doesn't time out while the app is foregrounded; needs special handling in background) and the alert UI surface.
4
4
 
5
5
  **Canonical docs:** https://www.cometchat.com/docs/calls/react-native/idle-timeout
6
6
  **Read first:** `cometchat-react-calls/references/idle-timeout.md` — settings shape + recommended timeouts per archetype + custom prompt pattern.
@@ -12,11 +12,11 @@ Same SDK API as web — `setIdleTimeoutPeriodBeforePrompt` + `setIdleTimeoutPeri
12
12
  ```ts
13
13
  import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
14
14
 
15
- const settings = new CometChatCalls.CallSettingsBuilder()
16
- .setSessionID(sessionId)
17
- .setIdleTimeoutPeriodBeforePrompt(60_000)
18
- .setIdleTimeoutPeriodAfterPrompt(120_000)
19
- .build();
15
+ // SessionSettings OBJECT fields (ms) — NOT builder methods:
16
+ const settings = {
17
+ idleTimeoutPeriodBeforePrompt: 60_000,
18
+ idleTimeoutPeriodAfterPrompt: 120_000,
19
+ };
20
20
 
21
21
  CometChatCalls.addEventListener("onSessionTimedOut", () => {
22
22
  navigation.navigate("Home");
@@ -12,12 +12,14 @@ Same SDK API as web. RN-specific: BottomSheet panel UX (matches mobile patterns)
12
12
  ```ts
13
13
  import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
14
14
 
15
- const settings = new CometChatCalls.CallSettingsBuilder()
16
- .setSessionID(sessionId)
17
- .hideChatButton(false)
18
- .build();
19
-
20
- CometChatCalls.addEventListener("onChatButtonClicked", () => setOpen(true));
15
+ // SessionSettings OBJECT field, not a builder method:
16
+ const settings = {
17
+ hideChatButton: false,
18
+ };
19
+
20
+ // addEventListener returns the unsubscribe fn — call it on cleanup.
21
+ const off = CometChatCalls.addEventListener("onChatButtonClicked", () => setOpen(true));
22
+ // later: off();
21
23
  CometChatCalls.setChatButtonUnreadCount(5);
22
24
  ```
23
25
 
@@ -47,8 +49,8 @@ function InCallChatSheet({ sessionId }: Props) {
47
49
 
48
50
  useEffect(() => {
49
51
  const handler = () => sheetRef.current?.snapToIndex(1);
50
- CometChatCalls.addEventListener("onChatButtonClicked", handler);
51
- return () => CometChatCalls.removeEventListener("onChatButtonClicked", handler);
52
+ const off = CometChatCalls.addEventListener("onChatButtonClicked", handler);
53
+ return () => off();
52
54
  }, []);
53
55
 
54
56
  useEffect(() => {
@@ -46,10 +46,10 @@ If any of these are stale, calls may fail silently with WebRTC negotiation error
46
46
  ## Migration steps (same as web)
47
47
 
48
48
  1. Migrate init to plain object
49
- 2. Add `CometChatCalls.login(authToken)` after `CometChat.login`
49
+ 2. Add `CometChatCalls.login(uid, authKey)` after `CometChat.login` (UID-based; the auth-token form is `CometChatCalls.loginWithAuthToken(authToken)` — verified against calls-sdk-react-native `skills/setup` + `skills/migration-v4-to-v5`)
50
50
  3. Replace `CallSettingsBuilder` with plain `sessionSettings` object — **watch inverted booleans** (`show*` → `hide*`)
51
51
  4. Replace `OngoingCallListener` with `addEventListener` calls
52
- 5. Rename methods: `endSession` → `leaveSession`, `startSession` → `joinSession`, `setMode` `setLayout`
52
+ 5. Rename methods: `endSession` → `leaveSession`; `setMode('DEFAULT')` → the `sessionSettings.layout: 'SIDEBAR'` prop (DEFAULT maps to SIDEBAR). An imperative `CometChatCalls.setLayout('TILE' | 'SIDEBAR' | 'SPOTLIGHT')` does exist for runtime layout changes (calls-sdk-react-native `skills/custom-ui`). **RN has no imperative `joinSession`/`startSession`** — on RN the session is the declarative `<CometChatCalls.Component callToken={...} />` primitive (mint the token with `CometChatCalls.generateToken(sessionId)` and render the Component). There is no start/join method to call.
53
53
  6. Cleanup: `addEventListener` returns an unsubscribe — call it on unmount
54
54
 
55
55
  ---
@@ -15,13 +15,14 @@ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
15
15
  CometChatCalls.raiseHand();
16
16
  CometChatCalls.lowerHand();
17
17
 
18
- CometChatCalls.addEventListener("onParticipantHandRaised", (p) => { ... });
19
- CometChatCalls.addEventListener("onParticipantHandLowered", (p) => { ... });
20
-
21
- const settings = new CometChatCalls.CallSettingsBuilder()
22
- .setSessionID(sessionId)
23
- .hideRaiseHandButton(true)
24
- .build();
18
+ // addEventListener returns an unsubscribe function — capture it, call it in cleanup.
19
+ const off = CometChatCalls.addEventListener("onParticipantHandRaised", (p) => { ... });
20
+ // later: off();
21
+
22
+ // Button visibility is a SessionSettings OBJECT field, not a builder method:
23
+ const settings = {
24
+ hideRaiseHandButton: true,
25
+ };
25
26
  ```
26
27
 
27
28
  ---
@@ -102,11 +103,12 @@ function RaisedHandsSheet() {
102
103
  });
103
104
  };
104
105
 
105
- CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
106
- CometChatCalls.addEventListener("onParticipantHandLowered", onLowered);
106
+ // addEventListener returns an unsubscribe fn; collect them and call on cleanup.
107
+ const offRaised = CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
108
+ const offLowered = CometChatCalls.addEventListener("onParticipantHandLowered", onLowered);
107
109
  return () => {
108
- CometChatCalls.removeEventListener("onParticipantHandRaised", onRaised);
109
- CometChatCalls.removeEventListener("onParticipantHandLowered", onLowered);
110
+ offRaised();
111
+ offLowered();
110
112
  };
111
113
  }, [raised.size]);
112
114
 
@@ -149,8 +151,8 @@ useEffect(() => {
149
151
  position: "top",
150
152
  });
151
153
  };
152
- CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
153
- return () => CometChatCalls.removeEventListener("onParticipantHandRaised", onRaised);
154
+ const off = CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
155
+ return () => off();
154
156
  }, []);
155
157
  ```
156
158