openvibers/openvibe.sdk Commits
Add ov.cam.settings and pin updated Cam kit (#158)
Changes
@@@ -1,5 +1,9 @@# Changelog++## 0.121.0 (2026-11-09)++++- ov.cam.settings.get/put: a person's saved camera choices (Cam #116)++## 0.120.0 (2026-11-09)- createUploadClient(): resumable Media uploads in 8 MiB parts, three at a time, with a session reference to resume; ov.ui.progress(el)@@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags> Supported browser and server clients for the OpenVibe platform.--**Status:** alpha, v0.120.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.++**Status:** alpha, v0.121.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.**Plan:** OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30.**License:** MIT ([LICENSE](LICENSE)). This package is a library that apps outside the network embed, so it uses MIT. The OpenVibe services themselves stay AGPL-3.0.@@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tagsAfter v0.97.1 is tagged:```bash--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.120.0++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.121.0```It has no runtime dependencies. It needs Node ≥ 20, or any browser with `fetch`, Web Crypto and `TextDecoder`. There is no build step. The package is CommonJS with ESM entry points (`import` works). Each subpath has its own `.d.ts`. For a page with no bundler, `browser/openvibe-sdk.mjs` is one self-contained ES module of the browser-safe subpaths (see [Browser without a bundler](#browser-without-a-bundler)). It does not depend on `openvibe-contracts` at runtime: it copies the contract types it uses (from the temporary Contracts sharing branch, a devDependency the tests check them against).@@@ -688,3 +688,8 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ developconst round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });await exchange.arena.vote(round.id, 'left');```++## Camera settings++++Camera choices can be read or saved on behalf of a signed-in person with `ov.cam.settings.get({ token })` and++`ov.cam.settings.put({ token, values: { facing, lens, mic, resolution, mirror } })`. Server callers should forward++the person's Network token; Cam keeps these preferences per person, and a missing device id is only a hint.@@@ -3,7 +3,7 @@"stage": "alpha","code": true,"wave": "W2",-- "version": "0.120.0",++ "version": "0.121.0","plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30","deployed": false,"deployment": "none: a package released as git tags; services and apps pin a tag",@@@ -1,4 +1,4 @@--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.120.0, MIT). Do not edit.++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.121.0, MIT). Do not edit.// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces// (auth, locker, registry, trust, modules, realtime, media, cam, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity./* eslint-disable */@@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);const semver = __load(6);/** The package version (test/version.test.js keeps it equal to package.json). */--const SDK_VERSION = '0.120.0';++const SDK_VERSION = '0.121.0';module.exports = {createClient,@@@ -3334,6 +3334,23 @@ function loadCamKit() {/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }++async function cameraSettings(token, method, body) {++ if (typeof token !== 'string' || !token) throw new TypeError('A person’s Network token is required.');++ const response = await fetch('https://openvibe.cam/api/v1/me/camera-settings', {++ method, headers: { Authorization: `Bearer ${token}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },++ ...(body ? { body: JSON.stringify(body) } : {}),++ });++ const data = await response.json();++ if (!response.ok) throw new Error(data.detail || 'Could not load camera settings');++ return data;++}++++/** Camera choices follow a signed-in person across sites. Server callers forward the person's token. */++const settings = Object.freeze({++ get: ({ token }) => cameraSettings(token, 'GET'),++ put: ({ token, values }) => cameraSettings(token, 'PUT', values),++});++/*** Inject the <ov-camera> embed once and resolve to the element class.* @param {{ src?: string }} [options]@@@ -3370,7 +3387,7 @@ function defineOvCamera(options = {}) {return load;}--module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };++module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open, settings };},// ── 28: src/media-upload.js ─────────────────────────────────────────function (module, exports) {@@@ -65,7 +65,8 @@"OV_CAMERA_SRC","defineOvCamera","loadCamKit",-- "open"++ "open",++ "settings"]},"chat": {@@@ -546,7 +547,13 @@"OV_CAMERA_SRC": "string","defineOvCamera": "function","loadCamKit": "function",-- "open": "function"++ "open": "function",++ "settings": {++ "object": [++ "get",++ "put"++ ]++ }},"openvibe-sdk/chat": {"createChatClient": "function",@@@ -3,5 +3,6 @@ import cjs from '../src/cam/index.js';export const {defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open,++ settings,} = cjs;export default cjs;@@@ -1,12 +1,12 @@{"name": "openvibe-sdk",-- "version": "0.120.0",++ "version": "0.121.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openvibe-sdk",-- "version": "0.120.0",++ "version": "0.121.0","license": "MIT","bin": {"openvibe-download": "bin/openvibe-download.js"@@@ -1,6 +1,6 @@{"name": "openvibe-sdk",-- "version": "0.120.0",++ "version": "0.121.0","description": "Supported browser and server clients for the OpenVibe platform: auth (incl. developer apps), registry discovery, identity, user modules, events, realtime, media, community, Bot robots, search, chat, AI runs, Tools (registry, run API and jobs), VIP memberships and developer projects, the async PostgreSQL data layer (db) and the Valkey cache, limits store, queue and pub/sub, with deadlines, safe retries, problem errors and trace propagation.","main": "index.js","types": "types/index.d.ts",@@@ -51,6 +51,23 @@ function loadCamKit() {/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }++async function cameraSettings(token, method, body) {++ if (typeof token !== 'string' || !token) throw new TypeError('A person’s Network token is required.');++ const response = await fetch('https://openvibe.cam/api/v1/me/camera-settings', {++ method, headers: { Authorization: `Bearer ${token}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },++ ...(body ? { body: JSON.stringify(body) } : {}),++ });++ const data = await response.json();++ if (!response.ok) throw new Error(data.detail || 'Could not load camera settings');++ return data;++}++++/** Camera choices follow a signed-in person across sites. Server callers forward the person's token. */++const settings = Object.freeze({++ get: ({ token }) => cameraSettings(token, 'GET'),++ put: ({ token, values }) => cameraSettings(token, 'PUT', values),++});++/*** Inject the <ov-camera> embed once and resolve to the element class.* @param {{ src?: string }} [options]@@@ -87,4 +104,4 @@ function defineOvCamera(options = {}) {return load;}--module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };++module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open, settings };@@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');const semver = require('./semver');/** The package version (test/version.test.js keeps it equal to package.json). */--const SDK_VERSION = '0.120.0';++const SDK_VERSION = '0.121.0';module.exports = {createClient,@@@ -14,8 +14,25 @@ const cam = require('../src/cam');const pkg = require('../package.json');run([++ ['camera settings use the person token and return saved choices', async () => {++ const original = global.fetch;++ const calls = [];++ global.fetch = async (url, options) => {++ calls.push({ url, options });++ return { ok: true, json: async () => ({ facing: 'user', lens: 'main', mic: 'default', resolution: '720', mirror: true, updated_at: null }) };++ };++ try {++ await cam.settings.get({ token: 'person-token' });++ await cam.settings.put({ token: 'person-token', values: { mirror: false } });++ assert.equal(calls[0].url, 'https://openvibe.cam/api/v1/me/camera-settings');++ assert.equal(calls[0].options.method, 'GET');++ assert.equal(calls[1].options.method, 'PUT');++ assert.equal(JSON.parse(calls[1].options.body).mirror, false);++ assert.equal(calls[1].options.headers.Authorization, 'Bearer person-token');++ } finally { global.fetch = original; }++ }],['the entry resolves by name and names the loader and the default script', async () => {-- assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open']);++ assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open', 'settings']);assert.equal(cam.OV_CAMERA_SRC, 'https://openvibe.cam/embed/ov-camera.js');assert.equal(cam.CAM_KIT_SRC, 'https://openvibe.cam/embed/cam-kit.js?v=yqqjh1FiP7a4');assert.match(cam.CAM_KIT_SRI, /^sha384-/);@@@ -72,7 +72,7 @@ run([})().catch((err) => { console.error(err); process.exit(1); });`;const res = execFileSync(process.execPath, ['-e', script], { cwd: app, encoding: 'utf8' });assert.match(res, new RegExp(`consumer ok: ${subpaths.length} subpaths \\+ the browser bundle`));-- assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.120.0); the wallet came in 0.119.0.++ assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.121.0); the wallet came in 0.119.0.assert.ok(!fs.existsSync(path.join(app, 'node_modules/openvibe-contracts')), 'the optional peer is not installed');} finally {fs.rmSync(tmp, { recursive: true, force: true });@@@ -10,6 +10,18 @@ export declare const OV_CAMERA_SRC: string;/** The pinned in-page recorder script and its SHA-384 integrity value. */export declare const CAM_KIT_SRC: string;export declare const CAM_KIT_SRI: string;++export interface CamSettings {++ facing: 'user' | 'environment';++ lens: string;++ mic: string;++ resolution: '480' | '720' | '1080';++ mirror: boolean;++ updated_at: string | null;++}++export declare const settings: {++ get(options: { token: string }): Promise<CamSettings>;++ put(options: { token: string; values: Partial<Omit<CamSettings, 'updated_at'>> }): Promise<CamSettings>;++};export type CamKitMode = 'video' | 'photo' | 'screen';export interface CamKitResult {
@@ -1,5 +1,9 @@
@@ -1,5 +1,9 @@
# Changelog
# Changelog
+## 0.121.0 (2026-11-09)
+
+- ov.cam.settings.get/put: a person's saved camera choices (Cam #116)
+
## 0.120.0 (2026-11-09)
## 0.120.0 (2026-11-09)
- createUploadClient(): resumable Media uploads in 8 MiB parts, three at a time, with a session reference to resume; ov.ui.progress(el)
- createUploadClient(): resumable Media uploads in 8 MiB parts, three at a time, with a session reference to resume; ov.ui.progress(el)
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -10,7 +10,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
> Supported browser and server clients for the OpenVibe platform.
> Supported browser and server clients for the OpenVibe platform.
-**Status:** alpha, v0.120.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
+**Status:** alpha, v0.121.0 (the five 1.0 core entries — `core`, `auth`, `events`, `db` and `media` — are frozen: their exported names change only with a major release; roadmap Wave 2; developer apps from Wave 20; Media objects v2 from Wave 4; the Tools platform API; Search, Chat, AI, Vision and consent clients; sign-in with recovery and a client health check). Every release is tagged (see [CHANGELOG.md](CHANGELOG.md)). Tested against local stub servers and the built-in mock platform only, never against the live platform. Services pin release tags; each repository's `STATUS.json` names the one it uses.
**Plan:** OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30.
**Plan:** OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30.
**License:** MIT ([LICENSE](LICENSE)). This package is a library that apps outside the network embed, so it uses MIT. The OpenVibe services themselves stay AGPL-3.0.
**License:** MIT ([LICENSE](LICENSE)). This package is a library that apps outside the network embed, so it uses MIT. The OpenVibe services themselves stay AGPL-3.0.
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
@@ -19,7 +19,7 @@ npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags
After v0.97.1 is tagged:
After v0.97.1 is tagged:
```bash
```bash
-npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.120.0
+npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.121.0
```
```
It has no runtime dependencies. It needs Node ≥ 20, or any browser with `fetch`, Web Crypto and `TextDecoder`. There is no build step. The package is CommonJS with ESM entry points (`import` works). Each subpath has its own `.d.ts`. For a page with no bundler, `browser/openvibe-sdk.mjs` is one self-contained ES module of the browser-safe subpaths (see [Browser without a bundler](#browser-without-a-bundler)). It does not depend on `openvibe-contracts` at runtime: it copies the contract types it uses (from the temporary Contracts sharing branch, a devDependency the tests check them against).
It has no runtime dependencies. It needs Node ≥ 20, or any browser with `fetch`, Web Crypto and `TextDecoder`. There is no build step. The package is CommonJS with ESM entry points (`import` works). Each subpath has its own `.d.ts`. For a page with no bundler, `browser/openvibe-sdk.mjs` is one self-contained ES module of the browser-safe subpaths (see [Browser without a bundler](#browser-without-a-bundler)). It does not depend on `openvibe-contracts` at runtime: it copies the contract types it uses (from the temporary Contracts sharing branch, a devDependency the tests check them against).
@@ -688,3 +688,8 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ develop
@@ -688,3 +688,8 @@ const exchange = require('openvibe-sdk/exchange').createExchangeClient({ develop
const round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });
const round = await exchange.arena.start({ prompt: 'Explain a binary search.', category: 'code', entries });
await exchange.arena.vote(round.id, 'left');
await exchange.arena.vote(round.id, 'left');
```
```
+## Camera settings
+
+Camera choices can be read or saved on behalf of a signed-in person with `ov.cam.settings.get({ token })` and
+`ov.cam.settings.put({ token, values: { facing, lens, mic, resolution, mirror } })`. Server callers should forward
+the person's Network token; Cam keeps these preferences per person, and a missing device id is only a hint.
@@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
"stage": "alpha",
"stage": "alpha",
"code": true,
"code": true,
"wave": "W2",
"wave": "W2",
- "version": "0.120.0",
+ "version": "0.121.0",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30",
"plan": "OpenVibe End-to-End Realignment & Implementation Plan, revision 3 (20 Sep 2026), §3.2; roadmap §30",
"deployed": false,
"deployed": false,
"deployment": "none: a package released as git tags; services and apps pin a tag",
"deployment": "none: a package released as git tags; services and apps pin a tag",
@@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
-// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.120.0, MIT). Do not edit.
+// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.121.0, MIT). Do not edit.
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// One self-contained ES module: core at the top level plus the browser-safe subpaths as namespaces
// (auth, locker, registry, trust, modules, realtime, media, cam, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
// (auth, locker, registry, trust, modules, realtime, media, cam, mediaUpload, ui, community, homeFeed, bot, search, bench, meme, vision, themes, design, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
/* eslint-disable */
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
@@ -56,7 +56,7 @@ const { paginate, offsetPager } = __load(7);
const semver = __load(6);
const semver = __load(6);
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.120.0';
+const SDK_VERSION = '0.121.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -3334,6 +3334,23 @@ function loadCamKit() {
@@ -3334,6 +3334,23 @@ function loadCamKit() {
/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */
/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */
function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }
function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }
+async function cameraSettings(token, method, body) {
+ if (typeof token !== 'string' || !token) throw new TypeError('A person’s Network token is required.');
+ const response = await fetch('https://openvibe.cam/api/v1/me/camera-settings', {
+ method, headers: { Authorization: `Bearer ${token}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },
+ ...(body ? { body: JSON.stringify(body) } : {}),
+ });
+ const data = await response.json();
+ if (!response.ok) throw new Error(data.detail || 'Could not load camera settings');
+ return data;
+}
+
+/** Camera choices follow a signed-in person across sites. Server callers forward the person's token. */
+const settings = Object.freeze({
+ get: ({ token }) => cameraSettings(token, 'GET'),
+ put: ({ token, values }) => cameraSettings(token, 'PUT', values),
+});
+
/**
/**
* Inject the <ov-camera> embed once and resolve to the element class.
* Inject the <ov-camera> embed once and resolve to the element class.
* @param {{ src?: string }} [options]
* @param {{ src?: string }} [options]
@@ -3370,7 +3387,7 @@ function defineOvCamera(options = {}) {
@@ -3370,7 +3387,7 @@ function defineOvCamera(options = {}) {
return load;
return load;
}
}
-module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };
+module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open, settings };
},
},
// ── 28: src/media-upload.js ─────────────────────────────────────────
// ── 28: src/media-upload.js ─────────────────────────────────────────
function (module, exports) {
function (module, exports) {
@@ -65,7 +65,8 @@
@@ -65,7 +65,8 @@
"OV_CAMERA_SRC",
"OV_CAMERA_SRC",
"defineOvCamera",
"defineOvCamera",
"loadCamKit",
"loadCamKit",
- "open"
+ "open",
+ "settings"
]
]
},
},
"chat": {
"chat": {
@@ -546,7 +547,13 @@
@@ -546,7 +547,13 @@
"OV_CAMERA_SRC": "string",
"OV_CAMERA_SRC": "string",
"defineOvCamera": "function",
"defineOvCamera": "function",
"loadCamKit": "function",
"loadCamKit": "function",
- "open": "function"
+ "open": "function",
+ "settings": {
+ "object": [
+ "get",
+ "put"
+ ]
+ }
},
},
"openvibe-sdk/chat": {
"openvibe-sdk/chat": {
"createChatClient": "function",
"createChatClient": "function",
@@ -3,5 +3,6 @@ import cjs from '../src/cam/index.js';
@@ -3,5 +3,6 @@ import cjs from '../src/cam/index.js';
export const {
export const {
defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open,
defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open,
+ settings,
} = cjs;
} = cjs;
export default cjs;
export default cjs;
@@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.120.0",
+ "version": "0.121.0",
"lockfileVersion": 3,
"lockfileVersion": 3,
"requires": true,
"requires": true,
"packages": {
"packages": {
"": {
"": {
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.120.0",
+ "version": "0.121.0",
"license": "MIT",
"license": "MIT",
"bin": {
"bin": {
"openvibe-download": "bin/openvibe-download.js"
"openvibe-download": "bin/openvibe-download.js"
@@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.120.0",
+ "version": "0.121.0",
"description": "Supported browser and server clients for the OpenVibe platform: auth (incl. developer apps), registry discovery, identity, user modules, events, realtime, media, community, Bot robots, search, chat, AI runs, Tools (registry, run API and jobs), VIP memberships and developer projects, the async PostgreSQL data layer (db) and the Valkey cache, limits store, queue and pub/sub, with deadlines, safe retries, problem errors and trace propagation.",
"description": "Supported browser and server clients for the OpenVibe platform: auth (incl. developer apps), registry discovery, identity, user modules, events, realtime, media, community, Bot robots, search, chat, AI runs, Tools (registry, run API and jobs), VIP memberships and developer projects, the async PostgreSQL data layer (db) and the Valkey cache, limits store, queue and pub/sub, with deadlines, safe retries, problem errors and trace propagation.",
"main": "index.js",
"main": "index.js",
"types": "types/index.d.ts",
"types": "types/index.d.ts",
@@ -51,6 +51,23 @@ function loadCamKit() {
@@ -51,6 +51,23 @@ function loadCamKit() {
/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */
/** Open Cam on this page. Resolves to a File and metadata after Use this, or null on cancel. */
function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }
function open(options = {}) { return loadCamKit().then((kit) => kit.open(options)); }
+async function cameraSettings(token, method, body) {
+ if (typeof token !== 'string' || !token) throw new TypeError('A person’s Network token is required.');
+ const response = await fetch('https://openvibe.cam/api/v1/me/camera-settings', {
+ method, headers: { Authorization: `Bearer ${token}`, ...(body ? { 'Content-Type': 'application/json' } : {}) },
+ ...(body ? { body: JSON.stringify(body) } : {}),
+ });
+ const data = await response.json();
+ if (!response.ok) throw new Error(data.detail || 'Could not load camera settings');
+ return data;
+}
+
+/** Camera choices follow a signed-in person across sites. Server callers forward the person's token. */
+const settings = Object.freeze({
+ get: ({ token }) => cameraSettings(token, 'GET'),
+ put: ({ token, values }) => cameraSettings(token, 'PUT', values),
+});
+
/**
/**
* Inject the <ov-camera> embed once and resolve to the element class.
* Inject the <ov-camera> embed once and resolve to the element class.
* @param {{ src?: string }} [options]
* @param {{ src?: string }} [options]
@@ -87,4 +104,4 @@ function defineOvCamera(options = {}) {
@@ -87,4 +104,4 @@ function defineOvCamera(options = {}) {
return load;
return load;
}
}
-module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };
+module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open, settings };
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
@@ -8,7 +8,7 @@ const { paginate, offsetPager } = require('./paginate');
const semver = require('./semver');
const semver = require('./semver');
/** The package version (test/version.test.js keeps it equal to package.json). */
/** The package version (test/version.test.js keeps it equal to package.json). */
-const SDK_VERSION = '0.120.0';
+const SDK_VERSION = '0.121.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -14,8 +14,25 @@ const cam = require('../src/cam');
@@ -14,8 +14,25 @@ const cam = require('../src/cam');
const pkg = require('../package.json');
const pkg = require('../package.json');
run([
run([
+ ['camera settings use the person token and return saved choices', async () => {
+ const original = global.fetch;
+ const calls = [];
+ global.fetch = async (url, options) => {
+ calls.push({ url, options });
+ return { ok: true, json: async () => ({ facing: 'user', lens: 'main', mic: 'default', resolution: '720', mirror: true, updated_at: null }) };
+ };
+ try {
+ await cam.settings.get({ token: 'person-token' });
+ await cam.settings.put({ token: 'person-token', values: { mirror: false } });
+ assert.equal(calls[0].url, 'https://openvibe.cam/api/v1/me/camera-settings');
+ assert.equal(calls[0].options.method, 'GET');
+ assert.equal(calls[1].options.method, 'PUT');
+ assert.equal(JSON.parse(calls[1].options.body).mirror, false);
+ assert.equal(calls[1].options.headers.Authorization, 'Bearer person-token');
+ } finally { global.fetch = original; }
+ }],
['the entry resolves by name and names the loader and the default script', async () => {
['the entry resolves by name and names the loader and the default script', async () => {
- assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open']);
+ assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open', 'settings']);
assert.equal(cam.OV_CAMERA_SRC, 'https://openvibe.cam/embed/ov-camera.js');
assert.equal(cam.OV_CAMERA_SRC, 'https://openvibe.cam/embed/ov-camera.js');
assert.equal(cam.CAM_KIT_SRC, 'https://openvibe.cam/embed/cam-kit.js?v=yqqjh1FiP7a4');
assert.equal(cam.CAM_KIT_SRC, 'https://openvibe.cam/embed/cam-kit.js?v=yqqjh1FiP7a4');
assert.match(cam.CAM_KIT_SRI, /^sha384-/);
assert.match(cam.CAM_KIT_SRI, /^sha384-/);
@@ -72,7 +72,7 @@ run([
@@ -72,7 +72,7 @@ run([
})().catch((err) => { console.error(err); process.exit(1); });`;
})().catch((err) => { console.error(err); process.exit(1); });`;
const res = execFileSync(process.execPath, ['-e', script], { cwd: app, encoding: 'utf8' });
const res = execFileSync(process.execPath, ['-e', script], { cwd: app, encoding: 'utf8' });
assert.match(res, new RegExp(`consumer ok: ${subpaths.length} subpaths \\+ the browser bundle`));
assert.match(res, new RegExp(`consumer ok: ${subpaths.length} subpaths \\+ the browser bundle`));
- assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.120.0); the wallet came in 0.119.0.
+ assert.equal(subpaths.length, 98); // Adds the upload client and the UI entry (0.121.0); the wallet came in 0.119.0.
assert.ok(!fs.existsSync(path.join(app, 'node_modules/openvibe-contracts')), 'the optional peer is not installed');
assert.ok(!fs.existsSync(path.join(app, 'node_modules/openvibe-contracts')), 'the optional peer is not installed');
} finally {
} finally {
fs.rmSync(tmp, { recursive: true, force: true });
fs.rmSync(tmp, { recursive: true, force: true });
@@ -10,6 +10,18 @@ export declare const OV_CAMERA_SRC: string;
@@ -10,6 +10,18 @@ export declare const OV_CAMERA_SRC: string;
/** The pinned in-page recorder script and its SHA-384 integrity value. */
/** The pinned in-page recorder script and its SHA-384 integrity value. */
export declare const CAM_KIT_SRC: string;
export declare const CAM_KIT_SRC: string;
export declare const CAM_KIT_SRI: string;
export declare const CAM_KIT_SRI: string;
+export interface CamSettings {
+ facing: 'user' | 'environment';
+ lens: string;
+ mic: string;
+ resolution: '480' | '720' | '1080';
+ mirror: boolean;
+ updated_at: string | null;
+}
+export declare const settings: {
+ get(options: { token: string }): Promise<CamSettings>;
+ put(options: { token: string; values: Partial<Omit<CamSettings, 'updated_at'>> }): Promise<CamSettings>;
+};
export type CamKitMode = 'video' | 'photo' | 'screen';
export type CamKitMode = 'video' | 'photo' | 'screen';
export interface CamKitResult {
export interface CamKitResult {