@capgo/capacitor-stream-call 0.0.27 → 0.0.29

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.
@@ -16,16 +16,16 @@ class TouchInterceptWrapper(private val originalViewGroup: ViewGroup) : Coordina
16
16
  }
17
17
 
18
18
  override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
19
- // Broadcast to all children first
20
- for (i in 0 until childCount) {
19
+ // Traverse children from top (highest z) to bottom
20
+ for (i in childCount - 1 downTo 0) {
21
21
  val child = getChildAt(i)
22
22
  if (child.visibility == VISIBLE) {
23
- val eventCopy = MotionEvent.obtain(ev)
24
- child.dispatchTouchEvent(eventCopy)
25
- eventCopy.recycle()
23
+ val copy = MotionEvent.obtain(ev)
24
+ val handled = child.dispatchTouchEvent(copy)
25
+ copy.recycle()
26
+ if (handled) return true
26
27
  }
27
28
  }
28
- // Then let the normal touch handling occur
29
- return super.dispatchTouchEvent(ev)
29
+ return false
30
30
  }
31
- }
31
+ }
package/dist/docs.json CHANGED
@@ -222,6 +222,29 @@
222
222
  ],
223
223
  "slug": "addlistenercallevent-"
224
224
  },
225
+ {
226
+ "name": "addListener",
227
+ "signature": "(eventName: 'incomingCall', listenerFunc: (event: IncomingCallPayload) => void) => Promise<{ remove: () => Promise<void>; }>",
228
+ "parameters": [
229
+ {
230
+ "name": "eventName",
231
+ "docs": "",
232
+ "type": "'incomingCall'"
233
+ },
234
+ {
235
+ "name": "listenerFunc",
236
+ "docs": "",
237
+ "type": "(event: IncomingCallPayload) => void"
238
+ }
239
+ ],
240
+ "returns": "Promise<{ remove: () => Promise<void>; }>",
241
+ "tags": [],
242
+ "docs": "Listen for lock-screen incoming call (Android only).\nFired when the app is shown by full-screen intent before user interaction.",
243
+ "complexTypes": [
244
+ "IncomingCallPayload"
245
+ ],
246
+ "slug": "addlistenerincomingcall-"
247
+ },
225
248
  {
226
249
  "name": "removeAllListeners",
227
250
  "signature": "() => Promise<void>",
@@ -323,6 +346,68 @@
323
346
  "CallEvent"
324
347
  ],
325
348
  "slug": "getcallstatus"
349
+ },
350
+ {
351
+ "name": "setSpeaker",
352
+ "signature": "(options: { name: string; }) => Promise<SuccessResponse>",
353
+ "parameters": [
354
+ {
355
+ "name": "options",
356
+ "docs": "- Speakerphone name",
357
+ "type": "{ name: string; }"
358
+ }
359
+ ],
360
+ "returns": "Promise<SuccessResponse>",
361
+ "tags": [
362
+ {
363
+ "name": "param",
364
+ "text": "options - Speakerphone name"
365
+ },
366
+ {
367
+ "name": "returns",
368
+ "text": "Success status"
369
+ },
370
+ {
371
+ "name": "example",
372
+ "text": "await StreamCall.setSpeaker({ name: 'speaker' });"
373
+ }
374
+ ],
375
+ "docs": "Set speakerphone on",
376
+ "complexTypes": [
377
+ "SuccessResponse"
378
+ ],
379
+ "slug": "setspeaker"
380
+ },
381
+ {
382
+ "name": "switchCamera",
383
+ "signature": "(options: { camera: 'front' | 'back'; }) => Promise<SuccessResponse>",
384
+ "parameters": [
385
+ {
386
+ "name": "options",
387
+ "docs": "- Camera to switch to",
388
+ "type": "{ camera: 'front' | 'back'; }"
389
+ }
390
+ ],
391
+ "returns": "Promise<SuccessResponse>",
392
+ "tags": [
393
+ {
394
+ "name": "param",
395
+ "text": "options - Camera to switch to"
396
+ },
397
+ {
398
+ "name": "returns",
399
+ "text": "Success status"
400
+ },
401
+ {
402
+ "name": "example",
403
+ "text": "await StreamCall.switchCamera({ camera: 'back' });"
404
+ }
405
+ ],
406
+ "docs": "Switch camera",
407
+ "complexTypes": [
408
+ "SuccessResponse"
409
+ ],
410
+ "slug": "switchcamera"
326
411
  }
327
412
  ],
328
413
  "properties": []
@@ -1049,6 +1134,46 @@
1049
1134
  }
1050
1135
  ]
1051
1136
  },
