@memberjunction/livekit-room-core 6.2.0-edge.3 → 6.2.0-edge.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +32 -1
  2. package/dist/agent-avatar.d.ts +18 -0
  3. package/dist/agent-avatar.d.ts.map +1 -0
  4. package/dist/agent-avatar.js +25 -0
  5. package/dist/agent-avatar.js.map +1 -0
  6. package/dist/audio-meter.d.ts +24 -8
  7. package/dist/audio-meter.d.ts.map +1 -1
  8. package/dist/audio-meter.js +19 -8
  9. package/dist/audio-meter.js.map +1 -1
  10. package/dist/index.d.ts +5 -3
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/livekit-preview-room-controller.d.ts +162 -0
  15. package/dist/livekit-preview-room-controller.d.ts.map +1 -0
  16. package/dist/livekit-preview-room-controller.js +475 -0
  17. package/dist/livekit-preview-room-controller.js.map +1 -0
  18. package/dist/livekit-preview.d.ts +6 -1
  19. package/dist/livekit-preview.d.ts.map +1 -1
  20. package/dist/livekit-preview.js +6 -1
  21. package/dist/livekit-preview.js.map +1 -1
  22. package/dist/livekit-room-controller.d.ts +132 -11
  23. package/dist/livekit-room-controller.d.ts.map +1 -1
  24. package/dist/livekit-room-controller.js +174 -35
  25. package/dist/livekit-room-controller.js.map +1 -1
  26. package/dist/livekit-screen-share.d.ts +73 -0
  27. package/dist/livekit-screen-share.d.ts.map +1 -0
  28. package/dist/livekit-screen-share.js +137 -0
  29. package/dist/livekit-screen-share.js.map +1 -0
  30. package/dist/media-adapters.d.ts +26 -0
  31. package/dist/media-adapters.d.ts.map +1 -0
  32. package/dist/media-adapters.js +101 -0
  33. package/dist/media-adapters.js.map +1 -0
  34. package/dist/types.d.ts +78 -5
  35. package/dist/types.d.ts.map +1 -1
  36. package/package.json +4 -2
