@cometchat/skills 4.2.1 → 4.4.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/LICENSE +21 -0
- package/README.md +33 -12
- package/bin/install.js +59 -4
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +460 -77
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +20 -2
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +389 -9
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +235 -293
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +22 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +412 -13
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
- package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +281 -11
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
- package/skills/cometchat-native-calls/SKILL.md +89 -19
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +91 -57
- package/skills/cometchat-native-core/SKILL.md +281 -9
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
- package/skills/cometchat-native-features/SKILL.md +79 -49
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +57 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -12,32 +12,35 @@ Camera / mic / speaker enumeration + switching mid-call. SDK exposes `getAudioIn
|
|
|
12
12
|
```ts
|
|
13
13
|
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
14
14
|
|
|
15
|
-
// Enumerate
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
15
|
+
// Enumerate — these getters are SYNCHRONOUS (they return arrays, not promises;
|
|
16
|
+
// do NOT `await` them).
|
|
17
|
+
const mics = CometChatCalls.getAudioInputDevices();
|
|
18
|
+
const speakers = CometChatCalls.getAudioOutputDevices();
|
|
19
|
+
const cameras = CometChatCalls.getVideoInputDevices();
|
|
19
20
|
|
|
20
21
|
// Currently selected
|
|
21
22
|
const currentMic = CometChatCalls.getCurrentAudioInputDevice();
|
|
22
23
|
|
|
23
|
-
// Switch (mid-call OK)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
// Switch (mid-call OK) — also synchronous, return void.
|
|
25
|
+
CometChatCalls.setAudioInputDevice(deviceId);
|
|
26
|
+
CometChatCalls.setAudioOutputDevice(deviceId);
|
|
27
|
+
CometChatCalls.setVideoInputDevice(deviceId);
|
|
27
28
|
|
|
28
|
-
// Listen for device changes (user plugs in headphones, etc.)
|
|
29
|
-
|
|
29
|
+
// Listen for device changes (user plugs in headphones, etc.). The valid event
|
|
30
|
+
// keys are onAudioInputDevicesChanged / onAudioOutputDevicesChanged /
|
|
31
|
+
// onVideoInputDevicesChanged (there is NO "onAudioModesUpdated"). addEventListener
|
|
32
|
+
// returns an unsubscribe function — there is no removeEventListener.
|
|
33
|
+
const off = CometChatCalls.addEventListener("onAudioInputDevicesChanged", (devices) => {
|
|
30
34
|
// re-enumerate; show toast "AirPods connected"
|
|
31
35
|
});
|
|
36
|
+
// later: off();
|
|
32
37
|
```
|
|
33
38
|
|
|
34
|
-
Each device
|
|
39
|
+
Each device is a standard `MediaDeviceInfo` (the SDK types are `AudioInputDevice = MediaDeviceInfo & { kind: 'audioinput' }`, etc.). The fields you use:
|
|
35
40
|
```ts
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// ... other fields per browser
|
|
40
|
-
}
|
|
41
|
+
// deviceId: string ← the ID you pass to setAudioInputDevice() (NOT `id`)
|
|
42
|
+
// label: string ← "Built-in Microphone" / "AirPods Pro" (empty until mic permission granted)
|
|
43
|
+
// kind: 'audioinput' | 'videoinput' | 'audiooutput'
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
---
|
|
@@ -48,12 +51,11 @@ interface MediaDevice {
|
|
|
48
51
|
import { useEffect, useState } from "react";
|
|
49
52
|
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
50
53
|
|
|
51
|
-
interface MediaDevice { id: string; label: string; }
|
|
52
|
-
|
|
53
54
|
function DevicePicker({ onConfirm }: { onConfirm: () => void }) {
|
|
54
|
-
|
|
55
|
-
const [
|
|
56
|
-
const [
|
|
55
|
+
// Devices are MediaDeviceInfo objects — use `deviceId`, NOT `id`.
|
|
56
|
+
const [mics, setMics] = useState<MediaDeviceInfo[]>([]);
|
|
57
|
+
const [cameras, setCameras] = useState<MediaDeviceInfo[]>([]);
|
|
58
|
+
const [speakers, setSpeakers] = useState<MediaDeviceInfo[]>([]);
|
|
57
59
|
const [selectedMic, setSelectedMic] = useState<string>();
|
|
58
60
|
const [selectedCamera, setSelectedCamera] = useState<string>();
|
|
59
61
|
const [selectedSpeaker, setSelectedSpeaker] = useState<string>();
|
|
@@ -67,24 +69,24 @@ function DevicePicker({ onConfirm }: { onConfirm: () => void }) {
|
|
|
67
69
|
// permission denied — labels will be empty; offer settings link
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
]);
|
|
72
|
+
// These getters are SYNCHRONOUS — no await / Promise.all needed.
|
|
73
|
+
const m = CometChatCalls.getAudioInputDevices();
|
|
74
|
+
const c = CometChatCalls.getVideoInputDevices();
|
|
75
|
+
const s = CometChatCalls.getAudioOutputDevices();
|
|
75
76
|
setMics(m); setCameras(c); setSpeakers(s);
|
|
76
77
|
|
|
77
|
-
setSelectedMic(CometChatCalls.getCurrentAudioInputDevice()?.
|
|
78
|
-
setSelectedCamera(CometChatCalls.getCurrentVideoInputDevice()?.
|
|
79
|
-
setSelectedSpeaker(CometChatCalls.getCurrentAudioOutputDevice()?.
|
|
78
|
+
setSelectedMic(CometChatCalls.getCurrentAudioInputDevice()?.deviceId ?? m[0]?.deviceId);
|
|
79
|
+
setSelectedCamera(CometChatCalls.getCurrentVideoInputDevice()?.deviceId ?? c[0]?.deviceId);
|
|
80
|
+
setSelectedSpeaker(CometChatCalls.getCurrentAudioOutputDevice()?.deviceId ?? s[0]?.deviceId);
|
|
80
81
|
}
|
|
81
82
|
load();
|
|
82
83
|
}, []);
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
85
|
+
function confirm() {
|
|
86
|
+
// setters are synchronous, return void
|
|
87
|
+
if (selectedMic) CometChatCalls.setAudioInputDevice(selectedMic);
|
|
88
|
+
if (selectedCamera) CometChatCalls.setVideoInputDevice(selectedCamera);
|
|
89
|
+
if (selectedSpeaker) CometChatCalls.setAudioOutputDevice(selectedSpeaker);
|
|
88
90
|
onConfirm();
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -93,19 +95,19 @@ function DevicePicker({ onConfirm }: { onConfirm: () => void }) {
|
|
|
93
95
|
<label>
|
|
94
96
|
Microphone
|
|
95
97
|
<select value={selectedMic} onChange={(e) => setSelectedMic(e.target.value)}>
|
|
96
|
-
{mics.map(d => <option key={d.
|
|
98
|
+
{mics.map(d => <option key={d.deviceId} value={d.deviceId}>{d.label || `Mic ${d.deviceId.slice(0, 6)}`}</option>)}
|
|
97
99
|
</select>
|
|
98
100
|
</label>
|
|
99
101
|
<label>
|
|
100
102
|
Camera
|
|
101
103
|
<select value={selectedCamera} onChange={(e) => setSelectedCamera(e.target.value)}>
|
|
102
|
-
{cameras.map(d => <option key={d.
|
|
104
|
+
{cameras.map(d => <option key={d.deviceId} value={d.deviceId}>{d.label || `Camera ${d.deviceId.slice(0, 6)}`}</option>)}
|
|
103
105
|
</select>
|
|
104
106
|
</label>
|
|
105
107
|
<label>
|
|
106
108
|
Speaker
|
|
107
109
|
<select value={selectedSpeaker} onChange={(e) => setSelectedSpeaker(e.target.value)}>
|
|
108
|
-
{speakers.map(d => <option key={d.
|
|
110
|
+
{speakers.map(d => <option key={d.deviceId} value={d.deviceId}>{d.label || `Speaker ${d.deviceId.slice(0, 6)}`}</option>)}
|
|
109
111
|
</select>
|
|
110
112
|
</label>
|
|
111
113
|
<button type="button" onClick={confirm}>Join call</button>
|
|
@@ -123,21 +125,23 @@ function DevicePicker({ onConfirm }: { onConfirm: () => void }) {
|
|
|
123
125
|
```tsx
|
|
124
126
|
function InCallDeviceSettings() {
|
|
125
127
|
const [showMenu, setShowMenu] = useState(false);
|
|
126
|
-
const [mics, setMics] = useState<
|
|
128
|
+
const [mics, setMics] = useState<MediaDeviceInfo[]>([]);
|
|
127
129
|
|
|
128
130
|
useEffect(() => {
|
|
129
131
|
if (!showMenu) return;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
CometChatCalls.addEventListener("
|
|
136
|
-
|
|
132
|
+
// getAudioInputDevices() is synchronous — returns an array, no .then().
|
|
133
|
+
setMics(CometChatCalls.getAudioInputDevices());
|
|
134
|
+
|
|
135
|
+
// addEventListener returns an unsubscribe fn — call it to clean up
|
|
136
|
+
// (there is no removeEventListener on the SDK).
|
|
137
|
+
const off = CometChatCalls.addEventListener("onAudioInputDevicesChanged", () => {
|
|
138
|
+
setMics(CometChatCalls.getAudioInputDevices());
|
|
139
|
+
});
|
|
140
|
+
return () => off();
|
|
137
141
|
}, [showMenu]);
|
|
138
142
|
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
function selectMic(id: string) {
|
|
144
|
+
CometChatCalls.setAudioInputDevice(id); // synchronous, returns void
|
|
141
145
|
setShowMenu(false);
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -147,8 +151,8 @@ function InCallDeviceSettings() {
|
|
|
147
151
|
{showMenu && (
|
|
148
152
|
<ul role="menu">
|
|
149
153
|
{mics.map(d => (
|
|
150
|
-
<li key={d.
|
|
151
|
-
<button role="menuitem" onClick={() => selectMic(d.
|
|
154
|
+
<li key={d.deviceId}>
|
|
155
|
+
<button role="menuitem" onClick={() => selectMic(d.deviceId)}>{d.label}</button>
|
|
152
156
|
</li>
|
|
153
157
|
))}
|
|
154
158
|
</ul>
|
|
@@ -158,7 +162,7 @@ function InCallDeviceSettings() {
|
|
|
158
162
|
}
|
|
159
163
|
```
|
|
160
164
|
|
|
161
|
-
`
|
|
165
|
+
`onAudioInputDevicesChanged` (and `onAudioOutputDevicesChanged` / `onVideoInputDevicesChanged`) fire when the user plugs in headphones, AirPods connect, etc. Re-enumerate on the event.
|
|
162
166
|
|
|
163
167
|
---
|
|
164
168
|
|
|
@@ -179,7 +183,7 @@ if (safari) {
|
|
|
179
183
|
## Anti-patterns
|
|
180
184
|
|
|
181
185
|
1. **Calling `getAudioInputDevices` before requesting permission.** Returns devices with empty `label` strings — UI shows "undefined" or empty entries.
|
|
182
|
-
2. **Caching device list.** Devices change (plug/unplug). Re-enumerate on every menu open AND on `
|
|
186
|
+
2. **Caching device list.** Devices change (plug/unplug). Re-enumerate on every menu open AND on `onAudioInputDevicesChanged`.
|
|
183
187
|
3. **Hardcoding the first device as default.** Browsers may sort differently (built-in vs USB). Read `getCurrent*Device` first; only fall back to first if no current selection.
|
|
184
188
|
4. **Switching speakers in Safari.** `setAudioOutputDevice` silently fails. Detect Safari and hide the speaker picker (or show a "iOS uses system routing" tooltip).
|
|
185
189
|
5. **No listener cleanup on unmount.** Event accumulates listeners on remount; spam every device change.
|
|
@@ -190,7 +194,7 @@ if (safari) {
|
|
|
190
194
|
|
|
191
195
|
- [ ] Permission requested before enumeration (empty-label fix)
|
|
192
196
|
- [ ] `getCurrent*Device()` used as default in pickers
|
|
193
|
-
- [ ] `
|
|
197
|
+
- [ ] `onAudioInputDevicesChanged` listener for hot-swap detection (unsubscribe via the returned fn)
|
|
194
198
|
- [ ] Listener cleanup on unmount
|
|
195
199
|
- [ ] Safari speaker picker hidden / fallback message
|
|
196
200
|
- [ ] Browser smoke: plug/unplug headphones during call, picker updates
|
|
@@ -106,19 +106,17 @@ async function startGroupCall(guid: string, callType: "audio" | "video") {
|
|
|
106
106
|
const authToken = loggedInUser.getAuthToken();
|
|
107
107
|
const { token: callToken } = await CometChatCalls.generateToken(sessionId);
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
.build();
|
|
109
|
+
// joinSession takes a SessionSettings OBJECT (NOT CallSettingsBuilder.build() —
|
|
110
|
+
// that CallSettings is for the deprecated startSession). Events come from the
|
|
111
|
+
// static addEventListener bus, not OngoingCallListener.
|
|
112
|
+
const settings = { sessionType: callType === "audio" ? "VOICE" : "VIDEO" };
|
|
113
|
+
const offClosed = CometChatCalls.addEventListener("onConnectionClosed", () => {
|
|
114
|
+
/* hangup UI */
|
|
115
|
+
});
|
|
116
|
+
// later, on teardown: offClosed();
|
|
119
117
|
|
|
120
118
|
// 3. Mount the WebRTC view into your container element
|
|
121
|
-
await CometChatCalls.joinSession(callToken,
|
|
119
|
+
await CometChatCalls.joinSession(callToken, settings, containerElement);
|
|
122
120
|
}
|
|
123
121
|
```
|
|
124
122
|
|
|
@@ -182,17 +180,14 @@ async function joinGroupCall(sessionId: string, callType: "audio" | "video", con
|
|
|
182
180
|
const authToken = loggedInUser!.getAuthToken();
|
|
183
181
|
const { token: callToken } = await CometChatCalls.generateToken(sessionId);
|
|
184
182
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.build();
|
|
194
|
-
|
|
195
|
-
await CometChatCalls.joinSession(callToken, callSettings, container);
|
|
183
|
+
// SessionSettings OBJECT for joinSession (not CallSettingsBuilder output).
|
|
184
|
+
const settings = { sessionType: callType === "audio" ? "VOICE" : "VIDEO" };
|
|
185
|
+
const offClosed = CometChatCalls.addEventListener("onConnectionClosed", () => {
|
|
186
|
+
/* hangup UI */
|
|
187
|
+
});
|
|
188
|
+
// later, on teardown: offClosed();
|
|
189
|
+
|
|
190
|
+
await CometChatCalls.joinSession(callToken, settings, container);
|
|
196
191
|
}
|
|
197
192
|
```
|
|
198
193
|
|
|
@@ -259,4 +254,4 @@ Since meetings don't ring, there's no "missed call" entity. If you want missed-m
|
|
|
259
254
|
- `call-session.md` — pure session-mode (URL-based, no chat-side signaling at all)
|
|
260
255
|
- `cometchat-react-calls/SKILL.md` rule 1.7 — IncomingCall mount (1:1 only; group calls don't use this)
|
|
261
256
|
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/group-calls
|
|
262
|
-
- Kit source (
|
|
257
|
+
- Kit source (web React): `@cometchat/chat-uikit-react` → `src/components/Calling/CometChatCallButtons/CometChatCallButtons.tsx` (group call buttons send the `meeting` custom message)
|
|
@@ -9,22 +9,34 @@ Auto-ends calls where the local user is the only remaining participant. Two time
|
|
|
9
9
|
|
|
10
10
|
## SDK API
|
|
11
11
|
|
|
12
|
+
> ⚠️ **VALUES ARE IN MILLISECONDS.** `idleTimeoutPeriodBeforePrompt: 180` is **180 ms**, not 180 seconds — so the prompt fires the instant you join alone and the call exits in a fraction of a second (real customer bug, 2026-06). Always `* 1000`: 3 minutes = `180_000`.
|
|
13
|
+
|
|
14
|
+
Two equivalent ways to set it — **match whichever your join path uses:**
|
|
15
|
+
|
|
12
16
|
```ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
// (a) SessionSettings OBJECT — the session-mode path: joinSession(token, settings, container)
|
|
18
|
+
const settings = {
|
|
19
|
+
idleTimeoutPeriodBeforePrompt: 180_000, // 180s before the "still there?" prompt
|
|
20
|
+
idleTimeoutPeriodAfterPrompt: 60_000, // 60s grace (this is the SDK MINIMUM)
|
|
21
|
+
};
|
|
22
|
+
await CometChatCalls.joinSession(token, settings, containerRef.current);
|
|
23
|
+
|
|
24
|
+
// (b) Builder — the kit's callSettingsBuilder prop. ⚠️ The builder has ONLY a
|
|
25
|
+
// single .setIdleTimeoutPeriod(ms) — there are NO setIdleTimeoutPeriodBeforePrompt /
|
|
26
|
+
// setIdleTimeoutPeriodAfterPrompt builder methods. The before/after-prompt SPLIT
|
|
27
|
+
// exists only as the SessionSettings object fields in form (a) above.
|
|
28
|
+
const builder = new CometChatCalls.CallSettingsBuilder()
|
|
29
|
+
.setIdleTimeoutPeriod(180_000);
|
|
18
30
|
|
|
19
31
|
CometChatCalls.addEventListener("onSessionTimedOut", () => {
|
|
20
32
|
// Navigate away, show "session ended" UI
|
|
21
33
|
});
|
|
22
34
|
```
|
|
23
35
|
|
|
24
|
-
| Setting | Default | Min |
|
|
36
|
+
| Setting | Default | Min | Unit |
|
|
25
37
|
|---|---|---|---|
|
|
26
|
-
| `idleTimeoutPeriodBeforePrompt` | 60_000 (60s) |
|
|
27
|
-
| `idleTimeoutPeriodAfterPrompt` | 120_000 (120s) | 60_000 (60s)
|
|
38
|
+
| `idleTimeoutPeriodBeforePrompt` | 60_000 (60s) | — (don't use 0 / tiny — instant prompt) | **milliseconds** |
|
|
39
|
+
| `idleTimeoutPeriodAfterPrompt` | 120_000 (120s) | **60_000 (60s)** — smaller is silently clamped to 60s | **milliseconds** |
|
|
28
40
|
|
|
29
41
|
The SDK shows the prompt overlay automatically (kit's default UI). For custom UI you handle the prompt yourself.
|
|
30
42
|
|
|
@@ -132,10 +144,11 @@ function CustomCallView() {
|
|
|
132
144
|
### Pattern B — Long timeouts + custom prompt only
|
|
133
145
|
|
|
134
146
|
```ts
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
// SessionSettings object for joinSession (these before/after fields are object-only).
|
|
148
|
+
const settings = {
|
|
149
|
+
idleTimeoutPeriodBeforePrompt: 86_400_000, // 24 hours — effectively disabled
|
|
150
|
+
idleTimeoutPeriodAfterPrompt: 86_400_000,
|
|
151
|
+
};
|
|
139
152
|
```
|
|
140
153
|
|
|
141
154
|
Then implement your own timeout via Pattern A. Useful when you want UX-customized prompts instead of the SDK's default overlay.
|
|
@@ -10,10 +10,9 @@ Text messaging during a video/voice call. SDK provides the chat button in the co
|
|
|
10
10
|
## SDK API
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.build();
|
|
13
|
+
// SessionSettings object passed to joinSession(token, settings, container).
|
|
14
|
+
// hideChatButton is a SessionSettings field, not a CallSettingsBuilder method.
|
|
15
|
+
const settings = { hideChatButton: false }; // show the kit's built-in chat button
|
|
17
16
|
|
|
18
17
|
CometChatCalls.addEventListener("onChatButtonClicked", () => {
|
|
19
18
|
// Open your chat panel
|
|
@@ -56,7 +55,7 @@ async function joinCallGroup(sessionId: string): Promise<void> {
|
|
|
56
55
|
}
|
|
57
56
|
```
|
|
58
57
|
|
|
59
|
-
Wire this into your call-start flow: after `
|
|
58
|
+
Wire this into your call-start flow: after `joinSession` succeeds, `joinCallGroup`.
|
|
60
59
|
|
|
61
60
|
---
|
|
62
61
|
|
|
@@ -83,8 +82,9 @@ function InCallChatPanel({ sessionId }: InCallChatPanelProps) {
|
|
|
83
82
|
// Listen for the SDK's button click
|
|
84
83
|
useEffect(() => {
|
|
85
84
|
const handler = () => setOpen(true);
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
// addEventListener returns an unsubscribe fn — there is no removeEventListener.
|
|
86
|
+
const off = CometChatCalls.addEventListener("onChatButtonClicked", handler);
|
|
87
|
+
return () => off();
|
|
88
88
|
}, []);
|
|
89
89
|
|
|
90
90
|
// Resolve the group object for the message list
|
|
@@ -35,8 +35,8 @@ If you're using CometChat UI Kits, this is enough — the kit's calls integratio
|
|
|
35
35
|
v5 introduces a dedicated Calls SDK auth step. After the user logs into the Chat SDK, call:
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
-
const authToken = (await CometChat.
|
|
39
|
-
await CometChatCalls.
|
|
38
|
+
const authToken = (await CometChat.getLoggedInUser())!.getAuthToken();
|
|
39
|
+
await CometChatCalls.loginWithAuthToken(authToken); // login() takes a uid; use loginWithAuthToken for a token
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
After this, `generateToken()` and `joinSession()` no longer need an authToken parameter.
|
|
@@ -120,11 +120,10 @@ After this, `generateToken()` and `joinSession()` no longer need an authToken pa
|
|
|
120
120
|
|
|
121
121
|
- CometChatCalls.startScreenShare()
|
|
122
122
|
+ CometChatCalls.startScreenSharing()
|
|
123
|
-
|
|
124
|
-
- CometChatCalls.enterPIPMode()
|
|
125
|
-
+ CometChatCalls.enablePictureInPictureLayout()
|
|
126
123
|
```
|
|
127
124
|
|
|
125
|
+
> PiP rename: v4's `enterPIPMode()` became the static `CometChatCalls.enablePictureInPictureLayout()` in v5 (paired with `disablePictureInPictureLayout()`). Note the `onPictureInPictureLayoutEnabled` / `...Disabled` **callbacks are on `MobileSDKEvents`, not `WebSDKEvents`** — they are NOT subscribable via `CometChatCalls.addEventListener` on the web SDK (verified in `@cometchat/calls-sdk-javascript` `index.d.ts`: `MobileSDKEvents` vs `WebSDKEvents`). On **web**, prefer browser-native picture-in-picture — see `references/picture-in-picture.md`.
|
|
126
|
+
|
|
128
127
|
---
|
|
129
128
|
|
|
130
129
|
## Step 7 — `startSession` → `joinSession`
|
|
@@ -134,14 +133,13 @@ After this, `generateToken()` and `joinSession()` no longer need an authToken pa
|
|
|
134
133
|
- CometChatCalls.startSession(token, callSettings, container);
|
|
135
134
|
- });
|
|
136
135
|
|
|
137
|
-
+ CometChatCalls.generateToken(sessionId).then((token) => {
|
|
136
|
+
+ CometChatCalls.generateToken(sessionId).then(({ token }) => {
|
|
138
137
|
+ CometChatCalls.joinSession(token, sessionSettings, container);
|
|
139
138
|
+ });
|
|
140
|
-
+
|
|
141
|
-
+ // Or — pass the sessionId directly (no manual token mint):
|
|
142
|
-
+ CometChatCalls.joinSession(sessionId, sessionSettings, container);
|
|
143
139
|
```
|
|
144
140
|
|
|
141
|
+
> `joinSession`'s first arg is the **callToken** (from `generateToken`), not a sessionId — there is no token-free join. `generateToken` resolves to `{ token }`, so destructure it.
|
|
142
|
+
|
|
145
143
|
---
|
|
146
144
|
|
|
147
145
|
## Removed methods (no v5 replacement)
|
|
@@ -154,7 +152,7 @@ After this, `generateToken()` and `joinSession()` no longer need an authToken pa
|
|
|
154
152
|
## Verification checklist
|
|
155
153
|
|
|
156
154
|
- [ ] `package.json` lists `@cometchat/calls-sdk-javascript@^5`
|
|
157
|
-
- [ ] `await CometChatCalls.
|
|
155
|
+
- [ ] `await CometChatCalls.loginWithAuthToken(authToken)` called after `CometChat.login`
|
|
158
156
|
- [ ] `OngoingCallListener` removed; granular `addEventListener` calls in place with cleanup
|
|
159
157
|
- [ ] `startSession` replaced with `joinSession`
|
|
160
158
|
- [ ] `endSession` replaced with `leaveSession`
|
|
@@ -169,4 +167,4 @@ After this, `generateToken()` and `joinSession()` no longer need an authToken pa
|
|
|
169
167
|
- Canonical migration guide: https://www.cometchat.com/docs/calls/javascript/migration-guide-v5
|
|
170
168
|
- `cometchat-react-calls/SKILL.md` — current architecture (v5)
|
|
171
169
|
- `cometchat-react-calls/references/call-layouts.md` — layout enum migration
|
|
172
|
-
- `cometchat-react-calls/references/recording.md` — recording events migration
|
|
170
|
+
- `cometchat-react-calls/references/recording-screen-share.md` — recording events migration
|
|
@@ -31,10 +31,11 @@ CometChatCalls.addEventListener("onParticipantHandLowered", (participant) => {
|
|
|
31
31
|
The SDK ships a built-in raise-hand button in the default control panel. Hide it via call settings if you're rolling custom UI:
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// SessionSettings object passed to joinSession(token, settings, container).
|
|
35
|
+
// hideRaiseHandButton is a SessionSettings field — NOT a CallSettingsBuilder
|
|
36
|
+
// method, and there is no setSessionID (the session is carried by the token
|
|
37
|
+
// from generateToken(sessionId)).
|
|
38
|
+
const settings = { hideRaiseHandButton: true }; // suppress the SDK's button — your UI takes over
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
---
|
|
@@ -108,12 +109,13 @@ function RaisedHandsList() {
|
|
|
108
109
|
});
|
|
109
110
|
};
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
CometChatCalls.addEventListener("
|
|
112
|
+
// addEventListener returns an unsubscribe fn — there is no removeEventListener.
|
|
113
|
+
const offRaised = CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
|
|
114
|
+
const offLowered = CometChatCalls.addEventListener("onParticipantHandLowered", onLowered);
|
|
113
115
|
|
|
114
116
|
return () => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
offRaised();
|
|
118
|
+
offLowered();
|
|
117
119
|
};
|
|
118
120
|
}, []);
|
|
119
121
|
|
|
@@ -144,8 +146,8 @@ useEffect(() => {
|
|
|
144
146
|
const onRaised = (p: { name: string }) => {
|
|
145
147
|
toast.info(`${p.name} raised their hand`, { duration: 4000 });
|
|
146
148
|
};
|
|
147
|
-
CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
|
|
148
|
-
return () =>
|
|
149
|
+
const offRaised = CometChatCalls.addEventListener("onParticipantHandRaised", onRaised);
|
|
150
|
+
return () => offRaised();
|
|
149
151
|
}, []);
|
|
150
152
|
```
|
|
151
153
|
|
|
@@ -194,10 +196,8 @@ If using the kit's `<CometChatOngoingCall />` and want raise-hand off entirely (
|
|
|
194
196
|
```tsx
|
|
195
197
|
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
.hideRaiseHandButton(true)
|
|
200
|
-
.build();
|
|
199
|
+
// SessionSettings object for joinSession (hideRaiseHandButton is an object field).
|
|
200
|
+
const settings = { hideRaiseHandButton: true };
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
For 1:1 calls, default to hidden. For group calls > 5 participants, default to shown.
|
|
@@ -13,35 +13,39 @@ Recording is a paid feature gated by your CometChat plan. Enable it in **Dashboa
|
|
|
13
13
|
### Client-side: opt-in per session
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
// SessionSettings object passed to joinSession(token, settings, container).
|
|
17
|
+
// These are object fields — NOT CallSettingsBuilder methods (the v4 builder had
|
|
18
|
+
// enableRecording/setShowRecordingButton; v5 uses the object below).
|
|
19
|
+
const settings = {
|
|
20
|
+
sessionType: 'VIDEO', // 'VOICE' for audio-only (replaces setIsAudioOnly)
|
|
21
|
+
autoStartRecording: true, // ← server starts recording when the session begins
|
|
22
|
+
hideRecordingButton: false, // ← keep the user-toggleable Record button visible
|
|
23
|
+
};
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
Two
|
|
26
|
+
Two fields, two behaviors:
|
|
25
27
|
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
+
- `autoStartRecording: true` — recording starts the moment the session begins. Server-side flag.
|
|
29
|
+
- `hideRecordingButton: false` — exposes a "Record" toggle in the default control panel. User decides when to start/stop. Custom-UI code must wire its own button (`CometChatCalls.startRecording()` / `stopRecording()` — there is no `toggleRecording()`; track state yourself and call the right one).
|
|
28
30
|
|
|
29
31
|
**Compliance note:** in some jurisdictions you must notify all participants before recording starts. The default kit UI shows a small "Recording" indicator; if you're using custom UI, you must render this yourself. The skill's verification checklist flags this.
|
|
30
32
|
|
|
31
33
|
### Recording lifecycle events
|
|
32
34
|
|
|
33
35
|
```ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
onRecordingStopped: (rec: unknown) => {
|
|
39
|
-
// server stopped — file will appear in dashboard within ~30 seconds
|
|
40
|
-
},
|
|
41
|
-
onRecordingFailed: (error: unknown) => {
|
|
42
|
-
// surface to UI — usually plan limits or storage quota
|
|
43
|
-
},
|
|
36
|
+
// v5 uses the static event bus; addEventListener returns an unsubscribe fn.
|
|
37
|
+
const offStarted = CometChatCalls.addEventListener("onRecordingStarted", () => {
|
|
38
|
+
// server confirmed recording is active
|
|
44
39
|
});
|
|
40
|
+
const offStopped = CometChatCalls.addEventListener("onRecordingStopped", () => {
|
|
41
|
+
// server stopped — file will appear in dashboard within ~30 seconds
|
|
42
|
+
});
|
|
43
|
+
// Cleanup when the call ends: offStarted(); offStopped();
|
|
44
|
+
//
|
|
45
|
+
// NOTE: there is no `onRecordingFailed` event on the v5 bus (and no
|
|
46
|
+
// onRecordingFailed member on OngoingCallListener). Plan-limit / storage-quota
|
|
47
|
+
// failures surface as a rejection from generateToken/joinSession or a server
|
|
48
|
+
// error — handle those, not a dedicated recording-failed callback.
|
|
45
49
|
```
|
|
46
50
|
|
|
47
51
|
### Where the recordings go
|
|
@@ -54,7 +58,7 @@ CometChat hosts the file. It appears in **Dashboard → Calls → Recordings** w
|
|
|
54
58
|
|
|
55
59
|
### Two roles: presenter + viewer
|
|
56
60
|
|
|
57
|
-
- **Presenter** (the user sharing their screen) — calls `CometChatCalls.
|
|
61
|
+
- **Presenter** (the user sharing their screen) — calls `CometChatCalls.startScreenSharing()`; the SDK handles `getDisplayMedia` + signaling internally
|
|
58
62
|
- **Viewer** (everyone else) — sees the presenter's screen as another video tile, no special API call needed
|
|
59
63
|
|
|
60
64
|
Browser support: Chrome/Edge (full), Firefox (full), Safari 13+ (full). On mobile browsers, `getDisplayMedia` is supported on iOS 16+ Safari and recent Android Chrome.
|
|
@@ -64,7 +68,7 @@ Browser support: Chrome/Edge (full), Firefox (full), Safari 13+ (full). On mobil
|
|
|
64
68
|
```ts
|
|
65
69
|
async function startScreenShare() {
|
|
66
70
|
try {
|
|
67
|
-
|
|
71
|
+
CometChatCalls.startScreenSharing();
|
|
68
72
|
// SDK handled getDisplayMedia + signaling; UI updates via onScreenShareStarted
|
|
69
73
|
} catch (err: unknown) {
|
|
70
74
|
if ((err as Error).name === "NotAllowedError") {
|
|
@@ -79,37 +83,34 @@ async function startScreenShare() {
|
|
|
79
83
|
Stop sharing:
|
|
80
84
|
|
|
81
85
|
```ts
|
|
82
|
-
CometChatCalls.
|
|
86
|
+
CometChatCalls.stopScreenSharing();
|
|
83
87
|
```
|
|
84
88
|
|
|
85
|
-
The browser also fires its own "Stop sharing" button (the system overlay Chrome shows during a screen-share). The SDK listens for this too; `
|
|
89
|
+
The browser also fires its own "Stop sharing" button (the system overlay Chrome shows during a screen-share). The SDK listens for this too; `onScreenShareStopped` fires either way.
|
|
86
90
|
|
|
87
91
|
### Viewer — listen for screen-share events
|
|
88
92
|
|
|
89
93
|
```ts
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (screenShareVideoRef.current) {
|
|
99
|
-
screenShareVideoRef.current.srcObject = null;
|
|
100
|
-
}
|
|
101
|
-
},
|
|
94
|
+
// The v5 bus callbacks take NO arguments — they're notifications, not stream
|
|
95
|
+
// handoffs. The SDK renders the presenter's screen as a tile in its own layout;
|
|
96
|
+
// you don't receive a MediaStream to attach yourself (that was the v4 model).
|
|
97
|
+
const offStart = CometChatCalls.addEventListener("onScreenShareStarted", () => {
|
|
98
|
+
setSomeoneSharing(true);
|
|
99
|
+
});
|
|
100
|
+
const offStop = CometChatCalls.addEventListener("onScreenShareStopped", () => {
|
|
101
|
+
setSomeoneSharing(false);
|
|
102
102
|
});
|
|
103
|
+
// Cleanup: offStart(); offStop();
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
The SDK composes the screen-share tile alongside the camera tiles automatically. (Truly hand-rendering the shared stream requires the deprecated `OngoingCallListener` + `startSession` track-level path — see `custom-ui.md`.)
|
|
106
107
|
|
|
107
108
|
### Audio passthrough during screen share
|
|
108
109
|
|
|
109
110
|
By default, `getDisplayMedia` captures video only. To capture system audio (for sharing a video with sound), pass `audio: true`:
|
|
110
111
|
|
|
111
112
|
```ts
|
|
112
|
-
// Browser-level API — the SDK's
|
|
113
|
+
// Browser-level API — the SDK's startScreenSharing wraps this internally
|
|
113
114
|
const stream = await navigator.mediaDevices.getDisplayMedia({
|
|
114
115
|
video: true,
|
|
115
116
|
audio: true,
|
|
@@ -118,7 +119,7 @@ const stream = await navigator.mediaDevices.getDisplayMedia({
|
|
|
118
119
|
|
|
119
120
|
Browser support is uneven — Chrome desktop has it; Firefox does not; Safari has it for tab capture but not full-screen.
|
|
120
121
|
|
|
121
|
-
The Calls SDK's `
|
|
122
|
+
The Calls SDK's `startScreenSharing()` does NOT request audio by default. If you need audio passthrough, use the lower-level `getDisplayMedia` API directly + pipe the audio track via a custom track-add hook (covered in `custom-ui.md`).
|
|
122
123
|
|
|
123
124
|
---
|
|
124
125
|
|
|
@@ -242,7 +242,7 @@ function IncomingCallScreen({ call, onAccept, onReject }: Props) {
|
|
|
242
242
|
- [ ] `onCallEndedMessageReceived` tears down UI when other party ends
|
|
243
243
|
- [ ] `onIncomingCallCancelled` tears down UI when caller cancels mid-ring
|
|
244
244
|
- [ ] Custom UI: `role="alertdialog"`, ringtone audio, accept/decline buttons with aria-labels
|
|
245
|
-
- [ ] Smoke:
|
|
245
|
+
- [ ] Smoke: **two ISOLATED browser contexts** (normal + Incognito window, or two browsers/devices — NOT two tabs of one browser; the Chat SDK is a single shared session per origin, so a second tab can't be an independent callee), caller initiates → recipient sees custom incoming UI → accept → both join session → either ends → both UIs dismiss
|
|
246
246
|
|
|
247
247
|
---
|
|
248
248
|
|
|
@@ -251,5 +251,5 @@ function IncomingCallScreen({ call, onAccept, onReject }: Props) {
|
|
|
251
251
|
- `cometchat-react-calls/SKILL.md` — architecture + seven hard rules
|
|
252
252
|
- `cometchat-react-calls/references/call-session.md` — Mode 3 (joinSession with no ringing)
|
|
253
253
|
- `cometchat-react-calls/references/in-call-chat.md` — chat panel during a call
|
|
254
|
-
- `cometchat-react-calls/references/recording.md` — recording mid-call
|
|
254
|
+
- `cometchat-react-calls/references/recording-screen-share.md` — recording mid-call
|
|
255
255
|
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/ringing
|