@capgo/capacitor-stream-call 7.1.30 → 7.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/README.md +82 -10
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +0 -6
- package/android/src/main/java/ee/forgr/capacitor/streamcall/AcceptCallReceiver.kt +1 -1
- package/android/src/main/java/ee/forgr/capacitor/streamcall/CustomStreamIntentResolver.kt +2 -2
- package/android/src/main/java/ee/forgr/capacitor/streamcall/StreamCallPlugin.kt +2937 -2464
- package/android/src/main/res/raw/outgoing.mp3 +0 -0
- package/dist/docs.json +185 -1
- package/dist/esm/definitions.d.ts +55 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/StreamCallPlugin/StreamCallPlugin.swift +420 -136
- package/ios/Sources/StreamCallPlugin/TouchInterceptView.swift +35 -30
- package/package.json +1 -1
|
Binary file
|
package/dist/docs.json
CHANGED
|
@@ -120,6 +120,37 @@
|
|
|
120
120
|
],
|
|
121
121
|
"slug": "endcall"
|
|
122
122
|
},
|
|
123
|
+
{
|
|
124
|
+
"name": "joinCall",
|
|
125
|
+
"signature": "(options: { callId: string; callType: string; }) => Promise<SuccessResponse>",
|
|
126
|
+
"parameters": [
|
|
127
|
+
{
|
|
128
|
+
"name": "options",
|
|
129
|
+
"docs": "- Microphone state",
|
|
130
|
+
"type": "{ callId: string; callType: string; }"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"returns": "Promise<SuccessResponse>",
|
|
134
|
+
"tags": [
|
|
135
|
+
{
|
|
136
|
+
"name": "param",
|
|
137
|
+
"text": "options - Microphone state"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "returns",
|
|
141
|
+
"text": "Success status"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "example",
|
|
145
|
+
"text": "await StreamCall.joinCall({ callId: 'call001', callType: 'default' });"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"docs": "Join an existing call",
|
|
149
|
+
"complexTypes": [
|
|
150
|
+
"SuccessResponse"
|
|
151
|
+
],
|
|
152
|
+
"slug": "joincall"
|
|
153
|
+
},
|
|
123
154
|
{
|
|
124
155
|
"name": "setMicrophoneEnabled",
|
|
125
156
|
"signature": "(options: { enabled: boolean; }) => Promise<SuccessResponse>",
|
|
@@ -263,6 +294,27 @@
|
|
|
263
294
|
"complexTypes": [],
|
|
264
295
|
"slug": "removealllisteners"
|
|
265
296
|
},
|
|
297
|
+
{
|
|
298
|
+
"name": "enableBluetooth",
|
|
299
|
+
"signature": "() => Promise<SuccessResponse>",
|
|
300
|
+
"parameters": [],
|
|
301
|
+
"returns": "Promise<SuccessResponse>",
|
|
302
|
+
"tags": [
|
|
303
|
+
{
|
|
304
|
+
"name": "returns",
|
|
305
|
+
"text": "Success status"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "example",
|
|
309
|
+
"text": "await StreamCall.enableBluetooth();"
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"docs": "Enable bluetooth audio",
|
|
313
|
+
"complexTypes": [
|
|
314
|
+
"SuccessResponse"
|
|
315
|
+
],
|
|
316
|
+
"slug": "enablebluetooth"
|
|
317
|
+
},
|
|
266
318
|
{
|
|
267
319
|
"name": "acceptCall",
|
|
268
320
|
"signature": "() => Promise<SuccessResponse>",
|
|
@@ -347,6 +399,48 @@
|
|
|
347
399
|
],
|
|
348
400
|
"slug": "getcallstatus"
|
|
349
401
|
},
|
|
402
|
+
{
|
|
403
|
+
"name": "getRingingCall",
|
|
404
|
+
"signature": "() => Promise<CallEvent>",
|
|
405
|
+
"parameters": [],
|
|
406
|
+
"returns": "Promise<CallEvent>",
|
|
407
|
+
"tags": [
|
|
408
|
+
{
|
|
409
|
+
"name": "returns",
|
|
410
|
+
"text": "Current ringing call status as a CallEvent"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "example",
|
|
414
|
+
"text": "const ringingCall = await StreamCall.getRingingCall();\nconsole.log(ringingCall);"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"docs": "Get the current ringing call",
|
|
418
|
+
"complexTypes": [
|
|
419
|
+
"CallEvent"
|
|
420
|
+
],
|
|
421
|
+
"slug": "getringingcall"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"name": "toggleViews",
|
|
425
|
+
"signature": "() => Promise<{ newLayout: StreamCallLayout; }>",
|
|
426
|
+
"parameters": [],
|
|
427
|
+
"returns": "Promise<{ newLayout: StreamCallLayout; }>",
|
|
428
|
+
"tags": [
|
|
429
|
+
{
|
|
430
|
+
"name": "returns",
|
|
431
|
+
"text": "The layout that is now active"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"name": "example",
|
|
435
|
+
"text": "const { newLayout } = await StreamCall.toggleViews();\nconsole.log(`Layout switched to ${newLayout}`);"
|
|
436
|
+
}
|
|
437
|
+
],
|
|
438
|
+
"docs": "Cycle through the available video layouts",
|
|
439
|
+
"complexTypes": [
|
|
440
|
+
"StreamCallLayout"
|
|
441
|
+
],
|
|
442
|
+
"slug": "toggleviews"
|
|
443
|
+
},
|
|
350
444
|
{
|
|
351
445
|
"name": "setSpeaker",
|
|
352
446
|
"signature": "(options: { name: string; }) => Promise<SuccessResponse>",
|
|
@@ -535,6 +629,13 @@
|
|
|
535
629
|
"docs": "Whether the operation was successful",
|
|
536
630
|
"complexTypes": [],
|
|
537
631
|
"type": "boolean"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"name": "callId",
|
|
635
|
+
"tags": [],
|
|
636
|
+
"docs": "",
|
|
637
|
+
"complexTypes": [],
|
|
638
|
+
"type": "string | undefined"
|
|
538
639
|
}
|
|
539
640
|
]
|
|
540
641
|
},
|
|
@@ -821,6 +922,22 @@
|
|
|
821
922
|
"CallMember"
|
|
822
923
|
],
|
|
823
924
|
"type": "CallMember[] | undefined"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"name": "custom",
|
|
928
|
+
"tags": [],
|
|
929
|
+
"docs": "",
|
|
930
|
+
"complexTypes": [
|
|
931
|
+
"Record"
|
|
932
|
+
],
|
|
933
|
+
"type": "Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"name": "count",
|
|
937
|
+
"tags": [],
|
|
938
|
+
"docs": "",
|
|
939
|
+
"complexTypes": [],
|
|
940
|
+
"type": "number | undefined"
|
|
824
941
|
}
|
|
825
942
|
]
|
|
826
943
|
},
|
|
@@ -1392,7 +1509,27 @@
|
|
|
1392
1509
|
"name": "property"
|
|
1393
1510
|
}
|
|
1394
1511
|
],
|
|
1395
|
-
"methods": [
|
|
1512
|
+
"methods": [
|
|
1513
|
+
{
|
|
1514
|
+
"name": "getPluginVersion",
|
|
1515
|
+
"signature": "() => Promise<{ version: string; }>",
|
|
1516
|
+
"parameters": [],
|
|
1517
|
+
"returns": "Promise<{ version: string; }>",
|
|
1518
|
+
"tags": [
|
|
1519
|
+
{
|
|
1520
|
+
"name": "returns",
|
|
1521
|
+
"text": "an Promise with version for this device"
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
"name": "throws",
|
|
1525
|
+
"text": "An error if the something went wrong"
|
|
1526
|
+
}
|
|
1527
|
+
],
|
|
1528
|
+
"docs": "Get the native Capacitor plugin version",
|
|
1529
|
+
"complexTypes": [],
|
|
1530
|
+
"slug": "getpluginversion"
|
|
1531
|
+
}
|
|
1532
|
+
],
|
|
1396
1533
|
"properties": [
|
|
1397
1534
|
{
|
|
1398
1535
|
"name": "cid",
|
|
@@ -1687,6 +1824,10 @@
|
|
|
1687
1824
|
"text": "'default'",
|
|
1688
1825
|
"complexTypes": []
|
|
1689
1826
|
},
|
|
1827
|
+
{
|
|
1828
|
+
"text": "'audio'",
|
|
1829
|
+
"complexTypes": []
|
|
1830
|
+
},
|
|
1690
1831
|
{
|
|
1691
1832
|
"text": "'audio_room'",
|
|
1692
1833
|
"complexTypes": []
|
|
@@ -1760,6 +1901,10 @@
|
|
|
1760
1901
|
"text": "'rejected'",
|
|
1761
1902
|
"complexTypes": []
|
|
1762
1903
|
},
|
|
1904
|
+
{
|
|
1905
|
+
"text": "'participant_counts'",
|
|
1906
|
+
"complexTypes": []
|
|
1907
|
+
},
|
|
1763
1908
|
{
|
|
1764
1909
|
"text": "'missed'",
|
|
1765
1910
|
"complexTypes": []
|
|
@@ -1780,6 +1925,14 @@
|
|
|
1780
1925
|
"text": "'camera_disabled'",
|
|
1781
1926
|
"complexTypes": []
|
|
1782
1927
|
},
|
|
1928
|
+
{
|
|
1929
|
+
"text": "'speaker_enabled'",
|
|
1930
|
+
"complexTypes": []
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
"text": "'speaker_disabled'",
|
|
1934
|
+
"complexTypes": []
|
|
1935
|
+
},
|
|
1783
1936
|
{
|
|
1784
1937
|
"text": "'microphone_enabled'",
|
|
1785
1938
|
"complexTypes": []
|
|
@@ -1788,11 +1941,42 @@
|
|
|
1788
1941
|
"text": "'microphone_disabled'",
|
|
1789
1942
|
"complexTypes": []
|
|
1790
1943
|
},
|
|
1944
|
+
{
|
|
1945
|
+
"text": "'outgoing_call_ended'",
|
|
1946
|
+
"complexTypes": []
|
|
1947
|
+
},
|
|
1791
1948
|
{
|
|
1792
1949
|
"text": "'unknown'",
|
|
1793
1950
|
"complexTypes": []
|
|
1794
1951
|
}
|
|
1795
1952
|
]
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
"name": "StreamCallLayout",
|
|
1956
|
+
"slug": "streamcalllayout",
|
|
1957
|
+
"docs": "",
|
|
1958
|
+
"types": [
|
|
1959
|
+
{
|
|
1960
|
+
"text": "'grid'",
|
|
1961
|
+
"complexTypes": []
|
|
1962
|
+
},
|
|
1963
|
+
{
|
|
1964
|
+
"text": "'spotlight'",
|
|
1965
|
+
"complexTypes": []
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
"text": "'dynamic'",
|
|
1969
|
+
"complexTypes": []
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
"text": "'fullScreen'",
|
|
1973
|
+
"complexTypes": []
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
"text": "'fullscreen'",
|
|
1977
|
+
"complexTypes": []
|
|
1978
|
+
}
|
|
1979
|
+
]
|
|
1796
1980
|
}
|
|
1797
1981
|
],
|
|
1798
1982
|
"pluginConfigs": []
|
|
@@ -31,7 +31,7 @@ export interface PushNotificationsConfig {
|
|
|
31
31
|
* @typedef CallState
|
|
32
32
|
* @description Represents all possible call states from API and UI
|
|
33
33
|
*/
|
|
34
|
-
export type CallState = 'idle' | 'ringing' | 'joining' | 'reconnecting' | 'joined' | 'leaving' | 'left' | 'created' | 'session_started' | 'rejected' | 'missed' | 'accepted' | 'ended' | 'camera_enabled' | 'camera_disabled' | 'microphone_enabled' | 'microphone_disabled' | 'unknown';
|
|
34
|
+
export type CallState = 'idle' | 'ringing' | 'joining' | 'reconnecting' | 'joined' | 'leaving' | 'left' | 'created' | 'session_started' | 'rejected' | 'participant_counts' | 'missed' | 'accepted' | 'ended' | 'camera_enabled' | 'camera_disabled' | 'speaker_enabled' | 'speaker_disabled' | 'microphone_enabled' | 'microphone_disabled' | 'outgoing_call_ended' | 'unknown';
|
|
35
35
|
/**
|
|
36
36
|
* @typedef CallType
|
|
37
37
|
* @description Represents the pre-defined types of a call.
|
|
@@ -40,7 +40,12 @@ export type CallState = 'idle' | 'ringing' | 'joining' | 'reconnecting' | 'joine
|
|
|
40
40
|
* - `livestream`: For one-to-many streaming. Backstage enabled (requires `goLive`), access granted to all authenticated users.
|
|
41
41
|
* - `development`: For testing ONLY. All permissions enabled, backstage disabled. **Not recommended for production.**
|
|
42
42
|
*/
|
|
43
|
-
export type CallType = 'default' | 'audio_room' | 'livestream' | 'development';
|
|
43
|
+
export type CallType = 'default' | 'audio' | 'audio_room' | 'livestream' | 'development';
|
|
44
|
+
/**
|
|
45
|
+
* @typedef StreamCallLayout
|
|
46
|
+
* @description Layout modes matching the Stream React SDK; includes native aliases.
|
|
47
|
+
*/
|
|
48
|
+
export type StreamCallLayout = 'grid' | 'spotlight' | 'dynamic' | 'fullScreen' | 'fullscreen';
|
|
44
49
|
/**
|
|
45
50
|
* @interface CallMember
|
|
46
51
|
* @description Information about a call member/participant
|
|
@@ -82,6 +87,8 @@ export interface CallEvent {
|
|
|
82
87
|
caller?: CallMember;
|
|
83
88
|
/** List of call members */
|
|
84
89
|
members?: CallMember[];
|
|
90
|
+
custom?: Record<string, string | boolean | number | null | Record<string, string | boolean | number | null> | string[] | boolean[] | number[]>;
|
|
91
|
+
count?: number;
|
|
85
92
|
}
|
|
86
93
|
export interface CameraEnabledResponse {
|
|
87
94
|
enabled: boolean;
|
|
@@ -124,6 +131,7 @@ export interface CurrentUserResponse {
|
|
|
124
131
|
export interface SuccessResponse {
|
|
125
132
|
/** Whether the operation was successful */
|
|
126
133
|
success: boolean;
|
|
134
|
+
callId?: string;
|
|
127
135
|
}
|
|
128
136
|
/**
|
|
129
137
|
* @interface CallOptions
|
|
@@ -191,6 +199,17 @@ export interface StreamCallPlugin {
|
|
|
191
199
|
* await StreamCall.endCall();
|
|
192
200
|
*/
|
|
193
201
|
endCall(): Promise<SuccessResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* Join an existing call
|
|
204
|
+
* @param {{ callId: string, callType: string }} options - Microphone state
|
|
205
|
+
* @returns {Promise<SuccessResponse>} Success status
|
|
206
|
+
* @example
|
|
207
|
+
* await StreamCall.joinCall({ callId: 'call001', callType: 'default' });
|
|
208
|
+
*/
|
|
209
|
+
joinCall?(options: {
|
|
210
|
+
callId: string;
|
|
211
|
+
callType: string;
|
|
212
|
+
}): Promise<SuccessResponse>;
|
|
194
213
|
/**
|
|
195
214
|
* Enable or disable microphone
|
|
196
215
|
* @param {{ enabled: boolean }} options - Microphone state
|
|
@@ -238,6 +257,13 @@ export interface StreamCallPlugin {
|
|
|
238
257
|
* await StreamCall.removeAllListeners();
|
|
239
258
|
*/
|
|
240
259
|
removeAllListeners(): Promise<void>;
|
|
260
|
+
/**
|
|
261
|
+
* Enable bluetooth audio
|
|
262
|
+
* @returns {Promise<SuccessResponse>} Success status
|
|
263
|
+
* @example
|
|
264
|
+
* await StreamCall.enableBluetooth();
|
|
265
|
+
*/
|
|
266
|
+
enableBluetooth?(): Promise<SuccessResponse>;
|
|
241
267
|
/**
|
|
242
268
|
* Accept an incoming call
|
|
243
269
|
* @returns {Promise<SuccessResponse>} Success status
|
|
@@ -268,6 +294,24 @@ export interface StreamCallPlugin {
|
|
|
268
294
|
* console.log(callStatus);
|
|
269
295
|
*/
|
|
270
296
|
getCallStatus(): Promise<CallEvent>;
|
|
297
|
+
/**
|
|
298
|
+
* Get the current ringing call
|
|
299
|
+
* @returns {Promise<CallEvent>} Current ringing call status as a CallEvent
|
|
300
|
+
* @example
|
|
301
|
+
* const ringingCall = await StreamCall.getRingingCall();
|
|
302
|
+
* console.log(ringingCall);
|
|
303
|
+
*/
|
|
304
|
+
getRingingCall?(): Promise<CallEvent>;
|
|
305
|
+
/**
|
|
306
|
+
* Cycle through the available video layouts
|
|
307
|
+
* @returns {Promise<{ newLayout: StreamCallLayout }>} The layout that is now active
|
|
308
|
+
* @example
|
|
309
|
+
* const { newLayout } = await StreamCall.toggleViews();
|
|
310
|
+
* console.log(`Layout switched to ${newLayout}`);
|
|
311
|
+
*/
|
|
312
|
+
toggleViews?(): Promise<{
|
|
313
|
+
newLayout: StreamCallLayout;
|
|
314
|
+
}>;
|
|
271
315
|
/**
|
|
272
316
|
* Set speakerphone on
|
|
273
317
|
* @param {{ name: string }} options - Speakerphone name
|
|
@@ -342,4 +386,13 @@ export interface IncomingCallPayload {
|
|
|
342
386
|
caller?: CallMember;
|
|
343
387
|
/** Custom data to be passed to the call */
|
|
344
388
|
custom?: Record<string, string | boolean | number | null | Record<string, string | boolean | number | null> | string[] | boolean[] | number[]>;
|
|
389
|
+
/**
|
|
390
|
+
* Get the native Capacitor plugin version
|
|
391
|
+
*
|
|
392
|
+
* @returns {Promise<{ id: string }>} an Promise with version for this device
|
|
393
|
+
* @throws An error if the something went wrong
|
|
394
|
+
*/
|
|
395
|
+
getPluginVersion(): Promise<{
|
|
396
|
+
version: string;
|
|
397
|
+
}>;
|
|
345
398
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @interface LoginOptions\n * @description Configuration options for logging into the Stream Video service\n * @property {string} token - Stream Video API token for authentication\n * @property {string} userId - Unique identifier for the current user\n * @property {string} name - Display name for the current user\n * @property {string} [imageURL] - Avatar URL for the current user\n * @property {string} apiKey - Stream Video API key for your application\n * @property {string} [magicDivId] - DOM element ID where video will be rendered\n */\nexport interface LoginOptions {\n /** Stream Video API token */\n token: string;\n /** User ID for the current user */\n userId: string;\n /** Display name for the current user */\n name: string;\n /** Optional avatar URL for the current user */\n imageURL?: string;\n /** Stream Video API key */\n apiKey: string;\n /** ID of the HTML element where the video will be rendered */\n magicDivId?: string;\n pushNotificationsConfig?: PushNotificationsConfig;\n}\n\nexport interface PushNotificationsConfig {\n pushProviderName: string;\n voipProviderName: string;\n}\n\n/**\n * @typedef CallState\n * @description Represents all possible call states from API and UI\n */\nexport type CallState =\n // User-facing states\n | 'idle'\n | 'ringing'\n | 'joining'\n | 'reconnecting'\n | 'joined'\n | 'leaving'\n | 'left'\n // Event-specific states\n | 'created'\n | 'session_started'\n | 'rejected'\n | 'missed'\n | 'accepted'\n | 'ended'\n | 'camera_enabled'\n | 'camera_disabled'\n | 'microphone_enabled'\n | 'microphone_disabled'\n | 'unknown';\n\n/**\n * @typedef CallType\n * @description Represents the pre-defined types of a call.\n * - `default`: Simple 1-1 or group video calling with sensible defaults. Video/audio enabled, backstage disabled. Admins/hosts have elevated permissions.\n * - `audio_room`: For audio-only spaces (like Clubhouse). Backstage enabled (requires `goLive`), pre-configured permissions for requesting to speak.\n * - `livestream`: For one-to-many streaming. Backstage enabled (requires `goLive`), access granted to all authenticated users.\n * - `development`: For testing ONLY. All permissions enabled, backstage disabled. **Not recommended for production.**\n */\nexport type CallType = 'default' | 'audio_room' | 'livestream' | 'development';\n\n/**\n * @interface CallMember\n * @description Information about a call member/participant\n * @property {string} userId - User ID of the member\n * @property {string} [name] - Display name of the user\n * @property {string} [imageURL] - Profile image URL of the user\n * @property {string} [role] - Role of the user in the call\n */\nexport interface CallMember {\n /** User ID of the member */\n userId: string;\n /** Display name of the user */\n name?: string;\n /** Profile image URL of the user */\n imageURL?: string;\n /** Role of the user in the call */\n role?: string;\n}\n\n/**\n * @interface CallEvent\n * @description Event emitted when call state changes\n * @property {string} callId - Unique identifier of the call\n * @property {CallState} state - Current state of the call\n * @property {string} [userId] - User ID of the participant who triggered the event\n * @property {string} [reason] - Reason for the call state change\n * @property {CallMember} [caller] - Information about the caller (for incoming calls)\n * @property {CallMember[]} [members] - List of call members\n */\nexport interface CallEvent {\n /** ID of the call */\n callId: string;\n /** Current state of the call */\n state: CallState;\n /** User ID of the participant in the call who triggered the event */\n userId?: string;\n /** Reason for the call state change, if applicable */\n reason?: string;\n /** Information about the caller (for incoming calls) */\n caller?: CallMember;\n /** List of call members */\n members?: CallMember[];\n}\n\nexport interface CameraEnabledResponse {\n enabled: boolean;\n}\n\n/**\n * @interface DynamicApiKeyResponse\n * @description Response from getDynamicStreamVideoApikey\n * @property {string|null} apiKey - The dynamic API key if set, null if not\n * @property {boolean} hasDynamicKey - Whether a dynamic key is currently set\n */\nexport interface DynamicApiKeyResponse {\n /** The dynamic API key if set, null if not */\n apiKey: string | null;\n /** Whether a dynamic key is currently set */\n hasDynamicKey: boolean;\n}\n\n/**\n * @interface CurrentUserResponse\n * @description Response from getCurrentUser containing user information\n * @property {string} userId - User ID of the current user\n * @property {string} name - Display name of the current user\n * @property {string} [imageURL] - Avatar URL of the current user\n * @property {boolean} isLoggedIn - Whether the user is currently logged in\n */\nexport interface CurrentUserResponse {\n /** User ID of the current user */\n userId: string;\n /** Display name of the current user */\n name: string;\n /** Avatar URL of the current user */\n imageURL?: string;\n /** Whether the user is currently logged in */\n isLoggedIn: boolean;\n}\n\n/**\n * @interface SuccessResponse\n * @description Standard response indicating operation success/failure\n * @property {boolean} success - Whether the operation succeeded\n */\nexport interface SuccessResponse {\n /** Whether the operation was successful */\n success: boolean;\n}\n\n/**\n * @interface CallOptions\n * @description Options for initiating a video call\n * @property {string[]} userIds - IDs of the users to call\n * @property {CallType} [type=default] - Type of call\n * @property {boolean} [ring=true] - Whether to send ring notification\n * @property {string} [team] - Team name to call\n */\nexport interface CallOptions {\n /** User ID of the person to call */\n userIds: string[];\n /** Type of call, defaults to 'default' */\n type?: CallType;\n /** Whether to ring the other user, defaults to true */\n ring?: boolean;\n /** Team name to call */\n team?: string;\n /** Whether to start the call with video enabled, defaults to false */\n video?: boolean;\n /** Custom data to be passed to the call */\n custom?: Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >;\n}\n\n/**\n * @interface StreamCallPlugin\n * @description Capacitor plugin for Stream Video calling functionality\n */\nexport interface StreamCallPlugin {\n /**\n * Login to Stream Video service\n * @param {LoginOptions} options - Login configuration\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.login({\n * token: 'your-token',\n * userId: 'user-123',\n * name: 'John Doe',\n * apiKey: 'your-api-key'\n * });\n */\n login(options: LoginOptions): Promise<SuccessResponse>;\n\n /**\n * Logout from Stream Video service\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.logout();\n */\n logout(): Promise<SuccessResponse>;\n\n /**\n * Initiate a call to another user\n * @param {CallOptions} options - Call configuration\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.call({\n * userId: 'user-456',\n * type: 'video',\n * ring: true\n * });\n */\n call(options: CallOptions): Promise<SuccessResponse>;\n\n /**\n * End the current call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.endCall();\n */\n endCall(): Promise<SuccessResponse>;\n\n /**\n * Enable or disable microphone\n * @param {{ enabled: boolean }} options - Microphone state\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setMicrophoneEnabled({ enabled: false });\n */\n setMicrophoneEnabled(options: { enabled: boolean }): Promise<SuccessResponse>;\n\n /**\n * Enable or disable camera\n * @param {{ enabled: boolean }} options - Camera state\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setCameraEnabled({ enabled: false });\n */\n setCameraEnabled(options: { enabled: boolean }): Promise<SuccessResponse>;\n\n /**\n * Add listener for call events\n * @param {'callEvent'} eventName - Name of the event to listen for\n * @param {(event: CallEvent) => void} listenerFunc - Callback function\n * @returns {Promise<{ remove: () => Promise<void> }>} Function to remove listener\n * @example\n * const listener = await StreamCall.addListener('callEvent', (event) => {\n * console.log(`Call ${event.callId} is now ${event.state}`);\n * });\n */\n addListener(\n eventName: 'callEvent',\n listenerFunc: (event: CallEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Listen for lock-screen incoming call (Android only).\n * Fired when the app is shown by full-screen intent before user interaction.\n */\n addListener(\n eventName: 'incomingCall',\n listenerFunc: (event: IncomingCallPayload) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Remove all event listeners\n * @returns {Promise<void>}\n * @example\n * await StreamCall.removeAllListeners();\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Accept an incoming call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.acceptCall();\n */\n acceptCall(): Promise<SuccessResponse>;\n\n /**\n * Reject an incoming call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.rejectCall();\n */\n rejectCall(): Promise<SuccessResponse>;\n\n /**\n * Check if camera is enabled\n * @returns {Promise<CameraEnabledResponse>} Camera enabled status\n * @example\n * const isCameraEnabled = await StreamCall.isCameraEnabled();\n * console.log(isCameraEnabled);\n */\n isCameraEnabled(): Promise<CameraEnabledResponse>;\n\n /**\n * Get the current call status\n * @returns {Promise<CallEvent>} Current call status as a CallEvent\n * @example\n * const callStatus = await StreamCall.getCallStatus();\n * console.log(callStatus);\n */\n getCallStatus(): Promise<CallEvent>;\n\n /**\n * Set speakerphone on\n * @param {{ name: string }} options - Speakerphone name\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setSpeaker({ name: 'speaker' });\n */\n setSpeaker(options: { name: string }): Promise<SuccessResponse>;\n\n /**\n * Switch camera\n * @param {{ camera: 'front' | 'back' }} options - Camera to switch to\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.switchCamera({ camera: 'back' });\n */\n switchCamera(options: { camera: 'front' | 'back' }): Promise<SuccessResponse>;\n\n /**\n * Get detailed information about an active call including caller details\n * @param options - Options containing the call ID\n */\n getCallInfo(options: { callId: string }): Promise<CallEvent>;\n\n /**\n * Set a dynamic Stream Video API key that overrides the static one\n * @param {{ apiKey: string }} options - The API key to set\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setDynamicStreamVideoApikey({ apiKey: 'new-api-key' });\n */\n setDynamicStreamVideoApikey(options: { apiKey: string }): Promise<SuccessResponse>;\n\n /**\n * Get the currently set dynamic Stream Video API key\n * @returns {Promise<DynamicApiKeyResponse>} The dynamic API key and whether it's set\n * @example\n * const result = await StreamCall.getDynamicStreamVideoApikey();\n * if (result.hasDynamicKey) {\n * console.log('Dynamic API key:', result.apiKey);\n * } else {\n * console.log('Using static API key from resources');\n * }\n */\n getDynamicStreamVideoApikey(): Promise<DynamicApiKeyResponse>;\n\n /**\n * Get the current user's information\n * @returns {Promise<CurrentUserResponse>} Current user information\n * @example\n * const currentUser = await StreamCall.getCurrentUser();\n * console.log(currentUser);\n */\n getCurrentUser(): Promise<CurrentUserResponse>;\n}\n\n/**\n * @interface IncomingCallPayload\n * @description Payload delivered with \"incomingCall\" event (Android lock-screen).\n * @property {string} cid - Call CID (type:id)\n * @property {string} type - Always \"incoming\" for this event\n * @property {CallMember} [caller] - Information about the caller\n */\nexport interface IncomingCallPayload {\n /** Full call CID (e.g. default:123) */\n cid: string;\n /** Event type (currently always \"incoming\") */\n type: 'incoming';\n /** Information about the caller */\n caller?: CallMember;\n /** Custom data to be passed to the call */\n custom?: Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @interface LoginOptions\n * @description Configuration options for logging into the Stream Video service\n * @property {string} token - Stream Video API token for authentication\n * @property {string} userId - Unique identifier for the current user\n * @property {string} name - Display name for the current user\n * @property {string} [imageURL] - Avatar URL for the current user\n * @property {string} apiKey - Stream Video API key for your application\n * @property {string} [magicDivId] - DOM element ID where video will be rendered\n */\nexport interface LoginOptions {\n /** Stream Video API token */\n token: string;\n /** User ID for the current user */\n userId: string;\n /** Display name for the current user */\n name: string;\n /** Optional avatar URL for the current user */\n imageURL?: string;\n /** Stream Video API key */\n apiKey: string;\n /** ID of the HTML element where the video will be rendered */\n magicDivId?: string;\n pushNotificationsConfig?: PushNotificationsConfig;\n}\n\nexport interface PushNotificationsConfig {\n pushProviderName: string;\n voipProviderName: string;\n}\n\n/**\n * @typedef CallState\n * @description Represents all possible call states from API and UI\n */\nexport type CallState =\n // User-facing states\n | 'idle'\n | 'ringing'\n | 'joining'\n | 'reconnecting'\n | 'joined'\n | 'leaving'\n | 'left'\n // Event-specific states\n | 'created'\n | 'session_started'\n | 'rejected'\n | 'participant_counts'\n | 'missed'\n | 'accepted'\n | 'ended'\n | 'camera_enabled'\n | 'camera_disabled'\n | 'speaker_enabled'\n | 'speaker_disabled'\n | 'microphone_enabled'\n | 'microphone_disabled'\n | 'outgoing_call_ended'\n | 'unknown';\n\n/**\n * @typedef CallType\n * @description Represents the pre-defined types of a call.\n * - `default`: Simple 1-1 or group video calling with sensible defaults. Video/audio enabled, backstage disabled. Admins/hosts have elevated permissions.\n * - `audio_room`: For audio-only spaces (like Clubhouse). Backstage enabled (requires `goLive`), pre-configured permissions for requesting to speak.\n * - `livestream`: For one-to-many streaming. Backstage enabled (requires `goLive`), access granted to all authenticated users.\n * - `development`: For testing ONLY. All permissions enabled, backstage disabled. **Not recommended for production.**\n */\nexport type CallType = 'default' | 'audio' | 'audio_room' | 'livestream' | 'development';\n\n/**\n * @typedef StreamCallLayout\n * @description Layout modes matching the Stream React SDK; includes native aliases.\n */\nexport type StreamCallLayout = 'grid' | 'spotlight' | 'dynamic' | 'fullScreen' | 'fullscreen';\n\n/**\n * @interface CallMember\n * @description Information about a call member/participant\n * @property {string} userId - User ID of the member\n * @property {string} [name] - Display name of the user\n * @property {string} [imageURL] - Profile image URL of the user\n * @property {string} [role] - Role of the user in the call\n */\nexport interface CallMember {\n /** User ID of the member */\n userId: string;\n /** Display name of the user */\n name?: string;\n /** Profile image URL of the user */\n imageURL?: string;\n /** Role of the user in the call */\n role?: string;\n}\n\n/**\n * @interface CallEvent\n * @description Event emitted when call state changes\n * @property {string} callId - Unique identifier of the call\n * @property {CallState} state - Current state of the call\n * @property {string} [userId] - User ID of the participant who triggered the event\n * @property {string} [reason] - Reason for the call state change\n * @property {CallMember} [caller] - Information about the caller (for incoming calls)\n * @property {CallMember[]} [members] - List of call members\n */\nexport interface CallEvent {\n /** ID of the call */\n callId: string;\n /** Current state of the call */\n state: CallState;\n /** User ID of the participant in the call who triggered the event */\n userId?: string;\n /** Reason for the call state change, if applicable */\n reason?: string;\n /** Information about the caller (for incoming calls) */\n caller?: CallMember;\n /** List of call members */\n members?: CallMember[];\n\n custom?: Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >;\n\n count?: number;\n}\n\nexport interface CameraEnabledResponse {\n enabled: boolean;\n}\n\n/**\n * @interface DynamicApiKeyResponse\n * @description Response from getDynamicStreamVideoApikey\n * @property {string|null} apiKey - The dynamic API key if set, null if not\n * @property {boolean} hasDynamicKey - Whether a dynamic key is currently set\n */\nexport interface DynamicApiKeyResponse {\n /** The dynamic API key if set, null if not */\n apiKey: string | null;\n /** Whether a dynamic key is currently set */\n hasDynamicKey: boolean;\n}\n\n/**\n * @interface CurrentUserResponse\n * @description Response from getCurrentUser containing user information\n * @property {string} userId - User ID of the current user\n * @property {string} name - Display name of the current user\n * @property {string} [imageURL] - Avatar URL of the current user\n * @property {boolean} isLoggedIn - Whether the user is currently logged in\n */\nexport interface CurrentUserResponse {\n /** User ID of the current user */\n userId: string;\n /** Display name of the current user */\n name: string;\n /** Avatar URL of the current user */\n imageURL?: string;\n /** Whether the user is currently logged in */\n isLoggedIn: boolean;\n}\n\n/**\n * @interface SuccessResponse\n * @description Standard response indicating operation success/failure\n * @property {boolean} success - Whether the operation succeeded\n */\nexport interface SuccessResponse {\n /** Whether the operation was successful */\n success: boolean;\n callId?: string;\n}\n\n/**\n * @interface CallOptions\n * @description Options for initiating a video call\n * @property {string[]} userIds - IDs of the users to call\n * @property {CallType} [type=default] - Type of call\n * @property {boolean} [ring=true] - Whether to send ring notification\n * @property {string} [team] - Team name to call\n */\nexport interface CallOptions {\n /** User ID of the person to call */\n userIds: string[];\n /** Type of call, defaults to 'default' */\n type?: CallType;\n /** Whether to ring the other user, defaults to true */\n ring?: boolean;\n /** Team name to call */\n team?: string;\n /** Whether to start the call with video enabled, defaults to false */\n video?: boolean;\n /** Custom data to be passed to the call */\n custom?: Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >;\n}\n\n/**\n * @interface StreamCallPlugin\n * @description Capacitor plugin for Stream Video calling functionality\n */\nexport interface StreamCallPlugin {\n /**\n * Login to Stream Video service\n * @param {LoginOptions} options - Login configuration\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.login({\n * token: 'your-token',\n * userId: 'user-123',\n * name: 'John Doe',\n * apiKey: 'your-api-key'\n * });\n */\n login(options: LoginOptions): Promise<SuccessResponse>;\n\n /**\n * Logout from Stream Video service\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.logout();\n */\n logout(): Promise<SuccessResponse>;\n\n /**\n * Initiate a call to another user\n * @param {CallOptions} options - Call configuration\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.call({\n * userId: 'user-456',\n * type: 'video',\n * ring: true\n * });\n */\n call(options: CallOptions): Promise<SuccessResponse>;\n\n /**\n * End the current call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.endCall();\n */\n endCall(): Promise<SuccessResponse>;\n\n /**\n * Join an existing call\n * @param {{ callId: string, callType: string }} options - Microphone state\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.joinCall({ callId: 'call001', callType: 'default' });\n */\n joinCall?(options: { callId: string; callType: string }): Promise<SuccessResponse>;\n\n /**\n * Enable or disable microphone\n * @param {{ enabled: boolean }} options - Microphone state\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setMicrophoneEnabled({ enabled: false });\n */\n setMicrophoneEnabled(options: { enabled: boolean }): Promise<SuccessResponse>;\n\n /**\n * Enable or disable camera\n * @param {{ enabled: boolean }} options - Camera state\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setCameraEnabled({ enabled: false });\n */\n setCameraEnabled(options: { enabled: boolean }): Promise<SuccessResponse>;\n\n /**\n * Add listener for call events\n * @param {'callEvent'} eventName - Name of the event to listen for\n * @param {(event: CallEvent) => void} listenerFunc - Callback function\n * @returns {Promise<{ remove: () => Promise<void> }>} Function to remove listener\n * @example\n * const listener = await StreamCall.addListener('callEvent', (event) => {\n * console.log(`Call ${event.callId} is now ${event.state}`);\n * });\n */\n addListener(\n eventName: 'callEvent',\n listenerFunc: (event: CallEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Listen for lock-screen incoming call (Android only).\n * Fired when the app is shown by full-screen intent before user interaction.\n */\n addListener(\n eventName: 'incomingCall',\n listenerFunc: (event: IncomingCallPayload) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Remove all event listeners\n * @returns {Promise<void>}\n * @example\n * await StreamCall.removeAllListeners();\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Enable bluetooth audio\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.enableBluetooth();\n */\n enableBluetooth?(): Promise<SuccessResponse>;\n\n /**\n * Accept an incoming call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.acceptCall();\n */\n acceptCall(): Promise<SuccessResponse>;\n\n /**\n * Reject an incoming call\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.rejectCall();\n */\n rejectCall(): Promise<SuccessResponse>;\n\n /**\n * Check if camera is enabled\n * @returns {Promise<CameraEnabledResponse>} Camera enabled status\n * @example\n * const isCameraEnabled = await StreamCall.isCameraEnabled();\n * console.log(isCameraEnabled);\n */\n isCameraEnabled(): Promise<CameraEnabledResponse>;\n\n /**\n * Get the current call status\n * @returns {Promise<CallEvent>} Current call status as a CallEvent\n * @example\n * const callStatus = await StreamCall.getCallStatus();\n * console.log(callStatus);\n */\n getCallStatus(): Promise<CallEvent>;\n\n /**\n * Get the current ringing call\n * @returns {Promise<CallEvent>} Current ringing call status as a CallEvent\n * @example\n * const ringingCall = await StreamCall.getRingingCall();\n * console.log(ringingCall);\n */\n getRingingCall?(): Promise<CallEvent>;\n\n /**\n * Cycle through the available video layouts\n * @returns {Promise<{ newLayout: StreamCallLayout }>} The layout that is now active\n * @example\n * const { newLayout } = await StreamCall.toggleViews();\n * console.log(`Layout switched to ${newLayout}`);\n */\n toggleViews?(): Promise<{ newLayout: StreamCallLayout }>;\n\n /**\n * Set speakerphone on\n * @param {{ name: string }} options - Speakerphone name\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setSpeaker({ name: 'speaker' });\n */\n setSpeaker(options: { name: string }): Promise<SuccessResponse>;\n\n /**\n * Switch camera\n * @param {{ camera: 'front' | 'back' }} options - Camera to switch to\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.switchCamera({ camera: 'back' });\n */\n switchCamera(options: { camera: 'front' | 'back' }): Promise<SuccessResponse>;\n\n /**\n * Get detailed information about an active call including caller details\n * @param options - Options containing the call ID\n */\n getCallInfo(options: { callId: string }): Promise<CallEvent>;\n\n /**\n * Set a dynamic Stream Video API key that overrides the static one\n * @param {{ apiKey: string }} options - The API key to set\n * @returns {Promise<SuccessResponse>} Success status\n * @example\n * await StreamCall.setDynamicStreamVideoApikey({ apiKey: 'new-api-key' });\n */\n setDynamicStreamVideoApikey(options: { apiKey: string }): Promise<SuccessResponse>;\n\n /**\n * Get the currently set dynamic Stream Video API key\n * @returns {Promise<DynamicApiKeyResponse>} The dynamic API key and whether it's set\n * @example\n * const result = await StreamCall.getDynamicStreamVideoApikey();\n * if (result.hasDynamicKey) {\n * console.log('Dynamic API key:', result.apiKey);\n * } else {\n * console.log('Using static API key from resources');\n * }\n */\n getDynamicStreamVideoApikey(): Promise<DynamicApiKeyResponse>;\n\n /**\n * Get the current user's information\n * @returns {Promise<CurrentUserResponse>} Current user information\n * @example\n * const currentUser = await StreamCall.getCurrentUser();\n * console.log(currentUser);\n */\n getCurrentUser(): Promise<CurrentUserResponse>;\n}\n\n/**\n * @interface IncomingCallPayload\n * @description Payload delivered with \"incomingCall\" event (Android lock-screen).\n * @property {string} cid - Call CID (type:id)\n * @property {string} type - Always \"incoming\" for this event\n * @property {CallMember} [caller] - Information about the caller\n */\nexport interface IncomingCallPayload {\n /** Full call CID (e.g. default:123) */\n cid: string;\n /** Event type (currently always \"incoming\") */\n type: 'incoming';\n /** Information about the caller */\n caller?: CallMember;\n /** Custom data to be passed to the call */\n custom?: Record<\n string,\n | string\n | boolean\n | number\n | null\n | Record<string, string | boolean | number | null>\n | string[]\n | boolean[]\n | number[]\n >;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -56,4 +56,7 @@ export declare class StreamCallWeb extends WebPlugin implements StreamCallPlugin
|
|
|
56
56
|
}): Promise<SuccessResponse>;
|
|
57
57
|
getDynamicStreamVideoApikey(): Promise<DynamicApiKeyResponse>;
|
|
58
58
|
getCurrentUser(): Promise<CurrentUserResponse>;
|
|
59
|
+
getPluginVersion(): Promise<{
|
|
60
|
+
version: string;
|
|
61
|
+
}>;
|
|
59
62
|
}
|