package/README.md CHANGED
@@ -47,7 +47,7 @@ room.Events.On('beforeDisconnect', (e) => {
47
47
  // Transform an outgoing chat message
48
48
  room.Events.On('beforeSendData', (e) => { e.Text = e.Text.trim(); });
49
49
 
50
- await room.Connect('wss://livekit.myorg.com', signedToken, { DisplayName: 'Amith' });
50
+ await room.Connect('wss://livekit.myorg.com', signedToken, { DisplayName: 'Jordan' });
51
51
  await room.ToggleCamera();
52
52
  await room.SendData('hello', 'lk-chat');
53
53
  ```
@@ -58,6 +58,8 @@ await room.SendData('hello', 'lk-chat');
58
58
  |---|---|
59
59
  | Connect / leave | `Connect(url, token, options)`, `Disconnect()` |
60
60
  | Local media | `ToggleMicrophone()` / `ToggleCamera()` / `ToggleScreenShare()`, `Set*Enabled()` |
61
+ | Screen share, including one panel of the page | `SetScreenShareEnabled(true, request?)`, `ChangeScreenShare(request?)`, `State.LocalMedia.ScreenSharePanelLabel` (see below) |
62
+ | An agent's avatar | `ToMediaParticipant`, `LiveKitParticipantView.AvatarAudioOnly` (see below) |
61
63
  | Devices | `ListDevices(kind)`, `SwitchDevice(kind, id)` |
62
64
  | Data channel | `SendData(text, topic?)` |
63
65
  | Audio autoplay unblock | `StartAudio()` + `State.AudioPlaybackBlocked` |
@@ -67,6 +69,35 @@ await room.SendData('hello', 'lk-chat');
67
69
  | PreJoin preview (room-free) | `LiveKitMediaPreview` |
68
70
  | Audio visualizer math | `LiveKitAudioMeter` |
69
71
 
72
+ ## Screen share
73
+
74
+ The controller shares through display capture (`RequestDisplayCapture` in `@memberjunction/ai-realtime-client/media`),
75
+ not LiveKit's own capture, and publishes the shared track with `publishTrack` as the participant's screen share.
76
+
77
+ - **What to share.** `SetScreenShareEnabled(true, request)` and `ChangeScreenShare(request)` take the kind of surface the
78
+ browser's picker offers first (`'screen'`, `'window'` or `'tab'`), or `/media`'s `DisplayCaptureOptions`. The options
79
+ can name one element of the page to share alone (`Panel`; Chrome and Edge) and its name (`PanelLabel`). While a
80
+ named panel is shared, `State.LocalMedia.ScreenSharePanelLabel` holds its name.
81
+ - **The cap.** The shared track is capped at 1920x1080 and 30 fps, LiveKit's own `ScreenSharePresets.h1080fps30`. These
82
+ are maximums, so a small panel is not upscaled. A browser that refuses them shares at full size.
83
+ - **The picker.** Closing it shares nothing and is no error. A share the browser refuses is a `device` error whose
84
+ `Cause` holds the picker's reason. The `RequestScreenShare` constructor option replaces the picker (default
85
+ `RequestDisplayCapture`), so tests can pass a fake.
86
+
87
+ `ToScreenShareCaptureOptions` is deprecated: nothing in MJ calls it. It stays for code that drives LiveKit's own
88
+ `setScreenShareEnabled`.
89
+
90
+ ## An agent's avatar
91
+
92
+ An agent's bot publishes the agent's avatar as a camera track named `agent-avatar` (`REALTIME_AGENT_AVATAR_TRACK_NAME`
93
+ in `@memberjunction/ai`). `ToMediaParticipant` turns an agent's camera track by that name into the participant's avatar
94
+ video (`Video.avatar`), so `mj-media-tile` labels it "AI-generated video". A person's track by that name stays a camera.
95
+
96
+ The bot also sets the `mj.agentAvatar` attribute. When it reads `audio-only:<reason>`, the controller sets
97
+ `LiveKitParticipantView.AvatarAudioOnly` on that agent's view, reading the attribute with `ReadAgentAvatarAttribute`
98
+ from `@memberjunction/ai`. `AvatarAudioOnly.Reason` is set when the reason is one this version knows. The controller
99
+ rebuilds the state on every attribute change, so a change mid-meeting shows at once.
100
+
70
101
  ## The cancelable event architecture
71
102
 
72
103
  `controller.Events` is a typed `LiveKitRoomEventBus`. **Before-events** run synchronously and may be
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @fileoverview An agent's avatar in a meeting, as its bot reports it: the camera track it publishes the avatar on,
3
+ * and its `mj.agentAvatar` attribute, which says when the avatar can't be shown. The names, and the attribute's reader,
4
+ * are in `@memberjunction/ai`, which the bot uses too.
5
+ *
6
+ * @module @memberjunction/livekit-room-core
7
+ */
8
+ import { type RealtimeParticipantAttributes } from '@memberjunction/ai';
9
+ import type { LiveKitAvatarAudioOnly, LiveKitParticipantRole } from './types.js';
10
+ /**
11
+ * Whether an agent's bot's attributes say the meeting can't show the agent's avatar, and why (`ReadAgentAvatarAttribute`;
12
+ * no reason for one this room doesn't know). `undefined` while the avatar shows, when the agent asked for none, and for
13
+ * a value the bot doesn't write.
14
+ */
15
+ export declare function ReadAvatarAudioOnly(attributes?: RealtimeParticipantAttributes | null): LiveKitAvatarAudioOnly | undefined;
16
+ /** Whether a camera track is an agent's avatar: an agent's bot publishes the avatar as a camera track of that name. */
17
+ export declare function IsAgentAvatarTrack(role: LiveKitParticipantRole, trackName: string | undefined): boolean;
18
+ //# sourceMappingURL=agent-avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-avatar.d.ts","sourceRoot":"","sources":["../src/agent-avatar.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA8D,KAAK,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACpI,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,6BAA6B,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,CAMzH;AAED,uHAAuH;AACvH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEvG"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview An agent's avatar in a meeting, as its bot reports it: the camera track it publishes the avatar on,
3
+ * and its `mj.agentAvatar` attribute, which says when the avatar can't be shown. The names, and the attribute's reader,
4
+ * are in `@memberjunction/ai`, which the bot uses too.
5
+ *
6
+ * @module @memberjunction/livekit-room-core
7
+ */
8
+ import { REALTIME_AGENT_AVATAR_TRACK_NAME, ReadAgentAvatarAttribute } from '@memberjunction/ai';
9
+ /**
10
+ * Whether an agent's bot's attributes say the meeting can't show the agent's avatar, and why (`ReadAgentAvatarAttribute`;
11
+ * no reason for one this room doesn't know). `undefined` while the avatar shows, when the agent asked for none, and for
12
+ * a value the bot doesn't write.
13
+ */
14
+ export function ReadAvatarAudioOnly(attributes) {
15
+ const avatar = ReadAgentAvatarAttribute(attributes);
16
+ if (avatar?.State !== 'audio-only') {
17
+ return undefined;
18
+ }
19
+ return avatar.Reason ? { Reason: avatar.Reason } : {};
20
+ }
21
+ /** Whether a camera track is an agent's avatar: an agent's bot publishes the avatar as a camera track of that name. */
22
+ export function IsAgentAvatarTrack(role, trackName) {
23
+ return role === 'agent' && trackName === REALTIME_AGENT_AVATAR_TRACK_NAME;
24
+ }
25
+ //# sourceMappingURL=agent-avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-avatar.js","sourceRoot":"","sources":["../src/agent-avatar.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAsC,MAAM,oBAAoB,CAAC;AAGpI;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAiD;IACnF,MAAM,MAAM,GAAG,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACpD,IAAI,MAAM,EAAE,KAAK,KAAK,YAAY,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,kBAAkB,CAAC,IAA4B,EAAE,SAA6B;IAC5F,OAAO,IAAI,KAAK,OAAO,IAAI,SAAS,KAAK,gCAAgC,CAAC;AAC5E,CAAC"}
@@ -1,16 +1,27 @@
1
1
  /**
2
- * @fileoverview {@link LiveKitAudioMeter} — a tiny, pure, DOM-free smoother that turns a stream of raw
3
- * 0..1 audio levels (e.g. `participant.audioLevel`) into a smoothed level plus a set of bar bins for a
4
- * voice visualizer. UI layers call {@link LiveKitAudioMeter.Next} on each animation frame; keeping the
5
- * math here (not in a component) makes it framework-agnostic and unit-testable.
2
+ * @fileoverview The room's audio meter settings, and the deprecated {@link LiveKitAudioMeter}.
3
+ *
4
+ * The constants are how the room's meters move: seven bars, quick to rise and slow to fall. The room passes them to the
5
+ * shared meter (`LIVEKIT_METER_SETTINGS` in `@memberjunction/ng-livekit-room`), which runs on `AudioLevelSmoother` from
6
+ * `@memberjunction/ai-realtime-client/media`. {@link LiveKitAudioMeter} is the smoother the room used before; nothing in
7
+ * MJ uses it now.
6
8
  *
7
9
  * @module @memberjunction/livekit-room-core
8
10
  */
9
- /** The number of visualizer bars produced by {@link LiveKitAudioMeter}. */
11
+ /** The number of bars in the room's audio meters. */
10
12
  export declare const AUDIO_METER_BIN_COUNT = 7;
11
13
  /** Below this level the meter is treated as silent (clamps idle noise to a flat baseline). */
12
14
  export declare const AUDIO_METER_SILENCE_FLOOR = 0.04;
13
- /** One smoothed frame of audio-visual data. */
15
+ /** How fast the meter rises toward a louder level, 0..1. */
16
+ export declare const AUDIO_METER_ATTACK = 0.6;
17
+ /** How fast the meter falls toward a quieter level, 0..1. */
18
+ export declare const AUDIO_METER_DECAY = 0.18;
19
+ /**
20
+ * One smoothed frame of audio-visual data.
21
+ *
22
+ * @deprecated Use `AudioLevelFrame` from `@memberjunction/ai-realtime-client/media`, the frame `AudioLevelSmoother`
23
+ * returns. It has the same members, with `Bars` in place of `Bins`.
24
+ */
14
25
  export interface LiveKitAudioMeterFrame {
15
26
  /** Smoothed level, 0..1. */
16
27
  Level: number;
@@ -22,6 +33,11 @@ export interface LiveKitAudioMeterFrame {
22
33
  /**
23
34
  * Exponential-smoothing audio meter. Attack (rising) is faster than decay (falling) so the meter feels
24
35
  * responsive when speech starts but settles gently — the standard VU-meter feel.
36
+ *
37
+ * @deprecated Use `AudioLevelSmoother` from `@memberjunction/ai-realtime-client/media`, the shared smoother the room's
38
+ * meters run on. With this meter's settings (`BarCount` {@link AUDIO_METER_BIN_COUNT}, `Attack`
39
+ * {@link AUDIO_METER_ATTACK}, `Decay` {@link AUDIO_METER_DECAY}, `SilenceFloor` {@link AUDIO_METER_SILENCE_FLOOR}) it
40
+ * returns the same frames.
25
41
  */
26
42
  export declare class LiveKitAudioMeter {
27
43
  private readonly attack;
@@ -29,8 +45,8 @@ export declare class LiveKitAudioMeter {
29
45
  private smoothed;
30
46
  private readonly bins;
31
47
  /**
32
- * @param attack Smoothing factor when the level is rising, 0..1 (higher = snappier). Default 0.6.
33
- * @param decay Smoothing factor when the level is falling, 0..1 (lower = slower fall). Default 0.18.
48
+ * @param attack Smoothing factor when the level is rising, 0..1 (higher = snappier). Default {@link AUDIO_METER_ATTACK}.
49
+ * @param decay Smoothing factor when the level is falling, 0..1 (lower = slower fall). Default {@link AUDIO_METER_DECAY}.
34
50
  */
35
51
  constructor(attack?: number, decay?: number);
36
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"audio-meter.d.ts","sourceRoot":"","sources":["../src/audio-meter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,8FAA8F;AAC9F,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB;IACrC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,2DAA2D;IAC3D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAS1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IATxB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsD;IAE3E;;;OAGG;gBAEgB,MAAM,SAAM,EACZ,KAAK,SAAO;IAG/B;;;;;OAKG;IACI,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB;IAUrD,mCAAmC;IAC5B,KAAK,IAAI,IAAI;IAKpB,sFAAsF;IACtF,OAAO,CAAC,UAAU;CAWnB"}
1
+ {"version":3,"file":"audio-meter.d.ts","sourceRoot":"","sources":["../src/audio-meter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,8FAA8F;AAC9F,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,2DAA2D;IAC3D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAS1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IATxB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsD;IAE3E;;;OAGG;gBAEgB,MAAM,SAAqB,EAC3B,KAAK,SAAoB;IAG5C;;;;;OAKG;IACI,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,sBAAsB;IAUrD,mCAAmC;IAC5B,KAAK,IAAI,IAAI;IAKpB,sFAAsF;IACtF,OAAO,CAAC,UAAU;CAWnB"}
@@ -1,25 +1,36 @@
1
1
  /**
2
- * @fileoverview {@link LiveKitAudioMeter} — a tiny, pure, DOM-free smoother that turns a stream of raw
3
- * 0..1 audio levels (e.g. `participant.audioLevel`) into a smoothed level plus a set of bar bins for a
4
- * voice visualizer. UI layers call {@link LiveKitAudioMeter.Next} on each animation frame; keeping the
5
- * math here (not in a component) makes it framework-agnostic and unit-testable.
2
+ * @fileoverview The room's audio meter settings, and the deprecated {@link LiveKitAudioMeter}.
3
+ *
4
+ * The constants are how the room's meters move: seven bars, quick to rise and slow to fall. The room passes them to the
5
+ * shared meter (`LIVEKIT_METER_SETTINGS` in `@memberjunction/ng-livekit-room`), which runs on `AudioLevelSmoother` from
6
+ * `@memberjunction/ai-realtime-client/media`. {@link LiveKitAudioMeter} is the smoother the room used before; nothing in
7
+ * MJ uses it now.
6
8
  *
7
9
  * @module @memberjunction/livekit-room-core
8
10
  */
9
- /** The number of visualizer bars produced by {@link LiveKitAudioMeter}. */
11
+ /** The number of bars in the room's audio meters. */
10
12
  export const AUDIO_METER_BIN_COUNT = 7;
11
13
  /** Below this level the meter is treated as silent (clamps idle noise to a flat baseline). */
12
14
  export const AUDIO_METER_SILENCE_FLOOR = 0.04;
15
+ /** How fast the meter rises toward a louder level, 0..1. */
16
+ export const AUDIO_METER_ATTACK = 0.6;
17
+ /** How fast the meter falls toward a quieter level, 0..1. */
18
+ export const AUDIO_METER_DECAY = 0.18;
13
19
  /**
14
20
  * Exponential-smoothing audio meter. Attack (rising) is faster than decay (falling) so the meter feels
15
21
  * responsive when speech starts but settles gently — the standard VU-meter feel.
22
+ *
23
+ * @deprecated Use `AudioLevelSmoother` from `@memberjunction/ai-realtime-client/media`, the shared smoother the room's
24
+ * meters run on. With this meter's settings (`BarCount` {@link AUDIO_METER_BIN_COUNT}, `Attack`
25
+ * {@link AUDIO_METER_ATTACK}, `Decay` {@link AUDIO_METER_DECAY}, `SilenceFloor` {@link AUDIO_METER_SILENCE_FLOOR}) it
26
+ * returns the same frames.
16
27
  */
17
28
  export class LiveKitAudioMeter {
18
29
  /**
19
- * @param attack Smoothing factor when the level is rising, 0..1 (higher = snappier). Default 0.6.
20
- * @param decay Smoothing factor when the level is falling, 0..1 (lower = slower fall). Default 0.18.
30
+ * @param attack Smoothing factor when the level is rising, 0..1 (higher = snappier). Default {@link AUDIO_METER_ATTACK}.
31
+ * @param decay Smoothing factor when the level is falling, 0..1 (lower = slower fall). Default {@link AUDIO_METER_DECAY}.
21
32
  */
22
- constructor(attack = 0.6, decay = 0.18) {
33
+ constructor(attack = AUDIO_METER_ATTACK, decay = AUDIO_METER_DECAY) {
23
34
  this.attack = attack;
24
35
  this.decay = decay;
25
36
  this.smoothed = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"audio-meter.js","sourceRoot":"","sources":["../src/audio-meter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAY9C;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAI5B;;;OAGG;IACH,YACmB,SAAS,GAAG,EACZ,QAAQ,IAAI;QADZ,WAAM,GAAN,MAAM,CAAM;QACZ,UAAK,GAAL,KAAK,CAAO;QATvB,aAAQ,GAAG,CAAC,CAAC;QACJ,SAAI,GAAa,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IASxE,CAAC;IAEJ;;;;;OAKG;IACI,IAAI,CAAC,QAAgB;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAClE,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QAEpD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,yBAAyB,CAAC;QAC3D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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12 @@
6
6
  *
7
7
  * @module @memberjunction/livekit-room-core
8
8
  */
9
- export { LiveKitRoomController, DefaultRoomFactory, defaultRoomFactory, DefaultRoleResolver, defaultRoleResolver, type LiveKitRoomFactory, type LiveKitRoleResolver, type LiveKitRoomControllerOptions, } from './livekit-room-controller.js';
10
- export { LiveKitAudioMeter, AUDIO_METER_BIN_COUNT, AUDIO_METER_SILENCE_FLOOR, type LiveKitAudioMeterFrame } from './audio-meter.js';
9
+ export { LiveKitRoomController, DEFAULT_SPEECH_ROOM_OPTIONS, DefaultRoomFactory, defaultRoomFactory, DefaultRoleResolver, defaultRoleResolver, type LiveKitRoomFactory, type LiveKitRoleResolver, type LiveKitRoomControllerOptions, type ILiveKitRoomController, } from './livekit-room-controller.js';
10
+ export { LiveKitAudioMeter, AUDIO_METER_BIN_COUNT, AUDIO_METER_SILENCE_FLOOR, AUDIO_METER_ATTACK, AUDIO_METER_DECAY, type LiveKitAudioMeterFrame, } from './audio-meter.js';
11
11
  export { LiveKitMediaPreview } from './livekit-preview.js';
12
+ export { ToMediaParticipant, ToMediaDevice, ToMediaDeviceKind, ToLiveKitDeviceKind } from './media-adapters.js';
13
+ export { LiveKitPreviewRoomController, LIVEKIT_PREVIEW_PEOPLE, LIVEKIT_PREVIEW_ROOM_NAME, LIVEKIT_PREVIEW_LOCAL_IDENTITY, type LiveKitPreviewPerson, type LiveKitPreviewRoomOptions, } from './livekit-preview-room-controller.js';
12
14
  export { ApplyNoiseFilter, applyNoiseFilter, ApplyBackgroundEffect, applyBackgroundEffect } from './livekit-effects.js';
13
15
  export { LiveKitRoomEventBus, type LiveKitEventHandler, type LiveKitRoomEventMap, type LiveKitCancelableEvent, type LiveKitBeforeConnectEvent, type LiveKitBeforeDisconnectEvent, type LiveKitBeforeMediaToggleEvent, type LiveKitBeforeSendDataEvent, type LiveKitBeforeDeviceSwitchEvent, type LiveKitParticipantJoinedEvent, type LiveKitParticipantLeftEvent, type LiveKitActiveSpeakersEvent, type LiveKitDisconnectedEvent, } from './events.js';
14
- export type { LiveKitConnectionStatus, LiveKitDisconnectReason, LiveKitParticipantRole, LiveKitTrackKind, LiveKitParticipantView, LiveKitDataMessage, LiveKitRoomError, LiveKitLocalMediaState, LiveKitDevice, LiveKitRoomConnectOptions, LiveKitRoomState, LiveKitTrackSourceMapper, LiveKitBackgroundEffect, LiveKitE2EEOptions, } from './types.js';
16
+ export type { LiveKitConnectionStatus, LiveKitDisconnectReason, LiveKitParticipantRole, LiveKitTrackKind, LiveKitParticipantView, LiveKitParticipantMedia, LiveKitAvatarAudioOnly, LiveKitDataMessage, LiveKitRoomError, LiveKitErrorDevice, LiveKitLocalMediaState, LiveKitDevice, LiveKitRoomConnectOptions, LiveKitRoomState, LiveKitTrackSourceMapper, LiveKitBackgroundEffect, LiveKitE2EEOptions, } from './types.js';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEjI,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAErH,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,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mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -6,9 +6,11 @@
6
6
  *
7
7
  * @module @memberjunction/livekit-room-core
8
8
  */
9
- export { LiveKitRoomController, DefaultRoomFactory, defaultRoomFactory, DefaultRoleResolver, defaultRoleResolver, } from './livekit-room-controller.js';
10
- export { LiveKitAudioMeter, AUDIO_METER_BIN_COUNT, AUDIO_METER_SILENCE_FLOOR } from './audio-meter.js';
9
+ export { LiveKitRoomController, DEFAULT_SPEECH_ROOM_OPTIONS, DefaultRoomFactory, defaultRoomFactory, DefaultRoleResolver, defaultRoleResolver, } from './livekit-room-controller.js';
10
+ export { LiveKitAudioMeter, AUDIO_METER_BIN_COUNT, AUDIO_METER_SILENCE_FLOOR, AUDIO_METER_ATTACK, AUDIO_METER_DECAY, } from './audio-meter.js';
11
11
  export { LiveKitMediaPreview } from './livekit-preview.js';
12
+ export { ToMediaParticipant, ToMediaDevice, ToMediaDeviceKind, ToLiveKitDeviceKind } from './media-adapters.js';
13
+ export { LiveKitPreviewRoomController, LIVEKIT_PREVIEW_PEOPLE, LIVEKIT_PREVIEW_ROOM_NAME, LIVEKIT_PREVIEW_LOCAL_IDENTITY, } from './livekit-preview-room-controller.js';
12
14
  export { ApplyNoiseFilter, applyNoiseFilter, ApplyBackgroundEffect, applyBackgroundEffect } from './livekit-effects.js';
13
15
  export { LiveKitRoomEventBus, } from './events.js';
14
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,GAIzC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,yBAAyB,EAA+B,MAAM,eAAe,CAAC;AAEjI,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAErH,OAAO,EACL,mBAAmB,GAapB,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAAE,kBAAkB,EACtC,mBAAmB,EAAE,mBAAmB,GAKzC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,GAG/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAErH,OAAO,EACL,mBAAmB,GAapB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @fileoverview {@link LiveKitPreviewRoomController}: a meeting room that needs no LiveKit server, for trying the room
3
+ * UI. Your camera, microphone and screen share are real; everyone else is simulated, and nothing is sent anywhere.
4
+ *
5
+ * - **You.** Your camera and microphone run on the shared `MediaPreview` (as a lobby's do), on the camera-and-microphone
6
+ * controller the host provides. Your tile shows your camera and your microphone's level. Sharing your screen opens
7
+ * the browser's picker, as in a real room.
8
+ * - **Everyone else.** The people in the options (by default an agent and three participants) are in the room from the
9
+ * start, without cameras, and take turns speaking, so the speaking ring, the active speaker and the meters move.
10
+ * - **What the agent sees.** The simulated agent watches (unless `AgentWatches` is off), so the room offers the
11
+ * "Let the agent see" choice; {@link LiveKitPreviewRoomController.SetAgentVision} records yours at once, where a
12
+ * meeting records it through the server. A simulated person can allow it too (Ada does, by default).
13
+ * - **Not simulated.** Nobody else sends chat or whiteboard messages, joins or leaves, or shares a screen; noise
14
+ * filtering and background effects are unavailable.
15
+ *
16
+ * It implements {@link ILiveKitRoomController}, so `mj-livekit-room` runs on it unchanged, provided through
17
+ * `LIVEKIT_ROOM_CONTROLLER_FACTORY`.
18
+ *
19
+ * @module @memberjunction/livekit-room-core
20
+ */
21
+ import { type Observable } from 'rxjs';
22
+ import { type DisplayCaptureOptions, type DisplayCaptureResult, type DisplayCaptureSurface, type ILocalMediaController, type MediaPreviewOptions } from '@memberjunction/ai-realtime-client/media';
23
+ import { LiveKitRoomEventBus } from './events.js';
24
+ import type { ILiveKitRoomController } from './livekit-room-controller.js';
25
+ import type { LiveKitBackgroundEffect, LiveKitConnectionStatus, LiveKitDevice, LiveKitParticipantRole, LiveKitRoomConnectOptions, LiveKitRoomState } from './types.js';
26
+ /** A simulated person in a preview room. */
27
+ export interface LiveKitPreviewPerson {
28
+ /** Stable identity in the room. */
29
+ Identity: string;
30
+ /** The name on their tile. */
31
+ DisplayName: string;
32
+ /** `'agent'` shows as the room's AI agent. */
33
+ Role: LiveKitParticipantRole;
34
+ /** Whether this person lets agents see their camera and shared screen. */
35
+ AgentCanSee?: boolean;
36
+ }
37
+ /** The people in a preview room unless the options name others: an agent and three participants. */
38
+ export declare const LIVEKIT_PREVIEW_PEOPLE: readonly LiveKitPreviewPerson[];
39
+ /** The preview room's name, as the room's header shows it. */
40
+ export declare const LIVEKIT_PREVIEW_ROOM_NAME = "Preview room";
41
+ /** Your identity in a preview room. */
42
+ export declare const LIVEKIT_PREVIEW_LOCAL_IDENTITY = "preview-you";
43
+ /** How a preview room runs. All optional. */
44
+ export interface LiveKitPreviewRoomOptions {
45
+ /** Makes the camera-and-microphone controller each join runs on. Defaults to the browser's `LocalMediaController`. */
46
+ LocalMedia?: () => ILocalMediaController;
47
+ /** The simulated people. Defaults to {@link LIVEKIT_PREVIEW_PEOPLE}. */
48
+ People?: readonly LiveKitPreviewPerson[];
49
+ /** How long each person speaks before the next one starts, in milliseconds. Defaults to 4000. */
50
+ TurnMs?: number;
51
+ /** Opens the browser's share picker. Defaults to `RequestDisplayCapture`; a test passes its own. */
52
+ RequestScreenShare?: (options: DisplayCaptureOptions) => Promise<DisplayCaptureResult>;
53
+ /** Meters your microphone. Defaults to `MediaPreview`'s meter; a test passes its own. */
54
+ MeterFor?: MediaPreviewOptions['MeterFor'];
55
+ /** Whether the simulated agent watches the cameras and screens people let it see. Defaults to `true`. */
56
+ AgentWatches?: boolean;
57
+ /** A shared event bus (e.g. so a host can subscribe before connecting). */
58
+ EventBus?: LiveKitRoomEventBus;
59
+ }
60
+ /** A meeting room with no server: see the file header. */
61
+ export declare class LiveKitPreviewRoomController implements ILiveKitRoomController {
62
+ /** The room's cancelable event bus, as on the LiveKit controller. */
63
+ readonly Events: LiveKitRoomEventBus;
64
+ private readonly state;
65
+ private readonly localMedia;
66
+ private readonly people;
67
+ private readonly turnMs;
68
+ private readonly requestShare;
69
+ private readonly meterFor;
70
+ private readonly agentWatches;
71
+ private session;
72
+ constructor(options?: LiveKitPreviewRoomOptions);
73
+ /** The room-state snapshot: the current value on subscribe, then every change. */
74
+ get State$(): Observable<LiveKitRoomState>;
75
+ /** The current room-state snapshot. */
76
+ get State(): LiveKitRoomState;
77
+ /** The current connection status. */
78
+ get Status(): LiveKitConnectionStatus;
79
+ /**
80
+ * Joins the preview room: starts your microphone and camera as the options say, on the devices they name, then
81
+ * shows the simulated people, the first one speaking.
82
+ *
83
+ * @param serverUrl Reported to `beforeConnect` handlers; nothing connects to it.
84
+ * @param _token Ignored: there is no server to present it to.
85
+ * @param options Your name, the media you start with, and the devices.
86
+ */
87
+ Connect(serverUrl: string, _token: string, options?: LiveKitRoomConnectOptions): Promise<void>;
88
+ /**
89
+ * Leaves the room and frees your devices. A user-initiated leave raises a cancelable `beforeDisconnect` first.
90
+ *
91
+ * @returns `false` when a `beforeDisconnect` handler canceled it.
92
+ */
93
+ Disconnect(userInitiated?: boolean): Promise<boolean>;
94
+ /** Leaves the room, frees your devices, completes {@link State$} and clears the event bus. */
95
+ Dispose(): void;
96
+ /** Turns your microphone on or off. */
97
+ SetMicrophoneEnabled(enabled: boolean): Promise<void>;
98
+ /** Turns your camera on or off. */
99
+ SetCameraEnabled(enabled: boolean): Promise<void>;
100
+ /**
101
+ * Starts or stops sharing. `request` is the kind of surface the browser's picker offers first, or the share's
102
+ * options: one panel of the page to share alone (`Panel`), with its name (`PanelLabel`).
103
+ */
104
+ SetScreenShareEnabled(enabled: boolean, request?: DisplayCaptureSurface | DisplayCaptureOptions): Promise<void>;
105
+ /** Toggles your microphone and resolves the new state. */
106
+ ToggleMicrophone(): Promise<boolean>;
107
+ /** Toggles your camera and resolves the new state. */
108
+ ToggleCamera(): Promise<boolean>;
109
+ /** Toggles sharing your screen and resolves the new state. */
110
+ ToggleScreenShare(): Promise<boolean>;
111
+ /** Shares something else: stops the current share, then opens the browser's picker again, with `request` as above. */
112
+ ChangeScreenShare(request?: DisplayCaptureSurface | DisplayCaptureOptions): Promise<void>;
113
+ /**
114
+ * Records whether you let agents see your camera and shared screen, as a meeting's server would, and raises
115
+ * `localMediaChanged`. Outside the room it does nothing.
116
+ */
117
+ SetAgentVision(on: boolean): void;
118
+ /**
119
+ * Raises the cancelable `beforeSendData`; nobody else is in the room to receive the message. Resolves `true` unless a
120
+ * handler canceled it or you are not in the room.
121
+ */
122
+ SendData(text: string, topic?: string): Promise<boolean>;
123
+ /** Nothing to do: the simulated people make no sound, so the browser never blocks it. */
124
+ StartAudio(): Promise<void>;
125
+ /** Not available in the preview room. */
126
+ SetNoiseFilterEnabled(_enabled: boolean): Promise<boolean>;
127
+ /** Not available in the preview room. */
128
+ SetBackgroundEffect(_effect: LiveKitBackgroundEffect): Promise<boolean>;
129
+ /** Your microphones or cameras, while you are in the room. There are no speakers to pick: nothing plays. */
130
+ ListDevices(kind: LiveKitDevice['Kind']): Promise<LiveKitDevice[]>;
131
+ /** The microphone or camera in use (or chosen), or `null` for speakers and outside the room. */
132
+ GetActiveDeviceId(kind: LiveKitDevice['Kind']): string | null;
133
+ /** Moves your microphone or camera to another device; raises the cancelable `beforeDeviceSwitch` first. */
134
+ SwitchDevice(kind: LiveKitDevice['Kind'], deviceId: string): Promise<void>;
135
+ /** A new session: your media (not started yet) and a bare participant for you and each person. */
136
+ private openSession;
137
+ /** Starts your microphone and camera, on the devices the options name. */
138
+ private startMedia;
139
+ /** Shows the room, reports a kind that failed to start, follows your media from here on, and starts the turns. */
140
+ private beginSession;
141
+ /** Passes the turn to the next person. */
142
+ private nextTurn;
143
+ /** Turns a kind on or off, raising the cancelable `beforeMediaToggle` first and `localMediaChanged` after. */
144
+ private toggleLocalMedia;
145
+ /** Turns your microphone or camera on or off; a start that fails is reported as a device error. */
146
+ private setCapturing;
147
+ /** Starts sharing through the browser's picker, or stops. Cancelling the picker leaves you not sharing. */
148
+ private setSharing;
149
+ /** Keeps a share that started, and follows it ending in the browser ("Stop sharing"). */
150
+ private keepShare;
151
+ /** The browser ended your share: the room stops showing it. */
152
+ private onShareEnded;
153
+ /** Reports a kind whose capture failed to turn on as a device error. */
154
+ private reportFailure;
155
+ /** Rebuilds the room's state from the session and emits it. */
156
+ private rebuildState;
157
+ /** Pushes a partial update onto the state, emits it, and fires `stateChanged`. */
158
+ private patchState;
159
+ /** Emits a room error; the preview's are device errors, each naming its device (`Device`). */
160
+ private emitError;
161
+ }
162
+ //# sourceMappingURL=livekit-preview-room-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"livekit-preview-room-controller.d.ts","sourceRoot":"","sources":["../src/livekit-preview-room-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAyB,KAAK,UAAU,EAAqB,MAAM,MAAM,CAAC;AACjF,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EAGzB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAGxE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EAGb,sBAAsB,EAEtB,yBAAyB,EAEzB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,IAAI,EAAE,sBAAsB,CAAC;IAC7B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,oGAAoG;AACpG,eAAO,MAAM,sBAAsB,EAAE,SAA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