1137
+ {
1138
+ "name": "IncomingCallPayload",
1139
+ "slug": "incomingcallpayload",
1140
+ "docs": "",
1141
+ "tags": [
1142
+ {
1143
+ "text": "IncomingCallPayload",
1144
+ "name": "interface"
1145
+ },
1146
+ {
1147
+ "text": "Payload delivered with \"incomingCall\" event (Android lock-screen).",
1148
+ "name": "description"
1149
+ },
1150
+ {
1151
+ "text": "{string} cid - Call CID (type:id)",
1152
+ "name": "property"
1153
+ },
1154
+ {
1155
+ "text": "{string} type - Always \"incoming\" for this event",
1156
+ "name": "property"
1157
+ }
1158
+ ],
1159
+ "methods": [],
1160
+ "properties": [
1161
+ {
1162
+ "name": "cid",
1163
+ "tags": [],
1164
+ "docs": "Full call CID (e.g. default:123)",
1165
+ "complexTypes": [],
1166
+ "type": "string"
1167
+ },
1168
+ {
1169
+ "name": "type",
1170
+ "tags": [],
1171
+ "docs": "Event type (currently always \"incoming\")",
1172
+ "complexTypes": [],
1173
+ "type": "'incoming'"
1174
+ }
1175
+ ]
1176
+ },
1052
1177
  {
1053
1178
  "name": "CameraEnabledResponse",
1054
1179
  "slug": "cameraenabledresponse",
@@ -161,6 +161,13 @@ export interface StreamCallPlugin {
161
161
  addListener(eventName: 'callEvent', listenerFunc: (event: CallEvent) => void): Promise<{
162
162
  remove: () => Promise<void>;
163
163
  }>;
164
+ /**
165
+ * Listen for lock-screen incoming call (Android only).
166
+ * Fired when the app is shown by full-screen intent before user interaction.
167
+ */
168
+ addListener(eventName: 'incomingCall', listenerFunc: (event: IncomingCallPayload) => void): Promise<{
169
+ remove: () => Promise<void>;
170
+ }>;
164
171
  /**
165
172
  * Remove all event listeners
166
173
  * @returns {Promise<void>}
@@ -198,4 +205,36 @@ export interface StreamCallPlugin {
198
205
  * console.log(callStatus);
199
206
  */
200
207
  getCallStatus(): Promise<CallEvent>;
208
+ /**
209
+ * Set speakerphone on
210
+ * @param {{ name: string }} options - Speakerphone name
211
+ * @returns {Promise<SuccessResponse>} Success status
212
+ * @example
213
+ * await StreamCall.setSpeaker({ name: 'speaker' });
214
+ */
215
+ setSpeaker(options: {
216
+ name: string;
217
+ }): Promise<SuccessResponse>;
218
+ /**
219
+ * Switch camera
220
+ * @param {{ camera: 'front' | 'back' }} options - Camera to switch to
221
+ * @returns {Promise<SuccessResponse>} Success status
222
+ * @example
223
+ * await StreamCall.switchCamera({ camera: 'back' });
224
+ */
225
+ switchCamera(options: {
226
+ camera: 'front' | 'back';
227
+ }): Promise<SuccessResponse>;
228
+ }
229
+ /**
230
+ * @interface IncomingCallPayload
231
+ * @description Payload delivered with "incomingCall" event (Android lock-screen).
232
+ * @property {string} cid - Call CID (type:id)
233
+ * @property {string} type - Always "incoming" for this event
234
+ */
235
+ export interface IncomingCallPayload {
236
+ /** Full call CID (e.g. default:123) */
237
+ cid: string;
238
+ /** Event type (currently always "incoming") */
239
+ type: 'incoming';
201
240
  }
@@ -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}\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 | '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 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 */\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}\n\nexport interface CameraEnabledResponse {\n enabled: 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}\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 * 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"]}
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}\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 | '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 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 */\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}\n\nexport interface CameraEnabledResponse {\n enabled: 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}\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/**\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 */\nexport interface IncomingCallPayload {\n /** Full call CID (e.g. default:123) */\n cid: string;\n /** Event type (currently always \"incoming\") */\n type: 'incoming';\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -37,6 +37,12 @@ export declare class StreamCallWeb extends WebPlugin implements StreamCallPlugin
37
37
  setCameraEnabled(options: {
38
38
  enabled: boolean;
39
39
  }): Promise<SuccessResponse>;
40
+ setSpeaker(options: {
41
+ name: string;
42
+ }): Promise<SuccessResponse>;
43
+ switchCamera(options: {
44
+ camera: 'front' | 'back';
45
+ }): Promise<SuccessResponse>;
40
46
  acceptCall(): Promise<SuccessResponse>;
41
47
  rejectCall(): Promise<SuccessResponse>;
42
48
  isCameraEnabled(): Promise<CameraEnabledResponse>;
package/dist/esm/web.js CHANGED
@@ -526,6 +526,27 @@ export class StreamCallWeb extends WebPlugin {
526
526
  }
527
527
  return { success: true };
528
528
  }
