@poolse/sdk 2.13.1 → 2.14.1
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 +26 -0
- package/dist/index.cjs +70 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -37
- package/dist/index.d.ts +79 -37
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ All notable changes to `@poolse/sdk` are documented here. Format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[semver](https://semver.org).
|
|
6
6
|
|
|
7
|
+
## [2.14.1] — 2026-08-23
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Device lists came back with no ids and no names.** `listDevices`
|
|
12
|
+
built its result by spreading each `MediaDeviceInfo`, but that is a
|
|
13
|
+
WebIDL interface whose `deviceId`, `kind` and `label` are accessors on
|
|
14
|
+
the _prototype_ — so `{ ...device }` produces `{}`. Every picker was a
|
|
15
|
+
list of blank, unselectable rows. Each field is now read explicitly.
|
|
16
|
+
- Entries with an empty `deviceId` are dropped. A browser returns that
|
|
17
|
+
placeholder for a device the page has not been granted, and offering
|
|
18
|
+
it gives the user a row that cannot be selected.
|
|
19
|
+
|
|
20
|
+
## [2.14.0] — 2026-08-23
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **`CallRoom.listDevices` / `getActiveDevice` / `setActiveDevice`** —
|
|
25
|
+
choose the camera, microphone or audio output a call runs on.
|
|
26
|
+
`audiooutput` is the web's speakerphone button: it re-points playback
|
|
27
|
+
through `setSinkId`. Not every browser implements that, so a refusal
|
|
28
|
+
surfaces as an error and leaves the call where it was.
|
|
29
|
+
- **`CallRoom.onDevices`** — fires when devices are plugged in or
|
|
30
|
+
removed, so a picker never offers a webcam that has been unplugged.
|
|
31
|
+
- **`CallDevice`** and **`CallDeviceKind`** types.
|
|
32
|
+
|
|
7
33
|
## [2.13.1] — 2026-08-23
|
|
8
34
|
|
|
9
35
|
Republished in lockstep with `@poolse/react-native@2.13.1`. No changes
|
package/dist/index.cjs
CHANGED
|
@@ -1660,6 +1660,16 @@ var CallTokensResource = class {
|
|
|
1660
1660
|
};
|
|
1661
1661
|
|
|
1662
1662
|
// src/voice/call-room.ts
|
|
1663
|
+
function toDevices(raw, kind) {
|
|
1664
|
+
const out = [];
|
|
1665
|
+
for (const device of raw) {
|
|
1666
|
+
if (device.kind && device.kind !== kind) continue;
|
|
1667
|
+
const deviceId = device.deviceId ?? "";
|
|
1668
|
+
if (!deviceId) continue;
|
|
1669
|
+
out.push({ deviceId, kind, label: device.label ?? "" });
|
|
1670
|
+
}
|
|
1671
|
+
return out;
|
|
1672
|
+
}
|
|
1663
1673
|
var CallRoom = class {
|
|
1664
1674
|
livekit;
|
|
1665
1675
|
tokenProvider;
|
|
@@ -1690,6 +1700,7 @@ var CallRoom = class {
|
|
|
1690
1700
|
participantListeners = /* @__PURE__ */ new Set();
|
|
1691
1701
|
errorListeners = /* @__PURE__ */ new Set();
|
|
1692
1702
|
aloneListeners = /* @__PURE__ */ new Set();
|
|
1703
|
+
deviceListeners = /* @__PURE__ */ new Set();
|
|
1693
1704
|
/** Bound once so `off()` in teardown removes the same references. */
|
|
1694
1705
|
onRoomChange = () => this.emitParticipants();
|
|
1695
1706
|
/**
|
|
@@ -1867,6 +1878,58 @@ var CallRoom = class {
|
|
|
1867
1878
|
getFacingMode() {
|
|
1868
1879
|
return this.facing;
|
|
1869
1880
|
}
|
|
1881
|
+
// ── device selection ────────────────────────────────────────────────
|
|
1882
|
+
/**
|
|
1883
|
+
* Every device of a given kind that could carry this call.
|
|
1884
|
+
*
|
|
1885
|
+
* The web's equivalent of a phone's speaker button: a laptop has no
|
|
1886
|
+
* earpiece to switch to, but it does have three microphones and a
|
|
1887
|
+
* pair of headphones, and picking between them is the same job.
|
|
1888
|
+
*
|
|
1889
|
+
* Prefers livekit-client's own enumeration, which prompts for the
|
|
1890
|
+
* permission that makes labels visible, and falls back to the plain
|
|
1891
|
+
* browser API so a module without the static still lists something.
|
|
1892
|
+
*/
|
|
1893
|
+
async listDevices(kind) {
|
|
1894
|
+
try {
|
|
1895
|
+
const fromLiveKit = await this.livekit.Room.getLocalDevices?.(kind, false);
|
|
1896
|
+
if (fromLiveKit?.length) return toDevices(fromLiveKit, kind);
|
|
1897
|
+
} catch {
|
|
1898
|
+
}
|
|
1899
|
+
const media = globalThis.navigator?.mediaDevices;
|
|
1900
|
+
if (!media?.enumerateDevices) return [];
|
|
1901
|
+
try {
|
|
1902
|
+
return toDevices(await media.enumerateDevices(), kind);
|
|
1903
|
+
} catch {
|
|
1904
|
+
return [];
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
/** Which device of `kind` the call is currently using. */
|
|
1908
|
+
getActiveDevice(kind) {
|
|
1909
|
+
return this.room?.getActiveDevice?.(kind);
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Move the call onto another device.
|
|
1913
|
+
*
|
|
1914
|
+
* `audiooutput` re-points playback through `setSinkId`, which some
|
|
1915
|
+
* browsers do not implement — hence the boolean rather than a throw.
|
|
1916
|
+
* A refusal is reported as an error and leaves the call where it was.
|
|
1917
|
+
*/
|
|
1918
|
+
async setActiveDevice(kind, deviceId) {
|
|
1919
|
+
const room = this.room;
|
|
1920
|
+
if (!room?.switchActiveDevice) return;
|
|
1921
|
+
try {
|
|
1922
|
+
await room.switchActiveDevice(kind, deviceId);
|
|
1923
|
+
this.emitParticipants();
|
|
1924
|
+
} catch (err) {
|
|
1925
|
+
this.emitError(new Error(`could not switch ${kind}: ${String(err)}`));
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
/** Fires when devices are plugged in or removed. */
|
|
1929
|
+
onDevices(fn) {
|
|
1930
|
+
this.deviceListeners.add(fn);
|
|
1931
|
+
return () => this.deviceListeners.delete(fn);
|
|
1932
|
+
}
|
|
1870
1933
|
/** Mute or unmute the microphone. */
|
|
1871
1934
|
async setMicrophoneEnabled(enabled) {
|
|
1872
1935
|
await this.withLocal((local) => local.setMicrophoneEnabled(enabled), "microphone");
|
|
@@ -1912,6 +1975,12 @@ var CallRoom = class {
|
|
|
1912
1975
|
if (unsubscribed) {
|
|
1913
1976
|
room.on(unsubscribed, ((track) => this.stopAudio(track)));
|
|
1914
1977
|
}
|
|
1978
|
+
const devicesChanged = RoomEvent["MediaDevicesChanged"];
|
|
1979
|
+
if (devicesChanged) {
|
|
1980
|
+
room.on(devicesChanged, () => {
|
|
1981
|
+
for (const fn of this.deviceListeners) fn();
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1915
1984
|
const disconnected = RoomEvent["Disconnected"];
|
|
1916
1985
|
if (disconnected) {
|
|
1917
1986
|
room.on(disconnected, () => {
|
|
@@ -2366,7 +2435,7 @@ var Poolse = class {
|
|
|
2366
2435
|
};
|
|
2367
2436
|
|
|
2368
2437
|
// src/version.ts
|
|
2369
|
-
var version = "2.
|
|
2438
|
+
var version = "2.14.1";
|
|
2370
2439
|
|
|
2371
2440
|
exports.ApiError = ApiError;
|
|
2372
2441
|
exports.AttachmentHandle = AttachmentHandle;
|