@ikonai/sdk 1.0.45 → 1.0.46

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.
@@ -63,6 +63,12 @@ export interface IkonAudioCaptureRequest {
63
63
  bitrate?: number;
64
64
  targetIds?: number[];
65
65
  };
66
+ /**
67
+ * Optional correlation identifier embedded in the AudioStreamBegin payload. Used by the
68
+ * server-side CaptureButton to derive onCaptureStart/onCaptureStop from the audio path
69
+ * itself, eliminating any race between UI action dispatch and the audio stream.
70
+ */
71
+ correlationId?: string;
66
72
  onStopped?: () => void;
67
73
  /**
68
74
  * Called when capture encounters an error.
@@ -87,8 +93,15 @@ export interface IkonAudioCaptureHandle {
87
93
  readonly currentConstraints: MediaTrackConstraints;
88
94
  /** The current audio options (bitrate, etc.) applied to the capture. */
89
95
  readonly currentOptions: IkonAudioCaptureOptions;
90
- startSegment(): void;
91
- endSegment(): void;
96
+ /**
97
+ * Start a new logical recording segment. Optional correlationId identifies the originator
98
+ * (e.g., a CaptureButton instance) and is propagated to the server so the
99
+ * CaptureCorrelationBridge can fire onCaptureStart for the right registration. For the
100
+ * worker-encoded path the correlationId is fixed at startMic time and this argument is
101
+ * ignored; for the WebRTC path it is sent with each segment-start signal.
102
+ */
103
+ startSegment(correlationId?: string): void;
104
+ endSegment(correlationId?: string): void;
92
105
  stop(): Promise<void>;
93
106
  /** Update audio constraints on the active capture. Returns true if successful. */
94
107
  updateConstraints(constraints: MediaTrackConstraints): Promise<boolean>;
@@ -7,6 +7,13 @@ export interface IkonVideoCaptureRequest {
7
7
  options?: IkonVideoCaptureOptions;
8
8
  userGesture?: boolean;
9
9
  constraints?: MediaTrackConstraints;
10
+ /**
11
+ * Optional correlation identifier sent to the server-side WebRtcMediaBridge so the next
12
+ * VideoStreamBegin it emits for this sender carries it. Used by the CaptureCorrelationBridge
13
+ * to route onCaptureStart/onCaptureStop dispatches to the originating CaptureButton without
14
+ * racing with the UI action channel.
15
+ */
16
+ correlationId?: string;
10
17
  onStopped?: () => void;
11
18
  }
12
19
  export interface IkonVideoCaptureHandle {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -36,9 +36,8 @@ export interface TransportCallbacks {
36
36
  * Called when the connection is closed.
37
37
  * @param reason - Optional reason for the close
38
38
  * @param wasClean - Whether the close was clean (normal)
39
- * @param isServerClose - Whether the close code was 1000 or 1001, indicating server-initiated close
40
39
  */
41
- onClose: (reason?: string, wasClean?: boolean, isServerClose?: boolean) => void;
40
+ onClose: (reason?: string, wasClean?: boolean) => void;
42
41
  /**
43
42
  * Called when an error occurs.
44
43
  */
@@ -8,7 +8,7 @@
8
8
  * Supported parameters:
9
9
  * - ikon-proxy Force proxy mode on (true) or off (false)
10
10
  * - ikon-websocket Force WebSocket transport on (true) or off (false)
11
- * - ikon-webtransport Force WebTransport on (true) or off (false)
11
+ * - ikon-webtransport Force WebTransport on (true); default is off. `false` is accepted for parity.
12
12
  * - ikon-debug Enable SDK debug logging (true)
13
13
  * - ikon-lang Override language detection (e.g., "en", "fi")
14
14
  * - ikon-server-url External connect URL for shareable preview links
@@ -19,7 +19,7 @@
19
19
  * - ikon-webrtc Force WebRTC on (true) or off (false)
20
20
  * - ikon-inspect Enable element inspection overlay (true)
21
21
  * - ikon-retry Enable retry loops in auth/channel connect (default true; set false to fail fast)
22
- * - ikon-api Route backend API calls through same-origin /ikon/api path (true) instead of api.{env}.ikon.live
22
+ * - ikon-api Route backend API calls through same-origin /ikon/api (default true on deployed apps; false to force direct calls to api.{env}.ikon.live; always off in local dev)
23
23
  */
24
24
  export declare const IKON_PARAM_PROXY = "ikon-proxy";
25
25
  export declare const IKON_PARAM_WEBSOCKET = "ikon-websocket";
@@ -37,11 +37,23 @@ export declare class WebRTCSignaling {
37
37
  * Returns the first active video capture MediaStream, if any.
38
38
  */
39
39
  getActiveVideoCaptureStream(): MediaStream | null;
40
+ /**
41
+ * Look up a local video capture MediaStream by its app-level streamId.
42
+ * Capture streamId format: `webrtc_video_${sessionId}_${trackIndex}` (see sendVideoStreamBegin).
43
+ * Returns null if no local capture matches.
44
+ */
45
+ getLocalVideoCaptureStreamByStreamId(streamId: string): MediaStream | null;
40
46
  startAudioCapture(constraints?: MediaTrackConstraints): Promise<void>;
41
- startAudioSegment(): void;
42
- endAudioSegment(): void;
43
- startVideoCapture(constraints?: MediaTrackConstraints, bitrate?: number, senderIndex?: number): Promise<void>;
44
- startScreenCapture(constraints?: MediaTrackConstraints, bitrate?: number, senderIndex?: number): Promise<MediaStream>;
47
+ startAudioSegment(correlationId?: string): void;
48
+ endAudioSegment(correlationId?: string): void;
49
+ /**
50
+ * Communicate the originator's correlation id for a video capture sender to the server-side
51
+ * WebRtcMediaBridge so the next VideoStreamBegin it emits for this sender carries it.
52
+ * Called by the video capture path when starting a CaptureButton-initiated stream.
53
+ */
54
+ sendVideoCaptureCorrelation(senderIndex: number, correlationId?: string): void;
55
+ startVideoCapture(constraints?: MediaTrackConstraints, bitrate?: number, senderIndex?: number, correlationId?: string): Promise<void>;
56
+ startScreenCapture(constraints?: MediaTrackConstraints, bitrate?: number, senderIndex?: number, correlationId?: string): Promise<MediaStream>;
45
57
  stopVideoCapture(senderIndex: number): Promise<void>;
46
58
  private sendVideoStreamBegin;
47
59
  private sendVideoStreamEnd;