529
+ async setSpeaker(options) {
530
+ if (!this.currentCall) {
531
+ console.log('No active call', this.currentCall);
532
+ throw new Error('No active call');
533
+ }
534
+ await this.currentCall.speaker.select(options.name);
535
+ return { success: true };
536
+ }
537
+ async switchCamera(options) {
538
+ if (!this.currentCall) {
539
+ console.log('No active call', this.currentCall);
540
+ throw new Error('No active call');
541
+ }
542
+ if (options.camera === 'front') {
543
+ await this.currentCall.camera.selectDirection('front');
544
+ }
545
+ else {
546
+ await this.currentCall.camera.selectDirection('back');
547
+ }
548
+ return { success: true };
549
+ }
529
550
  async acceptCall() {
530
551
  if (!this.incomingCall || !this.client) {
531
552
  console.log('No incoming call to accept', this.incomingCall, this.client);
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAY1E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAA5C;;QAOU,kBAAa,GAA4B,IAAI,GAAG,EAAE,CAAC;QACnD,kBAAa,GAA4B,IAAI,GAAG,EAAE,CAAC;QAGnD,yBAAoB,GAAwB,IAAI,GAAG,EAAE,CAAC;QACtD,wBAAmB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAsBrD,iBAAY,GAAG,CAAC,KAAmC,EAAE,EAAE;;YAC7D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACrD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChD,IAAI,CAAC,WA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Y,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC;QACzD,IAAI,KAAgB,CAAC;QAErB,QAAQ,YAAY,EAAE,CAAC;YACrB,KAAK,YAAY,CAAC,IAAI;gBACpB,KAAK,GAAG,MAAM,CAAC;gBACf,MAAM;YACR,KAAK,YAAY,CAAC,OAAO;gBACvB,KAAK,GAAG,SAAS,CAAC;gBAClB,MAAM;YACR,KAAK,YAAY,CAAC,OAAO;gBACvB,KAAK,GAAG,SAAS,CAAC;gBAClB,MAAM;YACR,KAAK,YAAY,CAAC,YAAY;gBAC5B,KAAK,GAAG,cAAc,CAAC;gBACvB,MAAM;YACR,KAAK,YAAY,CAAC,MAAM;gBACtB,KAAK,GAAG,QAAQ,CAAC;gBACjB,MAAM;YACR,KAAK,YAAY,CAAC,IAAI;gBACpB,KAAK,GAAG,MAAM,CAAC;gBACf,MAAM;YACR;gBACE,KAAK,GAAG,SAAS,CAAC;QACtB,CAAC;QAED,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;YAC3B,KAAK;SACN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { AllClientEvents, Call, CallResponse, StreamVideoParticipant } from '@stream-io/video-client';\nimport { CallingState, StreamVideoClient } from '@stream-io/video-client';\n\nimport type {\n CallOptions,\n StreamCallPlugin,\n SuccessResponse,\n LoginOptions,\n CameraEnabledResponse,\n CallEvent,\n CallState,\n} from './definitions';\n\nexport class StreamCallWeb extends WebPlugin implements StreamCallPlugin {\n private client?: StreamVideoClient;\n private currentCall?: Call;\n private callStateSubscription?: { unsubscribe: () => void };\n private incomingCall?: CallResponse;\n private outgoingCall?: string;\n private magicDivId?: string;\n private videoBindings: Map<string, () => void> = new Map();\n private audioBindings: Map<string, () => void> = new Map();\n private participantJoinedListener?: (event: { participant?: { sessionId: string } }) => void;\n private participantLeftListener?: (event: { participant?: { sessionId: string } }) => void;\n private participantResponses: Map<string, string> = new Map();\n private callMembersExpected: Map<string, number> = new Map();\n // private currentActiveCallId?: string;\n\n private setupCallRingListener() {\n this.client?.off('call.ring', this.ringCallback);\n this.client?.off('call.session_started', this.callSessionStartedCallback);\n\n this.client?.on('call.ring', this.ringCallback);\n this.client?.on('call.session_started', this.callSessionStartedCallback);\n }\n\n private setupCallEventListeners() {\n // Clear previous listeners if any\n this.client?.off('call.rejected', this.callRejectedCallback);\n this.client?.off('call.accepted', this.callAcceptedCallback);\n this.client?.off('call.missed', this.callMissedCallback);\n // Register event listeners\n this.client?.on('call.rejected', this.callRejectedCallback);\n this.client?.on('call.accepted', this.callAcceptedCallback);\n this.client?.on('call.missed', this.callMissedCallback);\n }\n\n private ringCallback = (event: AllClientEvents['call.ring']) => {\n console.log('Call ringing', event, this.currentCall);\n this.incomingCall = event.call;\n if (!this.currentCall) {\n console.log('Creating new call', event.call.id);\n this.currentCall = this.client?.call(event.call.type, event.call.id);\n // this.currentActiveCallId = this.currentCall?.cid;\n this.notifyListeners('callEvent', { callId: event.call.id, state: CallingState.RINGING });\n // Clear previous responses when a new call starts\n this.participantResponses.clear();\n }\n if (this.currentCall) {\n console.log('Call found', this.currentCall.id);\n this.callStateSubscription = this.currentCall?.state.callingState$.subscribe((s) => {\n console.log('Call state', s);\n if (s === CallingState.JOINED) {\n this.setupParticipantListener();\n this.setupCallEventListeners();\n } else if (s === CallingState.LEFT || s === CallingState.RECONNECTING_FAILED) {\n this.cleanupCall();\n }\n if (this.outgoingCall && s === CallingState.RINGING) {\n this.outgoingCall = undefined;\n } else {\n this.notifyListeners('callEvent', { callId: this.currentCall?.id, state: s });\n }\n });\n }\n };\n\n private setupParticipantListener() {\n // Subscribe to participant changes\n this.incomingCall = undefined;\n if (!this.currentCall) return;\n\n this.participantJoinedListener = (event) => {\n if (this.magicDivId && event.participant) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv && this.currentCall) {\n this.setupParticipantVideo(this.currentCall, event.participant as StreamVideoParticipant, magicDiv);\n this.setupParticipantAudio(this.currentCall, event.participant as StreamVideoParticipant, magicDiv);\n }\n }\n };\n\n this.participantLeftListener = (event) => {\n if (this.magicDivId && event.participant) {\n const videoId = `video-${event.participant.sessionId}`;\n const audioId = `audio-${event.participant.sessionId}`;\n\n // Remove video element\n const videoEl = document.getElementById(videoId) as HTMLVideoElement;\n if (videoEl) {\n const unbindVideo = this.videoBindings.get(videoId);\n if (unbindVideo) {\n unbindVideo();\n this.videoBindings.delete(videoId);\n }\n const tracks = videoEl.srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n });\n }\n videoEl.srcObject = null;\n videoEl.remove();\n }\n\n // Remove audio element\n const audioEl = document.getElementById(audioId) as HTMLAudioElement;\n if (audioEl) {\n const unbindAudio = this.audioBindings.get(audioId);\n if (unbindAudio) {\n unbindAudio();\n this.audioBindings.delete(audioId);\n }\n const tracks = audioEl.srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n });\n }\n audioEl.srcObject = null;\n audioEl.remove();\n }\n }\n\n // Check if we're the only participant left in the call\n if (this.currentCall?.state.session) {\n // Get the remaining participants count (we need to subtract 1 as we haven't been removed from the list yet)\n const remainingParticipants = this.currentCall.state.session.participants.length - 1;\n\n // If we're the only one left, end the call\n if (remainingParticipants <= 1) {\n console.log(`We are left solo in a call. Ending. cID: ${this.currentCall.cid}`);\n\n // End the call\n this.currentCall.leave();\n\n // Clean up resources\n const callCid = this.currentCall.cid;\n\n // Invalidate and remove timer\n const callState = this.callStates?.get(callCid);\n if (callState?.timer) {\n clearInterval(callState.timer);\n }\n\n // Remove from callStates\n this.callStates?.delete(callCid);\n\n // Reset the current call\n this.currentCall = undefined;\n // this.currentActiveCallId = undefined;\n\n // Clean up\n this.cleanupCall();\n\n console.log(`Cleaned up resources for ended call: ${callCid}`);\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'left',\n reason: 'participant_left',\n });\n }\n }\n };\n\n this.currentCall.on('participantJoined', this.participantJoinedListener);\n this.currentCall.on('participantLeft', this.participantLeftListener);\n\n // Setup initial participants\n const participants = this.currentCall.state.participants;\n if (this.magicDivId) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv) {\n participants.forEach((participant: StreamVideoParticipant) => {\n if (this.currentCall) {\n this.setupParticipantVideo(this.currentCall, participant, magicDiv);\n this.setupParticipantAudio(this.currentCall, participant, magicDiv);\n }\n });\n }\n }\n }\n\n private setupParticipantVideo(call: Call, participant: StreamVideoParticipant, container: HTMLElement) {\n const id = `video-${participant.sessionId}`;\n if (!document.getElementById(id)) {\n const videoEl = document.createElement('video');\n videoEl.id = id;\n videoEl.style.width = '100%';\n videoEl.style.maxWidth = '300px';\n videoEl.style.aspectRatio = '16/9';\n container.appendChild(videoEl);\n\n const unbind = call.bindVideoElement(videoEl, participant.sessionId, 'videoTrack');\n if (unbind) this.videoBindings.set(id, unbind);\n }\n }\n\n private setupParticipantAudio(call: Call, participant: StreamVideoParticipant, container: HTMLElement) {\n if (participant.isLocalParticipant) return;\n\n const id = `audio-${participant.sessionId}`;\n if (!document.getElementById(id)) {\n const audioEl = document.createElement('audio');\n audioEl.id = id;\n container.appendChild(audioEl);\n\n const unbind = call.bindAudioElement(audioEl, participant.sessionId);\n if (unbind) this.audioBindings.set(id, unbind);\n }\n }\n\n private callSessionStartedCallback = (event: AllClientEvents['call.session_started']) => {\n console.log('Call created (session started)', event);\n if (event.call?.session?.participants) {\n // Store the number of expected participants for this call\n const callCid = event.call.cid;\n const memberCount = event.call.session.participants.length;\n console.log(`Call ${callCid} created with ${memberCount} members`);\n this.callMembersExpected.set(callCid, memberCount);\n\n // Store call members in callStates\n this.callStates.set(callCid, {\n members: event.call.session.participants.map((p) => ({ user_id: p.user?.id || '' })),\n participantResponses: new Map(),\n expectedMemberCount: memberCount,\n createdAt: new Date(),\n });\n\n // Start a timeout task that runs every second\n const timeoutTask = setInterval(() => this.checkCallTimeout(callCid), 1000);\n\n // Update the callState with the timeout task\n const callState = this.callStates.get(callCid);\n if (callState) {\n callState.timer = timeoutTask;\n this.callStates.set(callCid, callState);\n }\n }\n };\n\n private callRejectedCallback = (event: AllClientEvents['call.rejected']) => {\n console.log('Call rejected', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'rejected');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'rejected');\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'rejected',\n userId: event.user.id,\n });\n\n this.checkAllParticipantsResponded();\n }\n };\n\n private callAcceptedCallback = (event: AllClientEvents['call.accepted']) => {\n console.log('Call accepted', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'accepted');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'accepted');\n\n // If someone accepted, clear the timer as we don't need to check anymore\n if (callState.timer) {\n clearInterval(callState.timer);\n callState.timer = undefined;\n }\n\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'accepted',\n userId: event.user.id,\n });\n }\n };\n\n private callMissedCallback = (event: AllClientEvents['call.missed']) => {\n console.log('Call missed', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'missed');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'missed');\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'missed',\n userId: event.user.id,\n });\n\n this.checkAllParticipantsResponded();\n }\n };\n\n // Add a combined map for call states, mirroring the iOS implementation\n private callStates: Map<\n string,\n {\n members: { user_id: string }[];\n participantResponses: Map<string, string>;\n expectedMemberCount: number;\n createdAt: Date;\n timer?: ReturnType<typeof setInterval>;\n }\n > = new Map();\n\n private checkCallTimeout(callCid: string) {\n const callState = this.callStates.get(callCid);\n if (!callState) return;\n\n // Calculate time elapsed since call creation\n const now = new Date();\n const elapsedSeconds = (now.getTime() - callState.createdAt.getTime()) / 1000;\n\n // Check if 30 seconds have passed\n if (elapsedSeconds >= 30) {\n console.log(`Call ${callCid} has timed out after ${elapsedSeconds} seconds`);\n\n // Check if anyone has accepted\n const hasAccepted = Array.from(callState.participantResponses.values()).some(\n (response) => response === 'accepted',\n );\n\n if (!hasAccepted) {\n console.log(`No one accepted call ${callCid}, marking all non-responders as missed`);\n\n // Mark all members who haven't responded as \"missed\"\n callState.members.forEach((member) => {\n if (!callState.participantResponses.has(member.user_id)) {\n callState.participantResponses.set(member.user_id, 'missed');\n this.participantResponses.set(member.user_id, 'missed');\n\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'missed',\n userId: member.user_id,\n });\n }\n });\n\n // End the call\n if (this.currentCall && this.currentCall.cid === callCid) {\n this.currentCall.leave();\n }\n\n // Clear the timeout task\n if (callState.timer) {\n clearInterval(callState.timer);\n callState.timer = undefined;\n }\n\n // Remove from callStates\n this.callStates.delete(callCid);\n\n // Clean up\n this.cleanupCall();\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'ended',\n reason: 'timeout',\n });\n }\n }\n }\n\n private checkAllParticipantsResponded() {\n if (!this.currentCall) return;\n\n const callCid = this.currentCall.cid;\n const totalParticipants = this.callMembersExpected.get(callCid);\n\n if (!totalParticipants) {\n console.log(`No expected participant count found for call: ${callCid}`);\n return;\n }\n\n console.log(`Total expected participants: ${totalParticipants}`);\n\n // Count rejections and misses\n let rejectedOrMissedCount = 0;\n this.participantResponses.forEach((response) => {\n if (response === 'rejected' || response === 'missed') {\n rejectedOrMissedCount++;\n }\n });\n\n console.log(`Participants responded: ${this.participantResponses.size}/${totalParticipants}`);\n console.log(`Rejected or missed: ${rejectedOrMissedCount}`);\n\n const allResponded = this.participantResponses.size >= totalParticipants;\n const allRejectedOrMissed =\n allResponded &&\n Array.from(this.participantResponses.values()).every(\n (response) => response === 'rejected' || response === 'missed',\n );\n\n // If all participants have rejected or missed the call\n if (allResponded && allRejectedOrMissed) {\n console.log('All participants have rejected or missed the call');\n\n // End the call\n this.currentCall.leave();\n\n // Clean up the timer if exists in callStates\n const callState = this.callStates.get(callCid);\n if (callState?.timer) {\n clearInterval(callState.timer);\n }\n\n // Remove from callStates\n this.callStates.delete(callCid);\n\n // Clear the responses\n this.participantResponses.clear();\n\n // Clean up\n this.cleanupCall();\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'ended',\n reason: 'all_rejected_or_missed',\n });\n }\n }\n\n private cleanupCall() {\n // First cleanup the call listeners\n if (this.currentCall) {\n if (this.participantJoinedListener) {\n this.currentCall.off('participantJoined', this.participantJoinedListener);\n this.participantJoinedListener = undefined;\n }\n if (this.participantLeftListener) {\n this.currentCall.off('participantLeft', this.participantLeftListener);\n this.participantLeftListener = undefined;\n }\n this.callStateSubscription?.unsubscribe();\n }\n\n if (this.magicDivId) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv) {\n // Remove all video elements\n const videoElements = magicDiv.querySelectorAll('video');\n videoElements.forEach((video) => {\n const id = video.id;\n const unbind = this.videoBindings.get(id);\n if (unbind) {\n unbind();\n this.videoBindings.delete(id);\n }\n // Stop all tracks\n const tracks = (video as HTMLVideoElement).srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n track.enabled = false;\n });\n video.srcObject = null;\n }\n video.remove();\n });\n\n // Remove all audio elements\n const audioElements = magicDiv.querySelectorAll('audio');\n audioElements.forEach((audio) => {\n const id = audio.id;\n const unbind = this.audioBindings.get(id);\n if (unbind) {\n unbind();\n this.audioBindings.delete(id);\n }\n // Stop all tracks\n const tracks = (audio as HTMLAudioElement).srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n track.enabled = false;\n });\n audio.srcObject = null;\n }\n audio.remove();\n });\n\n // Clear the container\n while (magicDiv.firstChild) {\n magicDiv.removeChild(magicDiv.firstChild);\n }\n }\n }\n\n // Clear all bindings\n this.videoBindings.clear();\n this.audioBindings.clear();\n\n // Clear call references\n this.currentCall = undefined;\n this.incomingCall = undefined;\n }\n\n async login(options: LoginOptions): Promise<SuccessResponse> {\n this.client = StreamVideoClient.getOrCreateInstance({\n apiKey: options.apiKey,\n user: { id: options.userId, name: options.name, image: options.imageURL },\n token: options.token,\n });\n\n this.magicDivId = options.magicDivId;\n this.setupCallRingListener();\n\n return { success: true };\n }\n\n async logout(): Promise<SuccessResponse> {\n if (!this.client) {\n console.log('No client', this.client);\n throw new Error('Client not initialized');\n }\n\n // Cleanup subscription\n this.callStateSubscription?.unsubscribe();\n this.callStateSubscription = undefined;\n\n await this.client.disconnectUser();\n this.client = undefined;\n this.currentCall = undefined;\n return { success: true };\n }\n\n async call(options: CallOptions): Promise<SuccessResponse> {\n if (!this.client) {\n console.log('No client', this.client);\n throw new Error('Client not initialized - Please login first');\n }\n\n const call = this.client.call(options.type || 'default', crypto.randomUUID());\n const members = options.userIds.map((userId) => ({ user_id: userId }));\n if (this.client.streamClient.userID && !options.userIds.includes(this.client.streamClient.userID)) {\n members.push({ user_id: this.client.streamClient.userID });\n }\n await call.getOrCreate({ data: { members, team: options.team } });\n\n // Store the expected member count for this call\n // -1, because we don't count the caller themselves\n this.callMembersExpected.set(call.cid, members.length);\n console.log(`Setting expected members for call ${call.cid}: ${members.length}`);\n\n this.currentCall = call;\n if (options.ring) {\n this.outgoingCall = call.cid;\n await call.ring();\n }\n\n await call.join();\n return { success: true };\n }\n\n async endCall(): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n await this.currentCall.leave();\n this.currentCall = undefined;\n this.cleanupCall();\n\n return { success: true };\n }\n\n async setMicrophoneEnabled(options: { enabled: boolean }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n if (options.enabled) {\n await this.currentCall.microphone.enable();\n } else {\n await this.currentCall.microphone.disable();\n }\n\n return { success: true };\n }\n\n async setCameraEnabled(options: { enabled: boolean }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n if (options.enabled) {\n await this.currentCall.camera.enable();\n } else {\n await this.currentCall.camera.disable();\n }\n\n return { success: true };\n }\n\n async acceptCall(): Promise<SuccessResponse> {\n if (!this.incomingCall || !this.client) {\n console.log('No incoming call to accept', this.incomingCall, this.client);\n throw new Error('No incoming call to accept');\n }\n console.log('Accepting call', this.incomingCall);\n const call = this.client.call(this.incomingCall.type, this.incomingCall.id);\n this.currentCall = call;\n console.log('Joining call', call);\n await call.accept();\n await call.join();\n console.log('Joined call', call);\n this.notifyListeners('callEvent', { callId: call.id, state: CallingState.JOINED });\n this.setupParticipantListener();\n return { success: true };\n }\n\n async rejectCall(): Promise<SuccessResponse> {\n if (!this.incomingCall || !this.client) {\n console.log('No incoming call to reject', this.incomingCall, this.client);\n throw new Error('No incoming call to reject');\n }\n console.log('Rejecting call', this.incomingCall);\n const call: Call = this.client.call(this.incomingCall.type, this.incomingCall.id);\n console.log('Leaving call', call);\n await call.reject();\n this.incomingCall = undefined;\n console.log('Rejected call', call);\n this.notifyListeners('callEvent', { callId: call.id, state: CallingState.LEFT });\n this.cleanupCall();\n return { success: true };\n }\n\n async isCameraEnabled(): Promise<CameraEnabledResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n const enabled = await this.currentCall.camera.enabled;\n return { enabled };\n }\n\n async getCallStatus(): Promise<CallEvent> {\n if (!this.currentCall) {\n throw new Error('No active call');\n }\n\n const callingState = this.currentCall.state.callingState;\n let state: CallState;\n\n switch (callingState) {\n case CallingState.IDLE:\n state = 'idle';\n break;\n case CallingState.RINGING:\n state = 'ringing';\n break;\n case CallingState.JOINING:\n state = 'joining';\n break;\n case CallingState.RECONNECTING:\n state = 'reconnecting';\n break;\n case CallingState.JOINED:\n state = 'joined';\n break;\n case CallingState.LEFT:\n state = 'left';\n break;\n default:\n state = 'unknown';\n }\n\n return {\n callId: this.currentCall.id,\n state,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAY1E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAA5C;;QAOU,kBAAa,GAA4B,IAAI,GAAG,EAAE,CAAC;QACnD,kBAAa,GAA4B,IAAI,GAAG,EAAE,CAAC;QAGnD,yBAAoB,GAAwB,IAAI,GAAG,EAAE,CAAC;QACtD,wBAAmB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAsBrD,iBAAY,GAAG,CAAC,KAAmC,EAAE,EAAE;;YAC7D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACrD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChD,IAAI,CAAC,WAAW,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACrE,oDAAoD;gBACpD,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,C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AM,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;YAC3B,KAAK;SACN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { AllClientEvents, Call, CallResponse, StreamVideoParticipant } from '@stream-io/video-client';\nimport { CallingState, StreamVideoClient } from '@stream-io/video-client';\n\nimport type {\n CallOptions,\n StreamCallPlugin,\n SuccessResponse,\n LoginOptions,\n CameraEnabledResponse,\n CallEvent,\n CallState,\n} from './definitions';\n\nexport class StreamCallWeb extends WebPlugin implements StreamCallPlugin {\n private client?: StreamVideoClient;\n private currentCall?: Call;\n private callStateSubscription?: { unsubscribe: () => void };\n private incomingCall?: CallResponse;\n private outgoingCall?: string;\n private magicDivId?: string;\n private videoBindings: Map<string, () => void> = new Map();\n private audioBindings: Map<string, () => void> = new Map();\n private participantJoinedListener?: (event: { participant?: { sessionId: string } }) => void;\n private participantLeftListener?: (event: { participant?: { sessionId: string } }) => void;\n private participantResponses: Map<string, string> = new Map();\n private callMembersExpected: Map<string, number> = new Map();\n // private currentActiveCallId?: string;\n\n private setupCallRingListener() {\n this.client?.off('call.ring', this.ringCallback);\n this.client?.off('call.session_started', this.callSessionStartedCallback);\n\n this.client?.on('call.ring', this.ringCallback);\n this.client?.on('call.session_started', this.callSessionStartedCallback);\n }\n\n private setupCallEventListeners() {\n // Clear previous listeners if any\n this.client?.off('call.rejected', this.callRejectedCallback);\n this.client?.off('call.accepted', this.callAcceptedCallback);\n this.client?.off('call.missed', this.callMissedCallback);\n // Register event listeners\n this.client?.on('call.rejected', this.callRejectedCallback);\n this.client?.on('call.accepted', this.callAcceptedCallback);\n this.client?.on('call.missed', this.callMissedCallback);\n }\n\n private ringCallback = (event: AllClientEvents['call.ring']) => {\n console.log('Call ringing', event, this.currentCall);\n this.incomingCall = event.call;\n if (!this.currentCall) {\n console.log('Creating new call', event.call.id);\n this.currentCall = this.client?.call(event.call.type, event.call.id);\n // this.currentActiveCallId = this.currentCall?.cid;\n this.notifyListeners('callEvent', { callId: event.call.id, state: CallingState.RINGING });\n // Clear previous responses when a new call starts\n this.participantResponses.clear();\n }\n if (this.currentCall) {\n console.log('Call found', this.currentCall.id);\n this.callStateSubscription = this.currentCall?.state.callingState$.subscribe((s) => {\n console.log('Call state', s);\n if (s === CallingState.JOINED) {\n this.setupParticipantListener();\n this.setupCallEventListeners();\n } else if (s === CallingState.LEFT || s === CallingState.RECONNECTING_FAILED) {\n this.cleanupCall();\n }\n if (this.outgoingCall && s === CallingState.RINGING) {\n this.outgoingCall = undefined;\n } else {\n this.notifyListeners('callEvent', { callId: this.currentCall?.id, state: s });\n }\n });\n }\n };\n\n private setupParticipantListener() {\n // Subscribe to participant changes\n this.incomingCall = undefined;\n if (!this.currentCall) return;\n\n this.participantJoinedListener = (event) => {\n if (this.magicDivId && event.participant) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv && this.currentCall) {\n this.setupParticipantVideo(this.currentCall, event.participant as StreamVideoParticipant, magicDiv);\n this.setupParticipantAudio(this.currentCall, event.participant as StreamVideoParticipant, magicDiv);\n }\n }\n };\n\n this.participantLeftListener = (event) => {\n if (this.magicDivId && event.participant) {\n const videoId = `video-${event.participant.sessionId}`;\n const audioId = `audio-${event.participant.sessionId}`;\n\n // Remove video element\n const videoEl = document.getElementById(videoId) as HTMLVideoElement;\n if (videoEl) {\n const unbindVideo = this.videoBindings.get(videoId);\n if (unbindVideo) {\n unbindVideo();\n this.videoBindings.delete(videoId);\n }\n const tracks = videoEl.srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n });\n }\n videoEl.srcObject = null;\n videoEl.remove();\n }\n\n // Remove audio element\n const audioEl = document.getElementById(audioId) as HTMLAudioElement;\n if (audioEl) {\n const unbindAudio = this.audioBindings.get(audioId);\n if (unbindAudio) {\n unbindAudio();\n this.audioBindings.delete(audioId);\n }\n const tracks = audioEl.srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n });\n }\n audioEl.srcObject = null;\n audioEl.remove();\n }\n }\n\n // Check if we're the only participant left in the call\n if (this.currentCall?.state.session) {\n // Get the remaining participants count (we need to subtract 1 as we haven't been removed from the list yet)\n const remainingParticipants = this.currentCall.state.session.participants.length - 1;\n\n // If we're the only one left, end the call\n if (remainingParticipants <= 1) {\n console.log(`We are left solo in a call. Ending. cID: ${this.currentCall.cid}`);\n\n // End the call\n this.currentCall.leave();\n\n // Clean up resources\n const callCid = this.currentCall.cid;\n\n // Invalidate and remove timer\n const callState = this.callStates?.get(callCid);\n if (callState?.timer) {\n clearInterval(callState.timer);\n }\n\n // Remove from callStates\n this.callStates?.delete(callCid);\n\n // Reset the current call\n this.currentCall = undefined;\n // this.currentActiveCallId = undefined;\n\n // Clean up\n this.cleanupCall();\n\n console.log(`Cleaned up resources for ended call: ${callCid}`);\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'left',\n reason: 'participant_left',\n });\n }\n }\n };\n\n this.currentCall.on('participantJoined', this.participantJoinedListener);\n this.currentCall.on('participantLeft', this.participantLeftListener);\n\n // Setup initial participants\n const participants = this.currentCall.state.participants;\n if (this.magicDivId) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv) {\n participants.forEach((participant: StreamVideoParticipant) => {\n if (this.currentCall) {\n this.setupParticipantVideo(this.currentCall, participant, magicDiv);\n this.setupParticipantAudio(this.currentCall, participant, magicDiv);\n }\n });\n }\n }\n }\n\n private setupParticipantVideo(call: Call, participant: StreamVideoParticipant, container: HTMLElement) {\n const id = `video-${participant.sessionId}`;\n if (!document.getElementById(id)) {\n const videoEl = document.createElement('video');\n videoEl.id = id;\n videoEl.style.width = '100%';\n videoEl.style.maxWidth = '300px';\n videoEl.style.aspectRatio = '16/9';\n container.appendChild(videoEl);\n\n const unbind = call.bindVideoElement(videoEl, participant.sessionId, 'videoTrack');\n if (unbind) this.videoBindings.set(id, unbind);\n }\n }\n\n private setupParticipantAudio(call: Call, participant: StreamVideoParticipant, container: HTMLElement) {\n if (participant.isLocalParticipant) return;\n\n const id = `audio-${participant.sessionId}`;\n if (!document.getElementById(id)) {\n const audioEl = document.createElement('audio');\n audioEl.id = id;\n container.appendChild(audioEl);\n\n const unbind = call.bindAudioElement(audioEl, participant.sessionId);\n if (unbind) this.audioBindings.set(id, unbind);\n }\n }\n\n private callSessionStartedCallback = (event: AllClientEvents['call.session_started']) => {\n console.log('Call created (session started)', event);\n if (event.call?.session?.participants) {\n // Store the number of expected participants for this call\n const callCid = event.call.cid;\n const memberCount = event.call.session.participants.length;\n console.log(`Call ${callCid} created with ${memberCount} members`);\n this.callMembersExpected.set(callCid, memberCount);\n\n // Store call members in callStates\n this.callStates.set(callCid, {\n members: event.call.session.participants.map((p) => ({ user_id: p.user?.id || '' })),\n participantResponses: new Map(),\n expectedMemberCount: memberCount,\n createdAt: new Date(),\n });\n\n // Start a timeout task that runs every second\n const timeoutTask = setInterval(() => this.checkCallTimeout(callCid), 1000);\n\n // Update the callState with the timeout task\n const callState = this.callStates.get(callCid);\n if (callState) {\n callState.timer = timeoutTask;\n this.callStates.set(callCid, callState);\n }\n }\n };\n\n private callRejectedCallback = (event: AllClientEvents['call.rejected']) => {\n console.log('Call rejected', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'rejected');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'rejected');\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'rejected',\n userId: event.user.id,\n });\n\n this.checkAllParticipantsResponded();\n }\n };\n\n private callAcceptedCallback = (event: AllClientEvents['call.accepted']) => {\n console.log('Call accepted', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'accepted');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'accepted');\n\n // If someone accepted, clear the timer as we don't need to check anymore\n if (callState.timer) {\n clearInterval(callState.timer);\n callState.timer = undefined;\n }\n\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'accepted',\n userId: event.user.id,\n });\n }\n };\n\n private callMissedCallback = (event: AllClientEvents['call.missed']) => {\n console.log('Call missed', event);\n if (event.user?.id) {\n this.participantResponses.set(event.user.id, 'missed');\n\n // Update the combined callStates map\n const callState = this.callStates.get(event.call_cid);\n if (callState) {\n callState.participantResponses.set(event.user.id, 'missed');\n this.callStates.set(event.call_cid, callState);\n }\n\n this.notifyListeners('callEvent', {\n callId: event.call_cid,\n state: 'missed',\n userId: event.user.id,\n });\n\n this.checkAllParticipantsResponded();\n }\n };\n\n // Add a combined map for call states, mirroring the iOS implementation\n private callStates: Map<\n string,\n {\n members: { user_id: string }[];\n participantResponses: Map<string, string>;\n expectedMemberCount: number;\n createdAt: Date;\n timer?: ReturnType<typeof setInterval>;\n }\n > = new Map();\n\n private checkCallTimeout(callCid: string) {\n const callState = this.callStates.get(callCid);\n if (!callState) return;\n\n // Calculate time elapsed since call creation\n const now = new Date();\n const elapsedSeconds = (now.getTime() - callState.createdAt.getTime()) / 1000;\n\n // Check if 30 seconds have passed\n if (elapsedSeconds >= 30) {\n console.log(`Call ${callCid} has timed out after ${elapsedSeconds} seconds`);\n\n // Check if anyone has accepted\n const hasAccepted = Array.from(callState.participantResponses.values()).some(\n (response) => response === 'accepted',\n );\n\n if (!hasAccepted) {\n console.log(`No one accepted call ${callCid}, marking all non-responders as missed`);\n\n // Mark all members who haven't responded as \"missed\"\n callState.members.forEach((member) => {\n if (!callState.participantResponses.has(member.user_id)) {\n callState.participantResponses.set(member.user_id, 'missed');\n this.participantResponses.set(member.user_id, 'missed');\n\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'missed',\n userId: member.user_id,\n });\n }\n });\n\n // End the call\n if (this.currentCall && this.currentCall.cid === callCid) {\n this.currentCall.leave();\n }\n\n // Clear the timeout task\n if (callState.timer) {\n clearInterval(callState.timer);\n callState.timer = undefined;\n }\n\n // Remove from callStates\n this.callStates.delete(callCid);\n\n // Clean up\n this.cleanupCall();\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'ended',\n reason: 'timeout',\n });\n }\n }\n }\n\n private checkAllParticipantsResponded() {\n if (!this.currentCall) return;\n\n const callCid = this.currentCall.cid;\n const totalParticipants = this.callMembersExpected.get(callCid);\n\n if (!totalParticipants) {\n console.log(`No expected participant count found for call: ${callCid}`);\n return;\n }\n\n console.log(`Total expected participants: ${totalParticipants}`);\n\n // Count rejections and misses\n let rejectedOrMissedCount = 0;\n this.participantResponses.forEach((response) => {\n if (response === 'rejected' || response === 'missed') {\n rejectedOrMissedCount++;\n }\n });\n\n console.log(`Participants responded: ${this.participantResponses.size}/${totalParticipants}`);\n console.log(`Rejected or missed: ${rejectedOrMissedCount}`);\n\n const allResponded = this.participantResponses.size >= totalParticipants;\n const allRejectedOrMissed =\n allResponded &&\n Array.from(this.participantResponses.values()).every(\n (response) => response === 'rejected' || response === 'missed',\n );\n\n // If all participants have rejected or missed the call\n if (allResponded && allRejectedOrMissed) {\n console.log('All participants have rejected or missed the call');\n\n // End the call\n this.currentCall.leave();\n\n // Clean up the timer if exists in callStates\n const callState = this.callStates.get(callCid);\n if (callState?.timer) {\n clearInterval(callState.timer);\n }\n\n // Remove from callStates\n this.callStates.delete(callCid);\n\n // Clear the responses\n this.participantResponses.clear();\n\n // Clean up\n this.cleanupCall();\n\n // Notify that the call has ended\n this.notifyListeners('callEvent', {\n callId: callCid,\n state: 'ended',\n reason: 'all_rejected_or_missed',\n });\n }\n }\n\n private cleanupCall() {\n // First cleanup the call listeners\n if (this.currentCall) {\n if (this.participantJoinedListener) {\n this.currentCall.off('participantJoined', this.participantJoinedListener);\n this.participantJoinedListener = undefined;\n }\n if (this.participantLeftListener) {\n this.currentCall.off('participantLeft', this.participantLeftListener);\n this.participantLeftListener = undefined;\n }\n this.callStateSubscription?.unsubscribe();\n }\n\n if (this.magicDivId) {\n const magicDiv = document.getElementById(this.magicDivId);\n if (magicDiv) {\n // Remove all video elements\n const videoElements = magicDiv.querySelectorAll('video');\n videoElements.forEach((video) => {\n const id = video.id;\n const unbind = this.videoBindings.get(id);\n if (unbind) {\n unbind();\n this.videoBindings.delete(id);\n }\n // Stop all tracks\n const tracks = (video as HTMLVideoElement).srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n track.enabled = false;\n });\n video.srcObject = null;\n }\n video.remove();\n });\n\n // Remove all audio elements\n const audioElements = magicDiv.querySelectorAll('audio');\n audioElements.forEach((audio) => {\n const id = audio.id;\n const unbind = this.audioBindings.get(id);\n if (unbind) {\n unbind();\n this.audioBindings.delete(id);\n }\n // Stop all tracks\n const tracks = (audio as HTMLAudioElement).srcObject as MediaStream;\n if (tracks) {\n tracks.getTracks().forEach((track) => {\n track.stop();\n track.enabled = false;\n });\n audio.srcObject = null;\n }\n audio.remove();\n });\n\n // Clear the container\n while (magicDiv.firstChild) {\n magicDiv.removeChild(magicDiv.firstChild);\n }\n }\n }\n\n // Clear all bindings\n this.videoBindings.clear();\n this.audioBindings.clear();\n\n // Clear call references\n this.currentCall = undefined;\n this.incomingCall = undefined;\n }\n\n async login(options: LoginOptions): Promise<SuccessResponse> {\n this.client = StreamVideoClient.getOrCreateInstance({\n apiKey: options.apiKey,\n user: { id: options.userId, name: options.name, image: options.imageURL },\n token: options.token,\n });\n\n this.magicDivId = options.magicDivId;\n this.setupCallRingListener();\n\n return { success: true };\n }\n\n async logout(): Promise<SuccessResponse> {\n if (!this.client) {\n console.log('No client', this.client);\n throw new Error('Client not initialized');\n }\n\n // Cleanup subscription\n this.callStateSubscription?.unsubscribe();\n this.callStateSubscription = undefined;\n\n await this.client.disconnectUser();\n this.client = undefined;\n this.currentCall = undefined;\n return { success: true };\n }\n\n async call(options: CallOptions): Promise<SuccessResponse> {\n if (!this.client) {\n console.log('No client', this.client);\n throw new Error('Client not initialized - Please login first');\n }\n\n const call = this.client.call(options.type || 'default', crypto.randomUUID());\n const members = options.userIds.map((userId) => ({ user_id: userId }));\n if (this.client.streamClient.userID && !options.userIds.includes(this.client.streamClient.userID)) {\n members.push({ user_id: this.client.streamClient.userID });\n }\n await call.getOrCreate({ data: { members, team: options.team } });\n\n // Store the expected member count for this call\n // -1, because we don't count the caller themselves\n this.callMembersExpected.set(call.cid, members.length);\n console.log(`Setting expected members for call ${call.cid}: ${members.length}`);\n\n this.currentCall = call;\n if (options.ring) {\n this.outgoingCall = call.cid;\n await call.ring();\n }\n\n await call.join();\n return { success: true };\n }\n\n async endCall(): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n await this.currentCall.leave();\n this.currentCall = undefined;\n this.cleanupCall();\n\n return { success: true };\n }\n\n async setMicrophoneEnabled(options: { enabled: boolean }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n if (options.enabled) {\n await this.currentCall.microphone.enable();\n } else {\n await this.currentCall.microphone.disable();\n }\n\n return { success: true };\n }\n\n async setCameraEnabled(options: { enabled: boolean }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n if (options.enabled) {\n await this.currentCall.camera.enable();\n } else {\n await this.currentCall.camera.disable();\n }\n\n return { success: true };\n }\n\n async setSpeaker(options: { name: string }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n await this.currentCall.speaker.select(options.name);\n\n return { success: true };\n }\n\n async switchCamera(options: { camera: 'front' | 'back' }): Promise<SuccessResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n\n if (options.camera === 'front') {\n await this.currentCall.camera.selectDirection('front');\n } else {\n await this.currentCall.camera.selectDirection('back');\n }\n\n return { success: true };\n }\n\n async acceptCall(): Promise<SuccessResponse> {\n if (!this.incomingCall || !this.client) {\n console.log('No incoming call to accept', this.incomingCall, this.client);\n throw new Error('No incoming call to accept');\n }\n console.log('Accepting call', this.incomingCall);\n const call = this.client.call(this.incomingCall.type, this.incomingCall.id);\n this.currentCall = call;\n console.log('Joining call', call);\n await call.accept();\n await call.join();\n console.log('Joined call', call);\n this.notifyListeners('callEvent', { callId: call.id, state: CallingState.JOINED });\n this.setupParticipantListener();\n return { success: true };\n }\n\n async rejectCall(): Promise<SuccessResponse> {\n if (!this.incomingCall || !this.client) {\n console.log('No incoming call to reject', this.incomingCall, this.client);\n throw new Error('No incoming call to reject');\n }\n console.log('Rejecting call', this.incomingCall);\n const call: Call = this.client.call(this.incomingCall.type, this.incomingCall.id);\n console.log('Leaving call', call);\n await call.reject();\n this.incomingCall = undefined;\n console.log('Rejected call', call);\n this.notifyListeners('callEvent', { callId: call.id, state: CallingState.LEFT });\n this.cleanupCall();\n return { success: true };\n }\n\n async isCameraEnabled(): Promise<CameraEnabledResponse> {\n if (!this.currentCall) {\n console.log('No active call', this.currentCall);\n throw new Error('No active call');\n }\n const enabled = await this.currentCall.camera.enabled;\n return { enabled };\n }\n\n async getCallStatus(): Promise<CallEvent> {\n if (!this.currentCall) {\n throw new Error('No active call');\n }\n\n const callingState = this.currentCall.state.callingState;\n let state: CallState;\n\n switch (callingState) {\n case CallingState.IDLE:\n state = 'idle';\n break;\n case CallingState.RINGING:\n state = 'ringing';\n break;\n case CallingState.JOINING:\n state = 'joining';\n break;\n case CallingState.RECONNECTING:\n state = 'reconnecting';\n break;\n case CallingState.JOINED:\n state = 'joined';\n break;\n case CallingState.LEFT:\n state = 'left';\n break;\n default:\n state = 'unknown';\n }\n\n return {\n callId: this.currentCall.id,\n state,\n };\n }\n}\n"]}
@@ -533,6 +533,27 @@ class StreamCallWeb extends core.WebPlugin {
533
533
  }
534
534
  return { success: true };
535
535
  }
536
+ async setSpeaker(options) {
537
+ if (!this.currentCall) {
538
+ console.log('No active call', this.currentCall);
539
+ throw new Error('No active call');
540
+ }
541
+ await this.currentCall.speaker.select(options.name);
542
+ return { success: true };
543
+ }
544
+ async switchCamera(options) {
545
+ if (!this.currentCall) {
546
+ console.log('No active call', this.currentCall);
547
+ throw new Error('No active call');
548
+ }
549
+ if (options.camera === 'front') {
550
+ await this.currentCall.camera.selectDirection('front');
551
+ }
552
+ else {
553
+ await this.currentCall.camera.selectDirection('back');
554
+ }
555
+ return { success: true };
556
+ }
536
557
  async acceptCall() {
537
558
  if (!this.incomingCall || !this.client) {
538
559
  console.log('No incoming call to accept', this.incomingCall, this.client);