@poolse/sdk 2.13.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +61 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js +61 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1481,6 +1481,28 @@ interface LiveKitPublication {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
/** Which camera a video track is capturing from. */
|
|
1483
1483
|
type CameraFacing = 'user' | 'environment';
|
|
1484
|
+
/**
|
|
1485
|
+
* A class of media device.
|
|
1486
|
+
*
|
|
1487
|
+
* Spelled out rather than reusing the DOM's `MediaDeviceKind` so the
|
|
1488
|
+
* type means the same thing on React Native, where there is no DOM but
|
|
1489
|
+
* `audiooutput` is still a real concept.
|
|
1490
|
+
*/
|
|
1491
|
+
type CallDeviceKind = 'videoinput' | 'audioinput' | 'audiooutput';
|
|
1492
|
+
/** A selectable input or output. */
|
|
1493
|
+
interface CallDevice {
|
|
1494
|
+
deviceId: string;
|
|
1495
|
+
kind: CallDeviceKind;
|
|
1496
|
+
/**
|
|
1497
|
+
* The browser's own label, e.g. "FaceTime HD Camera".
|
|
1498
|
+
*
|
|
1499
|
+
* Empty until the page holds a matching permission — the browser
|
|
1500
|
+
* withholds labels from sites that have never been granted the
|
|
1501
|
+
* device, precisely so they cannot be fingerprinted. In a call that
|
|
1502
|
+
* permission is already held, so labels are normally present.
|
|
1503
|
+
*/
|
|
1504
|
+
label: string;
|
|
1505
|
+
}
|
|
1484
1506
|
/** The slice of LiveKit's `LocalVideoTrack` used to flip the camera. */
|
|
1485
1507
|
interface LiveKitLocalVideoTrack {
|
|
1486
1508
|
restartTrack?(constraints?: {
|
|
@@ -1510,6 +1532,16 @@ interface LiveKitLocalParticipant extends LiveKitParticipant {
|
|
|
1510
1532
|
}
|
|
1511
1533
|
interface LiveKitRoomHandle {
|
|
1512
1534
|
localParticipant: LiveKitLocalParticipant;
|
|
1535
|
+
/**
|
|
1536
|
+
* Move every track of `kind` onto another device.
|
|
1537
|
+
*
|
|
1538
|
+
* `audiooutput` is the web's answer to a speakerphone button: it
|
|
1539
|
+
* re-points every incoming audio element with `setSinkId`. Not every
|
|
1540
|
+
* browser implements it, which is why the result is a boolean rather
|
|
1541
|
+
* than a throw.
|
|
1542
|
+
*/
|
|
1543
|
+
switchActiveDevice?(kind: string, deviceId: string, exact?: boolean): Promise<unknown>;
|
|
1544
|
+
getActiveDevice?(kind: string): string | undefined;
|
|
1513
1545
|
/** Keyed by identity. `remoteParticipants` is the v2 name. */
|
|
1514
1546
|
remoteParticipants: Map<string, LiveKitParticipant>;
|
|
1515
1547
|
connect(url: string, token: string, options?: unknown): Promise<void>;
|
|
@@ -1548,10 +1580,19 @@ interface LiveKitModule {
|
|
|
1548
1580
|
}
|
|
1549
1581
|
/** The precise shape, used internally once the module has been checked. */
|
|
1550
1582
|
interface CheckedLiveKitModule {
|
|
1551
|
-
Room: new (options?: {
|
|
1583
|
+
Room: (new (options?: {
|
|
1552
1584
|
adaptiveStream?: boolean;
|
|
1553
1585
|
dynacast?: boolean;
|
|
1554
|
-
}) => LiveKitRoomHandle
|
|
1586
|
+
}) => LiveKitRoomHandle) & {
|
|
1587
|
+
/**
|
|
1588
|
+
* Enumerates devices, prompting for permission if needed.
|
|
1589
|
+
*
|
|
1590
|
+
* Optional because it is a static on livekit-client's `Room`, and
|
|
1591
|
+
* `CallRoom` falls back to `navigator.mediaDevices` where it is
|
|
1592
|
+
* absent rather than losing the picker entirely.
|
|
1593
|
+
*/
|
|
1594
|
+
getLocalDevices?(kind?: string, requestPermissions?: boolean): Promise<CallDevice[]>;
|
|
1595
|
+
};
|
|
1555
1596
|
RoomEvent: Record<string, string>;
|
|
1556
1597
|
Track: {
|
|
1557
1598
|
Source: Record<string, string>;
|
|
@@ -1728,6 +1769,7 @@ declare class CallRoom {
|
|
|
1728
1769
|
private readonly participantListeners;
|
|
1729
1770
|
private readonly errorListeners;
|
|
1730
1771
|
private readonly aloneListeners;
|
|
1772
|
+
private readonly deviceListeners;
|
|
1731
1773
|
/** Bound once so `off()` in teardown removes the same references. */
|
|
1732
1774
|
private readonly onRoomChange;
|
|
1733
1775
|
/**
|
|
@@ -1796,6 +1838,30 @@ declare class CallRoom {
|
|
|
1796
1838
|
switchCamera(): Promise<void>;
|
|
1797
1839
|
/** Which camera the local video track is capturing from. */
|
|
1798
1840
|
getFacingMode(): CameraFacing;
|
|
1841
|
+
/**
|
|
1842
|
+
* Every device of a given kind that could carry this call.
|
|
1843
|
+
*
|
|
1844
|
+
* The web's equivalent of a phone's speaker button: a laptop has no
|
|
1845
|
+
* earpiece to switch to, but it does have three microphones and a
|
|
1846
|
+
* pair of headphones, and picking between them is the same job.
|
|
1847
|
+
*
|
|
1848
|
+
* Prefers livekit-client's own enumeration, which prompts for the
|
|
1849
|
+
* permission that makes labels visible, and falls back to the plain
|
|
1850
|
+
* browser API so a module without the static still lists something.
|
|
1851
|
+
*/
|
|
1852
|
+
listDevices(kind: CallDeviceKind): Promise<CallDevice[]>;
|
|
1853
|
+
/** Which device of `kind` the call is currently using. */
|
|
1854
|
+
getActiveDevice(kind: CallDeviceKind): string | undefined;
|
|
1855
|
+
/**
|
|
1856
|
+
* Move the call onto another device.
|
|
1857
|
+
*
|
|
1858
|
+
* `audiooutput` re-points playback through `setSinkId`, which some
|
|
1859
|
+
* browsers do not implement — hence the boolean rather than a throw.
|
|
1860
|
+
* A refusal is reported as an error and leaves the call where it was.
|
|
1861
|
+
*/
|
|
1862
|
+
setActiveDevice(kind: CallDeviceKind, deviceId: string): Promise<void>;
|
|
1863
|
+
/** Fires when devices are plugged in or removed. */
|
|
1864
|
+
onDevices(fn: () => void): Unsubscribe;
|
|
1799
1865
|
/** Mute or unmute the microphone. */
|
|
1800
1866
|
setMicrophoneEnabled(enabled: boolean): Promise<void>;
|
|
1801
1867
|
isCameraEnabled(): boolean;
|
|
@@ -1975,8 +2041,8 @@ declare class AuthError extends ApiError {
|
|
|
1975
2041
|
declare function isWebRtcAvailable(): boolean;
|
|
1976
2042
|
declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
|
|
1977
2043
|
|
|
1978
|
-
declare const version = "2.
|
|
2044
|
+
declare const version = "2.14.0";
|
|
1979
2045
|
|
|
1980
2046
|
declare function safeUuid(): string;
|
|
1981
2047
|
|
|
1982
|
-
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallEnded, type CallMedia, type CallParticipant, CallRoom, type CallRoomOptions, type CallRoomStatus, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
2048
|
+
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEnded, type CallMedia, type CallParticipant, CallRoom, type CallRoomOptions, type CallRoomStatus, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1481,6 +1481,28 @@ interface LiveKitPublication {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
/** Which camera a video track is capturing from. */
|
|
1483
1483
|
type CameraFacing = 'user' | 'environment';
|
|
1484
|
+
/**
|
|
1485
|
+
* A class of media device.
|
|
1486
|
+
*
|
|
1487
|
+
* Spelled out rather than reusing the DOM's `MediaDeviceKind` so the
|
|
1488
|
+
* type means the same thing on React Native, where there is no DOM but
|
|
1489
|
+
* `audiooutput` is still a real concept.
|
|
1490
|
+
*/
|
|
1491
|
+
type CallDeviceKind = 'videoinput' | 'audioinput' | 'audiooutput';
|
|
1492
|
+
/** A selectable input or output. */
|
|
1493
|
+
interface CallDevice {
|
|
1494
|
+
deviceId: string;
|
|
1495
|
+
kind: CallDeviceKind;
|
|
1496
|
+
/**
|
|
1497
|
+
* The browser's own label, e.g. "FaceTime HD Camera".
|
|
1498
|
+
*
|
|
1499
|
+
* Empty until the page holds a matching permission — the browser
|
|
1500
|
+
* withholds labels from sites that have never been granted the
|
|
1501
|
+
* device, precisely so they cannot be fingerprinted. In a call that
|
|
1502
|
+
* permission is already held, so labels are normally present.
|
|
1503
|
+
*/
|
|
1504
|
+
label: string;
|
|
1505
|
+
}
|
|
1484
1506
|
/** The slice of LiveKit's `LocalVideoTrack` used to flip the camera. */
|
|
1485
1507
|
interface LiveKitLocalVideoTrack {
|
|
1486
1508
|
restartTrack?(constraints?: {
|
|
@@ -1510,6 +1532,16 @@ interface LiveKitLocalParticipant extends LiveKitParticipant {
|
|
|
1510
1532
|
}
|
|
1511
1533
|
interface LiveKitRoomHandle {
|
|
1512
1534
|
localParticipant: LiveKitLocalParticipant;
|
|
1535
|
+
/**
|
|
1536
|
+
* Move every track of `kind` onto another device.
|
|
1537
|
+
*
|
|
1538
|
+
* `audiooutput` is the web's answer to a speakerphone button: it
|
|
1539
|
+
* re-points every incoming audio element with `setSinkId`. Not every
|
|
1540
|
+
* browser implements it, which is why the result is a boolean rather
|
|
1541
|
+
* than a throw.
|
|
1542
|
+
*/
|
|
1543
|
+
switchActiveDevice?(kind: string, deviceId: string, exact?: boolean): Promise<unknown>;
|
|
1544
|
+
getActiveDevice?(kind: string): string | undefined;
|
|
1513
1545
|
/** Keyed by identity. `remoteParticipants` is the v2 name. */
|
|
1514
1546
|
remoteParticipants: Map<string, LiveKitParticipant>;
|
|
1515
1547
|
connect(url: string, token: string, options?: unknown): Promise<void>;
|
|
@@ -1548,10 +1580,19 @@ interface LiveKitModule {
|
|
|
1548
1580
|
}
|
|
1549
1581
|
/** The precise shape, used internally once the module has been checked. */
|
|
1550
1582
|
interface CheckedLiveKitModule {
|
|
1551
|
-
Room: new (options?: {
|
|
1583
|
+
Room: (new (options?: {
|
|
1552
1584
|
adaptiveStream?: boolean;
|
|
1553
1585
|
dynacast?: boolean;
|
|
1554
|
-
}) => LiveKitRoomHandle
|
|
1586
|
+
}) => LiveKitRoomHandle) & {
|
|
1587
|
+
/**
|
|
1588
|
+
* Enumerates devices, prompting for permission if needed.
|
|
1589
|
+
*
|
|
1590
|
+
* Optional because it is a static on livekit-client's `Room`, and
|
|
1591
|
+
* `CallRoom` falls back to `navigator.mediaDevices` where it is
|
|
1592
|
+
* absent rather than losing the picker entirely.
|
|
1593
|
+
*/
|
|
1594
|
+
getLocalDevices?(kind?: string, requestPermissions?: boolean): Promise<CallDevice[]>;
|
|
1595
|
+
};
|
|
1555
1596
|
RoomEvent: Record<string, string>;
|
|
1556
1597
|
Track: {
|
|
1557
1598
|
Source: Record<string, string>;
|
|
@@ -1728,6 +1769,7 @@ declare class CallRoom {
|
|
|
1728
1769
|
private readonly participantListeners;
|
|
1729
1770
|
private readonly errorListeners;
|
|
1730
1771
|
private readonly aloneListeners;
|
|
1772
|
+
private readonly deviceListeners;
|
|
1731
1773
|
/** Bound once so `off()` in teardown removes the same references. */
|
|
1732
1774
|
private readonly onRoomChange;
|
|
1733
1775
|
/**
|
|
@@ -1796,6 +1838,30 @@ declare class CallRoom {
|
|
|
1796
1838
|
switchCamera(): Promise<void>;
|
|
1797
1839
|
/** Which camera the local video track is capturing from. */
|
|
1798
1840
|
getFacingMode(): CameraFacing;
|
|
1841
|
+
/**
|
|
1842
|
+
* Every device of a given kind that could carry this call.
|
|
1843
|
+
*
|
|
1844
|
+
* The web's equivalent of a phone's speaker button: a laptop has no
|
|
1845
|
+
* earpiece to switch to, but it does have three microphones and a
|
|
1846
|
+
* pair of headphones, and picking between them is the same job.
|
|
1847
|
+
*
|
|
1848
|
+
* Prefers livekit-client's own enumeration, which prompts for the
|
|
1849
|
+
* permission that makes labels visible, and falls back to the plain
|
|
1850
|
+
* browser API so a module without the static still lists something.
|
|
1851
|
+
*/
|
|
1852
|
+
listDevices(kind: CallDeviceKind): Promise<CallDevice[]>;
|
|
1853
|
+
/** Which device of `kind` the call is currently using. */
|
|
1854
|
+
getActiveDevice(kind: CallDeviceKind): string | undefined;
|
|
1855
|
+
/**
|
|
1856
|
+
* Move the call onto another device.
|
|
1857
|
+
*
|
|
1858
|
+
* `audiooutput` re-points playback through `setSinkId`, which some
|
|
1859
|
+
* browsers do not implement — hence the boolean rather than a throw.
|
|
1860
|
+
* A refusal is reported as an error and leaves the call where it was.
|
|
1861
|
+
*/
|
|
1862
|
+
setActiveDevice(kind: CallDeviceKind, deviceId: string): Promise<void>;
|
|
1863
|
+
/** Fires when devices are plugged in or removed. */
|
|
1864
|
+
onDevices(fn: () => void): Unsubscribe;
|
|
1799
1865
|
/** Mute or unmute the microphone. */
|
|
1800
1866
|
setMicrophoneEnabled(enabled: boolean): Promise<void>;
|
|
1801
1867
|
isCameraEnabled(): boolean;
|
|
@@ -1975,8 +2041,8 @@ declare class AuthError extends ApiError {
|
|
|
1975
2041
|
declare function isWebRtcAvailable(): boolean;
|
|
1976
2042
|
declare function createBrowserWebRtcAdapter(): WebRtcAdapter;
|
|
1977
2043
|
|
|
1978
|
-
declare const version = "2.
|
|
2044
|
+
declare const version = "2.14.0";
|
|
1979
2045
|
|
|
1980
2046
|
declare function safeUuid(): string;
|
|
1981
2047
|
|
|
1982
|
-
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallEnded, type CallMedia, type CallParticipant, CallRoom, type CallRoomOptions, type CallRoomStatus, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
2048
|
+
export { type AddMemberOptions, ApiError, type Attachment, type AttachmentDownloadResponse, AttachmentHandle, type AttachmentOptions, type AttachmentProgressEvent, type AttachmentStatus, type AttachmentUploadInput, type AttachmentUploadRequest, type AttachmentUploadResponse, AttachmentsResource, AuthError, type CallAccepted, type CallBusy, type CallCancelled, type CallConnection, type CallDeclined, type CallDevice, type CallDeviceKind, type CallEnded, type CallMedia, type CallParticipant, CallRoom, type CallRoomOptions, type CallRoomStatus, CallTokensResource, CallsResource, type CameraFacing, type CheckedLiveKitModule, type Conversation, ConversationChannel, type ConversationCreateRequest, type ConversationCreatedEvent, ConversationHandle, type ConversationList, ConversationMessages, type ConversationType, type ConversationUpdateRequest, type ConversationUpdatedEvent, ConversationsResource, type Device, type DeviceEnvironment, type DevicePlatform, DevicesResource, type ErrorEnvelope, type IceServerResponse, IceServersResource, type IncomingCall, type IsoDateTime, type LiveKitLocalVideoTrack, type LiveKitModule, type LiveKitParticipant, type LiveKitPublication, type LiveKitRoomHandle, type LiveKitTrack, type LiveKitTrackReference, type Me, MeResource, type MemberReadEvent, type MemberRole, type Membership, type MembershipCreateRequest, type MembershipList, type MentionEvent, type Message, type MessageCreateRequest, type MessageDeletedEvent, MessageHandle, type MessageList, type MessageNewEvent, type MessageType, type MessageUpdateRequest, type MessageUpdatedEvent, MessagesResource, NetworkError, type OutgoingCall, POOLSE_API_URL, Poolse, type PoolseConfig, PoolseError, PoolseRealtime, type PoolseUserProfile, type PresenceSnapshot, type QuotedMessagePreview, RateLimitedError, type ReactionEvent, type ReactionRequest, type ReadRequest, type RealtimeStatus, type RegisterDeviceRequest, type TypingEvent, type Unsubscribe$1 as Unsubscribe, UserChannel, UsersResource, type Uuid, type VoiceCandidate, type VoiceDescription, type VoiceIceServer, type VoiceParticipant, type VoicePeerConnection, VoiceRoom, type VoiceRoomOptions, type VoiceStatus, type VoiceStream, type VoiceTrack, type WebRtcAdapter, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
package/dist/index.js
CHANGED
|
@@ -1688,6 +1688,7 @@ var CallRoom = class {
|
|
|
1688
1688
|
participantListeners = /* @__PURE__ */ new Set();
|
|
1689
1689
|
errorListeners = /* @__PURE__ */ new Set();
|
|
1690
1690
|
aloneListeners = /* @__PURE__ */ new Set();
|
|
1691
|
+
deviceListeners = /* @__PURE__ */ new Set();
|
|
1691
1692
|
/** Bound once so `off()` in teardown removes the same references. */
|
|
1692
1693
|
onRoomChange = () => this.emitParticipants();
|
|
1693
1694
|
/**
|
|
@@ -1865,6 +1866,59 @@ var CallRoom = class {
|
|
|
1865
1866
|
getFacingMode() {
|
|
1866
1867
|
return this.facing;
|
|
1867
1868
|
}
|
|
1869
|
+
// ── device selection ────────────────────────────────────────────────
|
|
1870
|
+
/**
|
|
1871
|
+
* Every device of a given kind that could carry this call.
|
|
1872
|
+
*
|
|
1873
|
+
* The web's equivalent of a phone's speaker button: a laptop has no
|
|
1874
|
+
* earpiece to switch to, but it does have three microphones and a
|
|
1875
|
+
* pair of headphones, and picking between them is the same job.
|
|
1876
|
+
*
|
|
1877
|
+
* Prefers livekit-client's own enumeration, which prompts for the
|
|
1878
|
+
* permission that makes labels visible, and falls back to the plain
|
|
1879
|
+
* browser API so a module without the static still lists something.
|
|
1880
|
+
*/
|
|
1881
|
+
async listDevices(kind) {
|
|
1882
|
+
try {
|
|
1883
|
+
const fromLiveKit = await this.livekit.Room.getLocalDevices?.(kind, false);
|
|
1884
|
+
if (fromLiveKit) return fromLiveKit.map((d) => ({ ...d, kind }));
|
|
1885
|
+
} catch {
|
|
1886
|
+
}
|
|
1887
|
+
const media = globalThis.navigator?.mediaDevices;
|
|
1888
|
+
if (!media?.enumerateDevices) return [];
|
|
1889
|
+
try {
|
|
1890
|
+
const all = await media.enumerateDevices();
|
|
1891
|
+
return all.filter((d) => d.kind === kind).map((d) => ({ deviceId: d.deviceId, kind, label: d.label }));
|
|
1892
|
+
} catch {
|
|
1893
|
+
return [];
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
/** Which device of `kind` the call is currently using. */
|
|
1897
|
+
getActiveDevice(kind) {
|
|
1898
|
+
return this.room?.getActiveDevice?.(kind);
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Move the call onto another device.
|
|
1902
|
+
*
|
|
1903
|
+
* `audiooutput` re-points playback through `setSinkId`, which some
|
|
1904
|
+
* browsers do not implement — hence the boolean rather than a throw.
|
|
1905
|
+
* A refusal is reported as an error and leaves the call where it was.
|
|
1906
|
+
*/
|
|
1907
|
+
async setActiveDevice(kind, deviceId) {
|
|
1908
|
+
const room = this.room;
|
|
1909
|
+
if (!room?.switchActiveDevice) return;
|
|
1910
|
+
try {
|
|
1911
|
+
await room.switchActiveDevice(kind, deviceId);
|
|
1912
|
+
this.emitParticipants();
|
|
1913
|
+
} catch (err) {
|
|
1914
|
+
this.emitError(new Error(`could not switch ${kind}: ${String(err)}`));
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
/** Fires when devices are plugged in or removed. */
|
|
1918
|
+
onDevices(fn) {
|
|
1919
|
+
this.deviceListeners.add(fn);
|
|
1920
|
+
return () => this.deviceListeners.delete(fn);
|
|
1921
|
+
}
|
|
1868
1922
|
/** Mute or unmute the microphone. */
|
|
1869
1923
|
async setMicrophoneEnabled(enabled) {
|
|
1870
1924
|
await this.withLocal((local) => local.setMicrophoneEnabled(enabled), "microphone");
|
|
@@ -1910,6 +1964,12 @@ var CallRoom = class {
|
|
|
1910
1964
|
if (unsubscribed) {
|
|
1911
1965
|
room.on(unsubscribed, ((track) => this.stopAudio(track)));
|
|
1912
1966
|
}
|
|
1967
|
+
const devicesChanged = RoomEvent["MediaDevicesChanged"];
|
|
1968
|
+
if (devicesChanged) {
|
|
1969
|
+
room.on(devicesChanged, () => {
|
|
1970
|
+
for (const fn of this.deviceListeners) fn();
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1913
1973
|
const disconnected = RoomEvent["Disconnected"];
|
|
1914
1974
|
if (disconnected) {
|
|
1915
1975
|
room.on(disconnected, () => {
|
|
@@ -2364,7 +2424,7 @@ var Poolse = class {
|
|
|
2364
2424
|
};
|
|
2365
2425
|
|
|
2366
2426
|
// src/version.ts
|
|
2367
|
-
var version = "2.
|
|
2427
|
+
var version = "2.14.0";
|
|
2368
2428
|
|
|
2369
2429
|
export { ApiError, AttachmentHandle, AttachmentsResource, AuthError, CallRoom, CallTokensResource, CallsResource, ConversationChannel, ConversationHandle, ConversationMessages, ConversationsResource, DevicesResource, IceServersResource, MeResource, MessageHandle, MessagesResource, NetworkError, POOLSE_API_URL, Poolse, PoolseError, PoolseRealtime, RateLimitedError, UserChannel, UsersResource, VoiceRoom, createBrowserWebRtcAdapter, isWebRtcAvailable, safeUuid, version };
|
|
2370
2430
|
//# sourceMappingURL=index.js.map
|