@poolse/sdk 2.13.1 → 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 +13 -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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ 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.0] — 2026-08-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`CallRoom.listDevices` / `getActiveDevice` / `setActiveDevice`** —
|
|
12
|
+
choose the camera, microphone or audio output a call runs on.
|
|
13
|
+
`audiooutput` is the web's speakerphone button: it re-points playback
|
|
14
|
+
through `setSinkId`. Not every browser implements that, so a refusal
|
|
15
|
+
surfaces as an error and leaves the call where it was.
|
|
16
|
+
- **`CallRoom.onDevices`** — fires when devices are plugged in or
|
|
17
|
+
removed, so a picker never offers a webcam that has been unplugged.
|
|
18
|
+
- **`CallDevice`** and **`CallDeviceKind`** types.
|
|
19
|
+
|
|
7
20
|
## [2.13.1] — 2026-08-23
|
|
8
21
|
|
|
9
22
|
Republished in lockstep with `@poolse/react-native@2.13.1`. No changes
|
package/dist/index.cjs
CHANGED
|
@@ -1690,6 +1690,7 @@ var CallRoom = class {
|
|
|
1690
1690
|
participantListeners = /* @__PURE__ */ new Set();
|
|
1691
1691
|
errorListeners = /* @__PURE__ */ new Set();
|
|
1692
1692
|
aloneListeners = /* @__PURE__ */ new Set();
|
|
1693
|
+
deviceListeners = /* @__PURE__ */ new Set();
|
|
1693
1694
|
/** Bound once so `off()` in teardown removes the same references. */
|
|
1694
1695
|
onRoomChange = () => this.emitParticipants();
|
|
1695
1696
|
/**
|
|
@@ -1867,6 +1868,59 @@ var CallRoom = class {
|
|
|
1867
1868
|
getFacingMode() {
|
|
1868
1869
|
return this.facing;
|
|
1869
1870
|
}
|
|
1871
|
+
// ── device selection ────────────────────────────────────────────────
|
|
1872
|
+
/**
|
|
1873
|
+
* Every device of a given kind that could carry this call.
|
|
1874
|
+
*
|
|
1875
|
+
* The web's equivalent of a phone's speaker button: a laptop has no
|
|
1876
|
+
* earpiece to switch to, but it does have three microphones and a
|
|
1877
|
+
* pair of headphones, and picking between them is the same job.
|
|
1878
|
+
*
|
|
1879
|
+
* Prefers livekit-client's own enumeration, which prompts for the
|
|
1880
|
+
* permission that makes labels visible, and falls back to the plain
|
|
1881
|
+
* browser API so a module without the static still lists something.
|
|
1882
|
+
*/
|
|
1883
|
+
async listDevices(kind) {
|
|
1884
|
+
try {
|
|
1885
|
+
const fromLiveKit = await this.livekit.Room.getLocalDevices?.(kind, false);
|
|
1886
|
+
if (fromLiveKit) return fromLiveKit.map((d) => ({ ...d, kind }));
|
|
1887
|
+
} catch {
|
|
1888
|
+
}
|
|
1889
|
+
const media = globalThis.navigator?.mediaDevices;
|
|
1890
|
+
if (!media?.enumerateDevices) return [];
|
|
1891
|
+
try {
|
|
1892
|
+
const all = await media.enumerateDevices();
|
|
1893
|
+
return all.filter((d) => d.kind === kind).map((d) => ({ deviceId: d.deviceId, kind, label: d.label }));
|
|
1894
|
+
} catch {
|
|
1895
|
+
return [];
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
/** Which device of `kind` the call is currently using. */
|
|
1899
|
+
getActiveDevice(kind) {
|
|
1900
|
+
return this.room?.getActiveDevice?.(kind);
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Move the call onto another device.
|
|
1904
|
+
*
|
|
1905
|
+
* `audiooutput` re-points playback through `setSinkId`, which some
|
|
1906
|
+
* browsers do not implement — hence the boolean rather than a throw.
|
|
1907
|
+
* A refusal is reported as an error and leaves the call where it was.
|
|
1908
|
+
*/
|
|
1909
|
+
async setActiveDevice(kind, deviceId) {
|
|
1910
|
+
const room = this.room;
|
|
1911
|
+
if (!room?.switchActiveDevice) return;
|
|
1912
|
+
try {
|
|
1913
|
+
await room.switchActiveDevice(kind, deviceId);
|
|
1914
|
+
this.emitParticipants();
|
|
1915
|
+
} catch (err) {
|
|
1916
|
+
this.emitError(new Error(`could not switch ${kind}: ${String(err)}`));
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
/** Fires when devices are plugged in or removed. */
|
|
1920
|
+
onDevices(fn) {
|
|
1921
|
+
this.deviceListeners.add(fn);
|
|
1922
|
+
return () => this.deviceListeners.delete(fn);
|
|
1923
|
+
}
|
|
1870
1924
|
/** Mute or unmute the microphone. */
|
|
1871
1925
|
async setMicrophoneEnabled(enabled) {
|
|
1872
1926
|
await this.withLocal((local) => local.setMicrophoneEnabled(enabled), "microphone");
|
|
@@ -1912,6 +1966,12 @@ var CallRoom = class {
|
|
|
1912
1966
|
if (unsubscribed) {
|
|
1913
1967
|
room.on(unsubscribed, ((track) => this.stopAudio(track)));
|
|
1914
1968
|
}
|
|
1969
|
+
const devicesChanged = RoomEvent["MediaDevicesChanged"];
|
|
1970
|
+
if (devicesChanged) {
|
|
1971
|
+
room.on(devicesChanged, () => {
|
|
1972
|
+
for (const fn of this.deviceListeners) fn();
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1915
1975
|
const disconnected = RoomEvent["Disconnected"];
|
|
1916
1976
|
if (disconnected) {
|
|
1917
1977
|
room.on(disconnected, () => {
|
|
@@ -2366,7 +2426,7 @@ var Poolse = class {
|
|
|
2366
2426
|
};
|
|
2367
2427
|
|
|
2368
2428
|
// src/version.ts
|
|
2369
|
-
var version = "2.
|
|
2429
|
+
var version = "2.14.0";
|
|
2370
2430
|
|
|
2371
2431
|
exports.ApiError = ApiError;
|
|
2372
2432
|
exports.AttachmentHandle = AttachmentHandle;
|