openvibers/openvibe.sdk Commits
Expose Cam recorder as ov.cam.open() (#150)
Changes
@@@ -1,5 +1,9 @@# Changelog++## 0.107.0 — 2026-11-09++++- Add `ov.cam.open()` for the Cam recorder, with typed modes, options and file results across Node and browser exports.++## 0.106.0 (2026-11-09)- Add `openvibe-sdk/home-feed` and `homeFeed` to the top-level and browser exports, with home layout, Today frame, and personal feed methods.@@@ -2,7 +2,7 @@> Supported browser and server clients for the OpenVibe platform.--**Status:** alpha, v0.106.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.107.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.@@@ -11,7 +11,7 @@After v0.97.1 is tagged:```bash--npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.106.0++npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.107.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).@@@ -493,6 +493,18 @@ Install the drivers the service uses: `pg` and `iovalkey` (production), `@electr### The OpenVibe camera element++The browser bundle also offers `ov.cam.open()` for video, photo or screen capture in place. It loads Cam's++SRI-pinned recorder once, then gives your page a `File` and metadata after the person reviews and chooses Use this:++++```js++import ov from 'openvibe-sdk';++const result = await ov.cam.open({ mode: 'video', maxSeconds: 60 });++if (result) await upload(result.file);++```++++Closing Cam resolves to `null`. The calling site owns the file and upload. `openvibe-sdk/cam` also exports++`open`, `loadCamKit`, `CAM_KIT_SRC` and `CAM_KIT_SRI` for direct use.++`openvibe-sdk/cam` loads the camera app's framework-free `<ov-camera>` element from OpenVibe.Cam and types itsattributes, events and methods. It injects the embed script once and resolves to the element class:@@@ -3,7 +3,7 @@"stage": "alpha","code": true,"wave": "W2",-- "version": "0.106.0",++ "version": "0.107.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",@@@ -14,6 +14,7 @@ module.exports = {modules: require('./src/modules'),realtime: require('./src/realtime'),media: require('./src/media'),++ cam: require('./src/cam'),community: require('./src/community'),homeFeed: require('./src/home-feed'),bot: require('./src/bot'),@@@ -1,6 +1,6 @@--// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.106.0, MIT). Do not edit.++// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.107.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, community, homeFeed, bot, search, bench, meme, vision, themes, 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, community, homeFeed, bot, search, bench, meme, vision, themes, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity./* eslint-disable */const __defs = [// ── 0: browser.js ──────────────────────────────────────────────────@@@ -21,22 +21,23 @@ module.exports = {modules: __load(22),realtime: __load(23),media: __load(24),-- community: __load(26),-- homeFeed: __load(27),-- bot: __load(28),-- search: __load(29),-- bench: __load(30),-- meme: __load(31),-- vision: __load(32),-- themes: __load(33),-- redact: __load(34),-- chat: __load(35),-- ai: __load(36),-- credentials: __load(37),-- jobs: __load(38),-- tools: __load(40),-- projects: __load(41),-- geo: __load(42),++ cam: __load(26),++ community: __load(27),++ homeFeed: __load(28),++ bot: __load(29),++ search: __load(30),++ bench: __load(31),++ meme: __load(32),++ vision: __load(33),++ themes: __load(34),++ redact: __load(35),++ chat: __load(36),++ ai: __load(37),++ credentials: __load(38),++ jobs: __load(39),++ tools: __load(41),++ projects: __load(42),++ geo: __load(43),};},// ── 1: src/core/index.js ───────────────────────────────────────────@@@ -51,7 +52,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.106.0';++const SDK_VERSION = '0.107.0';module.exports = {createClient,@@@ -3223,7 +3224,98 @@ function createObjectsClient({module.exports = { createObjectsClient };},--// ── 26: src/community.js ────────────────────────────────────────────++// ── 26: src/cam/index.js ────────────────────────────────────────────++function (module, exports) {++'use strict';++/**++ * openvibe-sdk/cam: the OpenVibe camera element, from https://openvibe.cam/embed/ov-camera.js.++ *++ * In an app: import { defineOvCamera } from the package's cam entry.++ * await defineOvCamera();++ * const camera = document.querySelector('ov-camera');++ * camera.addEventListener('ov-camera:capture', (event) => upload(event.detail.blob));++ *++ * The embed itself is OpenVibe.Cam's framework-free custom element. This loader only injects one++ * <script> per origin (the page may already include it) and resolves to the class once the browser++ * has defined it. Nothing here touches the camera: the element starts only from a click or an++ * explicit start(), and its default upload="off" means a capture never leaves the page.++ *++ * <ov-camera facing="user" filters="none,mono,warm" timer="3" mode="photo" upload="off"></ov-camera>++ *++ * Browser-only by nature; in Node the call rejects and the module still loads (the types and the++ * pack test import it). Pass `src` to self-host the same element file.++ */++const OV_CAMERA_SRC = 'https://openvibe.cam/embed/ov-camera.js';++const CAM_KIT_SRC = 'https://openvibe.cam/embed/cam-kit.js';++const CAM_KIT_SRI = 'sha384-kD5WfySp7D3rNJliBpLgJRrl4Geks+4EcgSaCIBGX+dZdecjmUVxEjzbcUw2Spp7';++++// One promise per src: a second call while the script is in flight gets the same load, never a second tag.++const pending = new Map();++let kitPending = null;++++/** Load Cam's in-page recorder once. The pinned script gives the calling site a File. */++function loadCamKit() {++ if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.reject(new Error('openvibe-sdk/cam: open() needs a browser.'));++ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') return Promise.resolve(window.OpenVibeCam);++ if (kitPending) return kitPending;++ kitPending = new Promise((resolve, reject) => {++ const script = document.createElement('script');++ script.src = CAM_KIT_SRC;++ script.integrity = CAM_KIT_SRI;++ script.crossOrigin = 'anonymous';++ script.async = true;++ script.addEventListener('load', () => {++ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') resolve(window.OpenVibeCam);++ else reject(new Error('openvibe-sdk/cam: Cam kit loaded without OpenVibeCam.open().'));++ });++ script.addEventListener('error', () => { script.remove(); reject(new Error('openvibe-sdk/cam: could not load the Cam kit.')); });++ (document.head || document.documentElement).appendChild(script);++ }).finally(() => { kitPending = null; });++ return kitPending;++}++++/** 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)); }++++/**++ * Inject the <ov-camera> embed once and resolve to the element class.++ * @param {{ src?: string }} [options]++ * @returns {Promise<CustomElementConstructor>}++ */++function defineOvCamera(options = {}) {++ const src = String((options && options.src) || OV_CAMERA_SRC);++ if (typeof window === 'undefined' || typeof document === 'undefined') {++ return Promise.reject(new Error('openvibe-sdk/cam: defineOvCamera() needs a browser with custom elements.'));++ }++ const defined = () => (window.customElements ? window.customElements.get('ov-camera') : undefined);++ const already = defined();++ if (already) return Promise.resolve(already);++ if (pending.has(src)) return pending.get(src);++++ const load = new Promise((resolve, reject) => {++ const script = document.createElement('script');++ script.src = src;++ script.async = true;++ script.dataset.ovCamera = '';++ script.addEventListener('load', () => {++ const ctor = defined();++ if (ctor) resolve(ctor);++ else reject(new Error(`openvibe-sdk/cam: ${src} loaded but did not define <ov-camera>.`));++ });++ script.addEventListener('error', () => {++ script.remove();++ reject(new Error(`openvibe-sdk/cam: could not load ${src}`));++ });++ (document.head || document.documentElement).appendChild(script);++ }).finally(() => pending.delete(src));++++ pending.set(src, load);++ return load;++}++++module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };++},++// ── 27: src/community.js ────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -3342,7 +3434,7 @@ function createCommunityClient(client, defaults = {}) {module.exports = { createCommunityClient, actingHeaders };},--// ── 27: src/home-feed.js ────────────────────────────────────────────++// ── 28: src/home-feed.js ────────────────────────────────────────────function (module, exports) {'use strict';/** The menu's portable Home layout, network day counts and personal wall. Pass a user-token core client;@@@ -3369,7 +3461,7 @@ function createHomeFeedClient(client, { networkBaseUrl, communityBaseUrl } = {})module.exports = { createHomeFeedClient };},--// ── 28: src/bot.js ──────────────────────────────────────────────────++// ── 29: src/bot.js ──────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -3591,7 +3683,7 @@ function createBotClient(client, defaults = {}) {module.exports = { createBotClient, actingHeaders };},--// ── 29: src/search.js ───────────────────────────────────────────────++// ── 30: src/search.js ───────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -3704,7 +3796,7 @@ function createSearchClient(client, defaults = {}) {module.exports = { createSearchClient, queryOf, fabricOf };},--// ── 30: src/bench.js ────────────────────────────────────────────────++// ── 31: src/bench.js ────────────────────────────────────────────────function (module, exports) {'use strict';/** openvibe-sdk/bench: OpenVibe.Bench's JSON API and streamed open dataset. Browser-safe. */@@@ -3805,7 +3897,7 @@ function createBenchClient(client, defaults = {}) {module.exports = { createBenchClient };},--// ── 31: src/meme.js ─────────────────────────────────────────────────++// ── 32: src/meme.js ─────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -3873,7 +3965,7 @@ function createMemeClient(client, defaults = {}) {module.exports = { createMemeClient };},--// ── 32: src/vision.js ───────────────────────────────────────────────++// ── 33: src/vision.js ───────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4031,7 +4123,7 @@ function pick(o, keys) {module.exports = { createVisionClient, DEFAULT_AUDIENCE };},--// ── 33: src/themes.js ───────────────────────────────────────────────++// ── 34: src/themes.js ───────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4181,7 +4273,7 @@ function followTheme(fn, opts = {}) {module.exports = { createThemesClient, followTheme, readTheme, applyTheme, seasonOn, onColor, DISPLAY_OPTIONS, TOKENS };},--// ── 34: src/redact.js ───────────────────────────────────────────────++// ── 35: src/redact.js ───────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4428,7 +4520,7 @@ function onlySecret(text) {module.exports = { redact, onlySecret };},--// ── 35: src/chat.js ─────────────────────────────────────────────────++// ── 36: src/chat.js ─────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4670,7 +4762,7 @@ function createFeedPublisher(client, { feed, key, baseUrl } = {}) {module.exports = { createChatClient, createInboxVisitor, createFeedPublisher };},--// ── 36: src/ai.js ───────────────────────────────────────────────────++// ── 37: src/ai.js ───────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4802,7 +4894,7 @@ function createAiClient(client, defaults = {}) {module.exports = { createAiClient, TERMINAL, OPS, CLASSES };},--// ── 37: src/credentials.js ──────────────────────────────────────────++// ── 38: src/credentials.js ──────────────────────────────────────────function (module, exports) {'use strict';@@@ -4820,7 +4912,7 @@ function createCredentialsClient(client, defaults = {}) {module.exports = { createCredentialsClient };},--// ── 38: src/jobs.js ─────────────────────────────────────────────────++// ── 39: src/jobs.js ─────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -4858,7 +4950,7 @@ function (module, exports) {*/const { OpenVibeError, isOpenVibeError } = __load(3);const { newIdempotencyKey } = __load(5);--const { appendFiles } = __load(39);++const { appendFiles } = __load(40);const { parseSSE } = __load(23);const TERMINAL = new Set(['succeeded', 'failed', 'cancelled']);@@@ -5022,7 +5114,7 @@ function createJobsClient(client, { baseUrl, service = 'tools', audience = 'openmodule.exports = { createJobsClient, isTerminal, TERMINAL_STATES: [...TERMINAL] };},--// ── 39: src/core/form.js ────────────────────────────────────────────++// ── 40: src/core/form.js ────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -5056,7 +5148,7 @@ function appendFiles(form, list, where) {module.exports = { isBlob, isUpload, appendFiles };},--// ── 40: src/tools.js ────────────────────────────────────────────────++// ── 41: src/tools.js ────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -5090,8 +5182,8 @@ function (module, exports) {*/const { OpenVibeError, isOpenVibeError } = __load(3);const { newIdempotencyKey } = __load(5);--const { isUpload, appendFiles } = __load(39);--const { createJobsClient } = __load(38);++const { isUpload, appendFiles } = __load(40);++const { createJobsClient } = __load(39);const enc = encodeURIComponent;const ID_RE = /^[a-z][a-z0-9-]{0,39}$/;@@@ -5341,7 +5433,7 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'opemodule.exports = { createToolsClient, ToolRunError, isToolRunError };},--// ── 41: src/projects.js ─────────────────────────────────────────────++// ── 42: src/projects.js ─────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -5457,7 +5549,7 @@ function createProjectsClient(client, { baseUrl } = {}) {module.exports = { createProjectsClient };},--// ── 42: src/geo.js ──────────────────────────────────────────────────++// ── 43: src/geo.js ──────────────────────────────────────────────────function (module, exports) {'use strict';/**@@@ -5537,8 +5629,8 @@ export const {startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, auth,locker, registry, trust, modules, realtime, media,-- community, homeFeed, bot, search, bench, meme,-- vision, themes, redact, chat, ai, credentials,-- jobs, tools, projects, geo,++ cam, community, homeFeed, bot, search, bench,++ meme, vision, themes, redact, chat, ai,++ credentials, jobs, tools, projects, geo,} = sdk;export default sdk;@@@ -58,6 +58,16 @@"createBotClient"]},++ "cam": {++ "object": [++ "CAM_KIT_SRC",++ "CAM_KIT_SRI",++ "OV_CAMERA_SRC",++ "defineOvCamera",++ "loadCamKit",++ "open"++ ]++ },"chat": {"object": ["createChatClient",@@@ -507,8 +517,12 @@"createCache": "function"},"openvibe-sdk/cam": {++ "CAM_KIT_SRC": "string",++ "CAM_KIT_SRI": "string","OV_CAMERA_SRC": "string",-- "defineOvCamera": "function"++ "defineOvCamera": "function",++ "loadCamKit": "function",++ "open": "function"},"openvibe-sdk/chat": {"createChatClient": "function",@@@ -2,6 +2,6 @@import cjs from '../src/cam/index.js';export const {-- defineOvCamera, OV_CAMERA_SRC,++ defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open,} = cjs;export default cjs;@@@ -6,13 +6,14 @@ export const {startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, report,share, locker, auth, registry, identity, trust,-- modules, events, realtime, media, community, homeFeed,-- bot, search, bench, meme, vision, themes,-- redact, chat, chatApps, ai, credentials, jobs,-- tools, projects, resources, vip, quest, live,-- inventory, tips, blog, reviews, wiki, coupons,-- deals, trade, space, host, news, food,-- actor, run, video, work, zone, play,-- download, openre, geo, usage, commerce, telemetry,++ modules, events, realtime, media, cam, community,++ homeFeed, bot, search, bench, meme, vision,++ themes, redact, chat, chatApps, ai, credentials,++ jobs, tools, projects, resources, vip, quest,++ live, inventory, tips, blog, reviews, wiki,++ coupons, deals, trade, space, host, news,++ food, actor, run, video, work, zone,++ play, download, openre, geo, usage, commerce,++ telemetry,} = cjs;export default cjs;@@@ -19,6 +19,7 @@ module.exports = {events: require('./src/events'),realtime: require('./src/realtime'),media: require('./src/media'),++ cam: require('./src/cam'),community: require('./src/community'),homeFeed: require('./src/home-feed'),bot: require('./src/bot'),@@@ -1,12 +1,12 @@{"name": "openvibe-sdk",-- "version": "0.106.0",++ "version": "0.107.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openvibe-sdk",-- "version": "0.106.0",++ "version": "0.107.0","license": "MIT","bin": {"openvibe-download": "bin/openvibe-download.js"@@@ -1,6 +1,6 @@{"name": "openvibe-sdk",-- "version": "0.106.0",++ "version": "0.107.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",@@@ -18,9 +18,36 @@* pack test import it). Pass `src` to self-host the same element file.*/const OV_CAMERA_SRC = 'https://openvibe.cam/embed/ov-camera.js';++const CAM_KIT_SRC = 'https://openvibe.cam/embed/cam-kit.js';++const CAM_KIT_SRI = 'sha384-kD5WfySp7D3rNJliBpLgJRrl4Geks+4EcgSaCIBGX+dZdecjmUVxEjzbcUw2Spp7';// One promise per src: a second call while the script is in flight gets the same load, never a second tag.const pending = new Map();++let kitPending = null;++++/** Load Cam's in-page recorder once. The pinned script gives the calling site a File. */++function loadCamKit() {++ if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.reject(new Error('openvibe-sdk/cam: open() needs a browser.'));++ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') return Promise.resolve(window.OpenVibeCam);++ if (kitPending) return kitPending;++ kitPending = new Promise((resolve, reject) => {++ const script = document.createElement('script');++ script.src = CAM_KIT_SRC;++ script.integrity = CAM_KIT_SRI;++ script.crossOrigin = 'anonymous';++ script.async = true;++ script.addEventListener('load', () => {++ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') resolve(window.OpenVibeCam);++ else reject(new Error('openvibe-sdk/cam: Cam kit loaded without OpenVibeCam.open().'));++ });++ script.addEventListener('error', () => { script.remove(); reject(new Error('openvibe-sdk/cam: could not load the Cam kit.')); });++ (document.head || document.documentElement).appendChild(script);++ }).finally(() => { kitPending = null; });++ return kitPending;++}++++/** 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)); }/*** Inject the <ov-camera> embed once and resolve to the element class.@@@ -58,4 +85,4 @@ function defineOvCamera(options = {}) {return load;}--module.exports = { defineOvCamera, OV_CAMERA_SRC };++module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };@@@ -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.106.0';++const SDK_VERSION = '0.107.0';module.exports = {createClient,@@@ -97,5 +97,7 @@ run([['server entries really are server-only (sanity)', async () => {assert.match(fs.readFileSync(path.join(ROOT, 'src/auth/tokens.js'), 'utf8'), /client_secret/);assert.equal(browserTarget(pkg.exports['./auth']), './src/auth/browser.js');++ assert.equal(typeof require('../browser').cam.open, 'function', 'the browser entry exposes ov.cam.open');++ assert.match(fs.readFileSync(path.join(ROOT, 'esm/index.mjs'), 'utf8'), /\bcam\b/, 'the ESM root exports cam');}],]);@@@ -15,8 +15,10 @@ const pkg = require('../package.json');run([['the entry resolves by name and names the loader and the default script', async () => {-- assert.deepEqual(Object.keys(cam).sort(), ['OV_CAMERA_SRC', 'defineOvCamera']);++ assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open']);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');++ assert.match(cam.CAM_KIT_SRI, /^sha384-/);assert.equal(require('openvibe-sdk/cam'), cam);assert.deepEqual(pkg.exports['./cam'], {types: './types/cam.d.ts',@@@ -27,12 +29,41 @@ run([assert.equal(esm.default, cam);assert.equal(esm.OV_CAMERA_SRC, cam.OV_CAMERA_SRC);assert.equal(typeof esm.defineOvCamera, 'function');++ assert.equal(typeof esm.open, 'function');}],['in Node it rejects instead of touching a document', async () => {assert.equal(typeof global.window, 'undefined');await assert.rejects(cam.defineOvCamera(), /needs a browser/);await assert.rejects(cam.defineOvCamera({ src: 'https://example.test/ov-camera.js' }), /needs a browser/);++ await assert.rejects(cam.open({ mode: 'video' }), /needs a browser/);++ }],++++ ['the recorder loader pins one script and forwards the result', async () => {++ const oldWindow = global.window;++ const oldDocument = global.document;++ const tags = [];++ let kit = null;++ global.window = {};++ global.document = { createElement: () => {++ const listeners = {};++ return { addEventListener: (name, fn) => { listeners[name] = fn; }, remove() {}, listeners };++ }, head: { appendChild: (tag) => {++ tags.push(tag);++ kit = { open: async (options) => ({ mode: options.mode, file: { name: 'clip.webm' } }) };++ global.window.OpenVibeCam = kit;++ queueMicrotask(() => tag.listeners.load());++ } } };++ try {++ const [a, b] = await Promise.all([cam.open({ mode: 'video' }), cam.open({ mode: 'photo' })]);++ assert.equal(tags.length, 1);++ assert.equal(tags[0].src, cam.CAM_KIT_SRC);++ assert.equal(tags[0].integrity, cam.CAM_KIT_SRI);++ assert.equal(tags[0].crossOrigin, 'anonymous');++ assert.equal(a.mode, 'video');++ assert.equal(b.mode, 'photo');++ assert.equal(await cam.loadCamKit(), kit);++ } finally { if (oldWindow === undefined) delete global.window; else global.window = oldWindow; if (oldDocument === undefined) delete global.document; else global.document = oldDocument; }}],['a browser gets one <script> per load and the class; a defined element resolves without another', async () => {@@@ -86,7 +117,7 @@ run([['the types file names the runtime exports and the element surface', async () => {const dts = fs.readFileSync(path.join(ROOT, 'types/cam.d.ts'), 'utf8');for (const name of [-- 'OV_CAMERA_SRC', 'defineOvCamera', 'DefineOvCameraOptions',++ 'OV_CAMERA_SRC', 'defineOvCamera', 'DefineOvCameraOptions', 'CAM_KIT_SRC', 'CAM_KIT_SRI', 'CamKitResult', 'CamKitOptions', 'loadCamKit', 'open(options?','OvCameraAttributes', 'OvCameraFacing', 'OvCameraFilter', 'OvCameraTimer', 'OvCameraMode', 'OvCameraUpload','OvCameraElement', 'OvCameraCaptureDetail', 'OvCameraErrorCode', 'OvCameraErrorDetail','OvCameraCaptureEvent', 'OvCameraErrorEvent', 'OvCameraEventMap', 'HTMLElementTagNameMap',@@@ -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, 93); // Adds the home and feed client (0.106.0); 92 had the Report AI comparison client.++ assert.equal(subpaths.length, 93); // Cam recorder methods extend the existing cam subpath (0.107.0); the 93-subpath count is unchanged.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 });@@@ -19,8 +19,15 @@ run([const lock = require('../package-lock.json');assert.equal(lock.version, pkg.version);assert.equal(lock.packages[''].version, pkg.version);-- assert.match(fs.readFileSync(path.join(ROOT, 'CHANGELOG.md'), 'utf8'), new RegExp(`^## ${pkg.version.replace(/\./g, '\\.')} \\(`, 'm'));++ const changelog = fs.readFileSync(path.join(ROOT, 'CHANGELOG.md'), 'utf8');++ const versionPattern = pkg.version.replace(/\./g, '\\.');++ assert.match(changelog, new RegExp(`^## ${versionPattern} (?:\\(|— )`, 'm'));assert.match(fs.readFileSync(path.join(ROOT, 'browser/openvibe-sdk.mjs'), 'utf8'), new RegExp(`openvibe-sdk ${pkg.version.replace(/\./g, '\\.')},`));++ const browserBundle = await import('../browser/openvibe-sdk.mjs');++ assert.equal(browserBundle.default.SDK_VERSION, pkg.version);++ assert.equal(typeof browserBundle.default.cam.open, 'function');++ const camEsm = await import('../esm/cam.mjs');++ assert.equal(typeof camEsm.open, 'function');}],['the README installs and names this release (it said v0.35.2 and v0.37.0 at 0.51.1)', async () => {@@@ -4,6 +4,7 @@ import * as registry from './registry';import * as modules from './modules';import * as realtime from './realtime';import * as media from './media';++import * as cam from './cam';import * as community from './community';import * as homeFeed from './home-feed';import * as bot from './bot';@@@ -30,6 +31,7 @@ export * as registry from './registry';export * as modules from './modules';export * as realtime from './realtime';export * as media from './media';++export * as cam from './cam';export * as community from './community';export * as homeFeed from './home-feed';export * as bot from './bot';@@@ -51,6 +53,6 @@ export * as trust from './trust';declare const sdk: typeof core & {auth: typeof auth; registry: typeof registry; modules: typeof modules; realtime: typeof realtime;-- media: typeof media; community: typeof community; homeFeed: typeof homeFeed; bot: typeof bot; search: typeof search; bench: typeof bench; meme: typeof meme; vision: typeof vision; themes: typeof themes; redact: typeof redact; chat: typeof chat; ai: typeof ai; credentials: typeof credentials; jobs: typeof jobs; tools: typeof tools; projects: typeof projects; geo: typeof geo; locker: typeof locker; trust: typeof trust;++ media: typeof media; cam: typeof cam; community: typeof community; homeFeed: typeof homeFeed; bot: typeof bot; search: typeof search; bench: typeof bench; meme: typeof meme; vision: typeof vision; themes: typeof themes; redact: typeof redact; chat: typeof chat; ai: typeof ai; credentials: typeof credentials; jobs: typeof jobs; tools: typeof tools; projects: typeof projects; geo: typeof geo; locker: typeof locker; trust: typeof trust;};export default sdk;@@@ -7,6 +7,30 @@/** The embed script the loader injects when no `src` is given. */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 type CamKitMode = 'video' | 'photo' | 'screen';++export interface CamKitResult {++ file: File;++ mode: CamKitMode;++ mimeType: string;++ duration: number;++ width: number;++ height: number;++ maxSeconds: number;++}++export interface CamKitOptions {++ mode?: CamKitMode;++ maxSeconds?: number;++ timer?: 0 | 3 | 10;++ onDone?: (result: CamKitResult) => void | Promise<void>;++}++/** Load OpenVibeCam once and return its browser API. */++export declare function loadCamKit(): Promise<{ open(options?: CamKitOptions): Promise<CamKitResult | null> }>;++/** Open Cam on this page and return a file after Use this; cancellation resolves to null. */++export declare function open(options?: CamKitOptions): Promise<CamKitResult | null>;/** The front camera (`user`) or the back camera (`environment`). */export type OvCameraFacing = 'user' | 'environment';@@@ -9,6 +9,7 @@ export * as modules from './modules';export * as events from './events';export * as realtime from './realtime';export * as media from './media';++export * as cam from './cam';export * as community from './community';export * as homeFeed from './home-feed';export * as bot from './bot';
@@ -1,5 +1,9 @@
@@ -1,5 +1,9 @@
# Changelog
# Changelog
+## 0.107.0 — 2026-11-09
+
+- Add `ov.cam.open()` for the Cam recorder, with typed modes, options and file results across Node and browser exports.
+
## 0.106.0 (2026-11-09)
## 0.106.0 (2026-11-09)
- Add `openvibe-sdk/home-feed` and `homeFeed` to the top-level and browser exports, with home layout, Today frame, and personal feed methods.
- Add `openvibe-sdk/home-feed` and `homeFeed` to the top-level and browser exports, with home layout, Today frame, and personal feed methods.
@@ -2,7 +2,7 @@
@@ -2,7 +2,7 @@
> Supported browser and server clients for the OpenVibe platform.
> Supported browser and server clients for the OpenVibe platform.
-**Status:** alpha, v0.106.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.107.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.
@@ -11,7 +11,7 @@
@@ -11,7 +11,7 @@
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.106.0
+npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.107.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).
@@ -493,6 +493,18 @@ Install the drivers the service uses: `pg` and `iovalkey` (production), `@electr
@@ -493,6 +493,18 @@ Install the drivers the service uses: `pg` and `iovalkey` (production), `@electr
### The OpenVibe camera element
### The OpenVibe camera element
+The browser bundle also offers `ov.cam.open()` for video, photo or screen capture in place. It loads Cam's
+SRI-pinned recorder once, then gives your page a `File` and metadata after the person reviews and chooses Use this:
+
+```js
+import ov from 'openvibe-sdk';
+const result = await ov.cam.open({ mode: 'video', maxSeconds: 60 });
+if (result) await upload(result.file);
+```
+
+Closing Cam resolves to `null`. The calling site owns the file and upload. `openvibe-sdk/cam` also exports
+`open`, `loadCamKit`, `CAM_KIT_SRC` and `CAM_KIT_SRI` for direct use.
+
`openvibe-sdk/cam` loads the camera app's framework-free `<ov-camera>` element from OpenVibe.Cam and types its
`openvibe-sdk/cam` loads the camera app's framework-free `<ov-camera>` element from OpenVibe.Cam and types its
attributes, events and methods. It injects the embed script once and resolves to the element class:
attributes, events and methods. It injects the embed script once and resolves to the element class:
@@ -3,7 +3,7 @@
@@ -3,7 +3,7 @@
"stage": "alpha",
"stage": "alpha",
"code": true,
"code": true,
"wave": "W2",
"wave": "W2",
- "version": "0.106.0",
+ "version": "0.107.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",
@@ -14,6 +14,7 @@ module.exports = {
@@ -14,6 +14,7 @@ module.exports = {
modules: require('./src/modules'),
modules: require('./src/modules'),
realtime: require('./src/realtime'),
realtime: require('./src/realtime'),
media: require('./src/media'),
media: require('./src/media'),
+ cam: require('./src/cam'),
community: require('./src/community'),
community: require('./src/community'),
homeFeed: require('./src/home-feed'),
homeFeed: require('./src/home-feed'),
bot: require('./src/bot'),
bot: require('./src/bot'),
@@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
-// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.106.0, MIT). Do not edit.
+// Generated by scripts/browser-bundle.js from browser.js (openvibe-sdk 0.107.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, community, homeFeed, bot, search, bench, meme, vision, themes, 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, community, homeFeed, bot, search, bench, meme, vision, themes, redact, chat, ai, credentials, jobs, tools, projects, geo). No server-only code: no service tokens, JWT verification, events, identity.
/* eslint-disable */
/* eslint-disable */
const __defs = [
const __defs = [
// ── 0: browser.js ──────────────────────────────────────────────────
// ── 0: browser.js ──────────────────────────────────────────────────
@@ -21,22 +21,23 @@ module.exports = {
@@ -21,22 +21,23 @@ module.exports = {
modules: __load(22),
modules: __load(22),
realtime: __load(23),
realtime: __load(23),
media: __load(24),
media: __load(24),
- community: __load(26),
- homeFeed: __load(27),
- bot: __load(28),
- search: __load(29),
- bench: __load(30),
- meme: __load(31),
- vision: __load(32),
- themes: __load(33),
- redact: __load(34),
- chat: __load(35),
- ai: __load(36),
- credentials: __load(37),
- jobs: __load(38),
- tools: __load(40),
- projects: __load(41),
- geo: __load(42),
+ cam: __load(26),
+ community: __load(27),
+ homeFeed: __load(28),
+ bot: __load(29),
+ search: __load(30),
+ bench: __load(31),
+ meme: __load(32),
+ vision: __load(33),
+ themes: __load(34),
+ redact: __load(35),
+ chat: __load(36),
+ ai: __load(37),
+ credentials: __load(38),
+ jobs: __load(39),
+ tools: __load(41),
+ projects: __load(42),
+ geo: __load(43),
};
};
},
},
// ── 1: src/core/index.js ───────────────────────────────────────────
// ── 1: src/core/index.js ───────────────────────────────────────────
@@ -51,7 +52,7 @@ const { paginate, offsetPager } = __load(7);
@@ -51,7 +52,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.106.0';
+const SDK_VERSION = '0.107.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -3223,7 +3224,98 @@ function createObjectsClient({
@@ -3223,7 +3224,98 @@ function createObjectsClient({
module.exports = { createObjectsClient };
module.exports = { createObjectsClient };
},
},
-// ── 26: src/community.js ────────────────────────────────────────────
+// ── 26: src/cam/index.js ────────────────────────────────────────────
+function (module, exports) {
+'use strict';
+/**
+ * openvibe-sdk/cam: the OpenVibe camera element, from https://openvibe.cam/embed/ov-camera.js.
+ *
+ * In an app: import { defineOvCamera } from the package's cam entry.
+ * await defineOvCamera();
+ * const camera = document.querySelector('ov-camera');
+ * camera.addEventListener('ov-camera:capture', (event) => upload(event.detail.blob));
+ *
+ * The embed itself is OpenVibe.Cam's framework-free custom element. This loader only injects one
+ * <script> per origin (the page may already include it) and resolves to the class once the browser
+ * has defined it. Nothing here touches the camera: the element starts only from a click or an
+ * explicit start(), and its default upload="off" means a capture never leaves the page.
+ *
+ * <ov-camera facing="user" filters="none,mono,warm" timer="3" mode="photo" upload="off"></ov-camera>
+ *
+ * Browser-only by nature; in Node the call rejects and the module still loads (the types and the
+ * pack test import it). Pass `src` to self-host the same element file.
+ */
+const OV_CAMERA_SRC = 'https://openvibe.cam/embed/ov-camera.js';
+const CAM_KIT_SRC = 'https://openvibe.cam/embed/cam-kit.js';
+const CAM_KIT_SRI = 'sha384-kD5WfySp7D3rNJliBpLgJRrl4Geks+4EcgSaCIBGX+dZdecjmUVxEjzbcUw2Spp7';
+
+// One promise per src: a second call while the script is in flight gets the same load, never a second tag.
+const pending = new Map();
+let kitPending = null;
+
+/** Load Cam's in-page recorder once. The pinned script gives the calling site a File. */
+function loadCamKit() {
+ if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.reject(new Error('openvibe-sdk/cam: open() needs a browser.'));
+ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') return Promise.resolve(window.OpenVibeCam);
+ if (kitPending) return kitPending;
+ kitPending = new Promise((resolve, reject) => {
+ const script = document.createElement('script');
+ script.src = CAM_KIT_SRC;
+ script.integrity = CAM_KIT_SRI;
+ script.crossOrigin = 'anonymous';
+ script.async = true;
+ script.addEventListener('load', () => {
+ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') resolve(window.OpenVibeCam);
+ else reject(new Error('openvibe-sdk/cam: Cam kit loaded without OpenVibeCam.open().'));
+ });
+ script.addEventListener('error', () => { script.remove(); reject(new Error('openvibe-sdk/cam: could not load the Cam kit.')); });
+ (document.head || document.documentElement).appendChild(script);
+ }).finally(() => { kitPending = null; });
+ return kitPending;
+}
+
+/** 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)); }
+
+/**
+ * Inject the <ov-camera> embed once and resolve to the element class.
+ * @param {{ src?: string }} [options]
+ * @returns {Promise<CustomElementConstructor>}
+ */
+function defineOvCamera(options = {}) {
+ const src = String((options && options.src) || OV_CAMERA_SRC);
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
+ return Promise.reject(new Error('openvibe-sdk/cam: defineOvCamera() needs a browser with custom elements.'));
+ }
+ const defined = () => (window.customElements ? window.customElements.get('ov-camera') : undefined);
+ const already = defined();
+ if (already) return Promise.resolve(already);
+ if (pending.has(src)) return pending.get(src);
+
+ const load = new Promise((resolve, reject) => {
+ const script = document.createElement('script');
+ script.src = src;
+ script.async = true;
+ script.dataset.ovCamera = '';
+ script.addEventListener('load', () => {
+ const ctor = defined();
+ if (ctor) resolve(ctor);
+ else reject(new Error(`openvibe-sdk/cam: ${src} loaded but did not define <ov-camera>.`));
+ });
+ script.addEventListener('error', () => {
+ script.remove();
+ reject(new Error(`openvibe-sdk/cam: could not load ${src}`));
+ });
+ (document.head || document.documentElement).appendChild(script);
+ }).finally(() => pending.delete(src));
+
+ pending.set(src, load);
+ return load;
+}
+
+module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };
+},
+// ── 27: src/community.js ────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -3342,7 +3434,7 @@ function createCommunityClient(client, defaults = {}) {
@@ -3342,7 +3434,7 @@ function createCommunityClient(client, defaults = {}) {
module.exports = { createCommunityClient, actingHeaders };
module.exports = { createCommunityClient, actingHeaders };
},
},
-// ── 27: src/home-feed.js ────────────────────────────────────────────
+// ── 28: src/home-feed.js ────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/** The menu's portable Home layout, network day counts and personal wall. Pass a user-token core client;
/** The menu's portable Home layout, network day counts and personal wall. Pass a user-token core client;
@@ -3369,7 +3461,7 @@ function createHomeFeedClient(client, { networkBaseUrl, communityBaseUrl } = {})
@@ -3369,7 +3461,7 @@ function createHomeFeedClient(client, { networkBaseUrl, communityBaseUrl } = {})
module.exports = { createHomeFeedClient };
module.exports = { createHomeFeedClient };
},
},
-// ── 28: src/bot.js ──────────────────────────────────────────────────
+// ── 29: src/bot.js ──────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -3591,7 +3683,7 @@ function createBotClient(client, defaults = {}) {
@@ -3591,7 +3683,7 @@ function createBotClient(client, defaults = {}) {
module.exports = { createBotClient, actingHeaders };
module.exports = { createBotClient, actingHeaders };
},
},
-// ── 29: src/search.js ───────────────────────────────────────────────
+// ── 30: src/search.js ───────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -3704,7 +3796,7 @@ function createSearchClient(client, defaults = {}) {
@@ -3704,7 +3796,7 @@ function createSearchClient(client, defaults = {}) {
module.exports = { createSearchClient, queryOf, fabricOf };
module.exports = { createSearchClient, queryOf, fabricOf };
},
},
-// ── 30: src/bench.js ────────────────────────────────────────────────
+// ── 31: src/bench.js ────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/** openvibe-sdk/bench: OpenVibe.Bench's JSON API and streamed open dataset. Browser-safe. */
/** openvibe-sdk/bench: OpenVibe.Bench's JSON API and streamed open dataset. Browser-safe. */
@@ -3805,7 +3897,7 @@ function createBenchClient(client, defaults = {}) {
@@ -3805,7 +3897,7 @@ function createBenchClient(client, defaults = {}) {
module.exports = { createBenchClient };
module.exports = { createBenchClient };
},
},
-// ── 31: src/meme.js ─────────────────────────────────────────────────
+// ── 32: src/meme.js ─────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -3873,7 +3965,7 @@ function createMemeClient(client, defaults = {}) {
@@ -3873,7 +3965,7 @@ function createMemeClient(client, defaults = {}) {
module.exports = { createMemeClient };
module.exports = { createMemeClient };
},
},
-// ── 32: src/vision.js ───────────────────────────────────────────────
+// ── 33: src/vision.js ───────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4031,7 +4123,7 @@ function pick(o, keys) {
@@ -4031,7 +4123,7 @@ function pick(o, keys) {
module.exports = { createVisionClient, DEFAULT_AUDIENCE };
module.exports = { createVisionClient, DEFAULT_AUDIENCE };
},
},
-// ── 33: src/themes.js ───────────────────────────────────────────────
+// ── 34: src/themes.js ───────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4181,7 +4273,7 @@ function followTheme(fn, opts = {}) {
@@ -4181,7 +4273,7 @@ function followTheme(fn, opts = {}) {
module.exports = { createThemesClient, followTheme, readTheme, applyTheme, seasonOn, onColor, DISPLAY_OPTIONS, TOKENS };
module.exports = { createThemesClient, followTheme, readTheme, applyTheme, seasonOn, onColor, DISPLAY_OPTIONS, TOKENS };
},
},
-// ── 34: src/redact.js ───────────────────────────────────────────────
+// ── 35: src/redact.js ───────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4428,7 +4520,7 @@ function onlySecret(text) {
@@ -4428,7 +4520,7 @@ function onlySecret(text) {
module.exports = { redact, onlySecret };
module.exports = { redact, onlySecret };
},
},
-// ── 35: src/chat.js ─────────────────────────────────────────────────
+// ── 36: src/chat.js ─────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4670,7 +4762,7 @@ function createFeedPublisher(client, { feed, key, baseUrl } = {}) {
@@ -4670,7 +4762,7 @@ function createFeedPublisher(client, { feed, key, baseUrl } = {}) {
module.exports = { createChatClient, createInboxVisitor, createFeedPublisher };
module.exports = { createChatClient, createInboxVisitor, createFeedPublisher };
},
},
-// ── 36: src/ai.js ───────────────────────────────────────────────────
+// ── 37: src/ai.js ───────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4802,7 +4894,7 @@ function createAiClient(client, defaults = {}) {
@@ -4802,7 +4894,7 @@ function createAiClient(client, defaults = {}) {
module.exports = { createAiClient, TERMINAL, OPS, CLASSES };
module.exports = { createAiClient, TERMINAL, OPS, CLASSES };
},
},
-// ── 37: src/credentials.js ──────────────────────────────────────────
+// ── 38: src/credentials.js ──────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
@@ -4820,7 +4912,7 @@ function createCredentialsClient(client, defaults = {}) {
@@ -4820,7 +4912,7 @@ function createCredentialsClient(client, defaults = {}) {
module.exports = { createCredentialsClient };
module.exports = { createCredentialsClient };
},
},
-// ── 38: src/jobs.js ─────────────────────────────────────────────────
+// ── 39: src/jobs.js ─────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -4858,7 +4950,7 @@ function (module, exports) {
@@ -4858,7 +4950,7 @@ function (module, exports) {
*/
*/
const { OpenVibeError, isOpenVibeError } = __load(3);
const { OpenVibeError, isOpenVibeError } = __load(3);
const { newIdempotencyKey } = __load(5);
const { newIdempotencyKey } = __load(5);
-const { appendFiles } = __load(39);
+const { appendFiles } = __load(40);
const { parseSSE } = __load(23);
const { parseSSE } = __load(23);
const TERMINAL = new Set(['succeeded', 'failed', 'cancelled']);
const TERMINAL = new Set(['succeeded', 'failed', 'cancelled']);
@@ -5022,7 +5114,7 @@ function createJobsClient(client, { baseUrl, service = 'tools', audience = 'open
@@ -5022,7 +5114,7 @@ function createJobsClient(client, { baseUrl, service = 'tools', audience = 'open
module.exports = { createJobsClient, isTerminal, TERMINAL_STATES: [...TERMINAL] };
module.exports = { createJobsClient, isTerminal, TERMINAL_STATES: [...TERMINAL] };
},
},
-// ── 39: src/core/form.js ────────────────────────────────────────────
+// ── 40: src/core/form.js ────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -5056,7 +5148,7 @@ function appendFiles(form, list, where) {
@@ -5056,7 +5148,7 @@ function appendFiles(form, list, where) {
module.exports = { isBlob, isUpload, appendFiles };
module.exports = { isBlob, isUpload, appendFiles };
},
},
-// ── 40: src/tools.js ────────────────────────────────────────────────
+// ── 41: src/tools.js ────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -5090,8 +5182,8 @@ function (module, exports) {
@@ -5090,8 +5182,8 @@ function (module, exports) {
*/
*/
const { OpenVibeError, isOpenVibeError } = __load(3);
const { OpenVibeError, isOpenVibeError } = __load(3);
const { newIdempotencyKey } = __load(5);
const { newIdempotencyKey } = __load(5);
-const { isUpload, appendFiles } = __load(39);
-const { createJobsClient } = __load(38);
+const { isUpload, appendFiles } = __load(40);
+const { createJobsClient } = __load(39);
const enc = encodeURIComponent;
const enc = encodeURIComponent;
const ID_RE = /^[a-z][a-z0-9-]{0,39}$/;
const ID_RE = /^[a-z][a-z0-9-]{0,39}$/;
@@ -5341,7 +5433,7 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
@@ -5341,7 +5433,7 @@ function createToolsClient(client, { baseUrl, service = 'tools', audience = 'ope
module.exports = { createToolsClient, ToolRunError, isToolRunError };
module.exports = { createToolsClient, ToolRunError, isToolRunError };
},
},
-// ── 41: src/projects.js ─────────────────────────────────────────────
+// ── 42: src/projects.js ─────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -5457,7 +5549,7 @@ function createProjectsClient(client, { baseUrl } = {}) {
@@ -5457,7 +5549,7 @@ function createProjectsClient(client, { baseUrl } = {}) {
module.exports = { createProjectsClient };
module.exports = { createProjectsClient };
},
},
-// ── 42: src/geo.js ──────────────────────────────────────────────────
+// ── 43: src/geo.js ──────────────────────────────────────────────────
function (module, exports) {
function (module, exports) {
'use strict';
'use strict';
/**
/**
@@ -5537,8 +5629,8 @@ export const {
@@ -5537,8 +5629,8 @@ export const {
startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,
startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,
satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, auth,
satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, auth,
locker, registry, trust, modules, realtime, media,
locker, registry, trust, modules, realtime, media,
- community, homeFeed, bot, search, bench, meme,
- vision, themes, redact, chat, ai, credentials,
- jobs, tools, projects, geo,
+ cam, community, homeFeed, bot, search, bench,
+ meme, vision, themes, redact, chat, ai,
+ credentials, jobs, tools, projects, geo,
} = sdk;
} = sdk;
export default sdk;
export default sdk;
@@ -58,6 +58,16 @@
@@ -58,6 +58,16 @@
"createBotClient"
"createBotClient"
]
]
},
},
+ "cam": {
+ "object": [
+ "CAM_KIT_SRC",
+ "CAM_KIT_SRI",
+ "OV_CAMERA_SRC",
+ "defineOvCamera",
+ "loadCamKit",
+ "open"
+ ]
+ },
"chat": {
"chat": {
"object": [
"object": [
"createChatClient",
"createChatClient",
@@ -507,8 +517,12 @@
@@ -507,8 +517,12 @@
"createCache": "function"
"createCache": "function"
},
},
"openvibe-sdk/cam": {
"openvibe-sdk/cam": {
+ "CAM_KIT_SRC": "string",
+ "CAM_KIT_SRI": "string",
"OV_CAMERA_SRC": "string",
"OV_CAMERA_SRC": "string",
- "defineOvCamera": "function"
+ "defineOvCamera": "function",
+ "loadCamKit": "function",
+ "open": "function"
},
},
"openvibe-sdk/chat": {
"openvibe-sdk/chat": {
"createChatClient": "function",
"createChatClient": "function",
@@ -2,6 +2,6 @@
@@ -2,6 +2,6 @@
import cjs from '../src/cam/index.js';
import cjs from '../src/cam/index.js';
export const {
export const {
- defineOvCamera, OV_CAMERA_SRC,
+ defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open,
} = cjs;
} = cjs;
export default cjs;
export default cjs;
@@ -6,13 +6,14 @@ export const {
@@ -6,13 +6,14 @@ export const {
startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,
startSpan, contextFromHeaders, ulid, newEventId, newIdempotencyKey, isActingSubjectId,
satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, report,
satisfiesRange, compareVersions, CONTRACTS_RANGE, DEFAULT_NETWORK, SDK_VERSION, report,
share, locker, auth, registry, identity, trust,
share, locker, auth, registry, identity, trust,
- modules, events, realtime, media, community, homeFeed,
- bot, search, bench, meme, vision, themes,
- redact, chat, chatApps, ai, credentials, jobs,
- tools, projects, resources, vip, quest, live,
- inventory, tips, blog, reviews, wiki, coupons,
- deals, trade, space, host, news, food,
- actor, run, video, work, zone, play,
- download, openre, geo, usage, commerce, telemetry,
+ modules, events, realtime, media, cam, community,
+ homeFeed, bot, search, bench, meme, vision,
+ themes, redact, chat, chatApps, ai, credentials,
+ jobs, tools, projects, resources, vip, quest,
+ live, inventory, tips, blog, reviews, wiki,
+ coupons, deals, trade, space, host, news,
+ food, actor, run, video, work, zone,
+ play, download, openre, geo, usage, commerce,
+ telemetry,
} = cjs;
} = cjs;
export default cjs;
export default cjs;
@@ -19,6 +19,7 @@ module.exports = {
@@ -19,6 +19,7 @@ module.exports = {
events: require('./src/events'),
events: require('./src/events'),
realtime: require('./src/realtime'),
realtime: require('./src/realtime'),
media: require('./src/media'),
media: require('./src/media'),
+ cam: require('./src/cam'),
community: require('./src/community'),
community: require('./src/community'),
homeFeed: require('./src/home-feed'),
homeFeed: require('./src/home-feed'),
bot: require('./src/bot'),
bot: require('./src/bot'),
@@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
{
{
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.106.0",
+ "version": "0.107.0",
"lockfileVersion": 3,
"lockfileVersion": 3,
"requires": true,
"requires": true,
"packages": {
"packages": {
"": {
"": {
"name": "openvibe-sdk",
"name": "openvibe-sdk",
- "version": "0.106.0",
+ "version": "0.107.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.106.0",
+ "version": "0.107.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",
@@ -18,9 +18,36 @@
@@ -18,9 +18,36 @@
* pack test import it). Pass `src` to self-host the same element file.
* pack test import it). Pass `src` to self-host the same element file.
*/
*/
const OV_CAMERA_SRC = 'https://openvibe.cam/embed/ov-camera.js';
const OV_CAMERA_SRC = 'https://openvibe.cam/embed/ov-camera.js';
+const CAM_KIT_SRC = 'https://openvibe.cam/embed/cam-kit.js';
+const CAM_KIT_SRI = 'sha384-kD5WfySp7D3rNJliBpLgJRrl4Geks+4EcgSaCIBGX+dZdecjmUVxEjzbcUw2Spp7';
// One promise per src: a second call while the script is in flight gets the same load, never a second tag.
// One promise per src: a second call while the script is in flight gets the same load, never a second tag.
const pending = new Map();
const pending = new Map();
+let kitPending = null;
+
+/** Load Cam's in-page recorder once. The pinned script gives the calling site a File. */
+function loadCamKit() {
+ if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.reject(new Error('openvibe-sdk/cam: open() needs a browser.'));
+ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') return Promise.resolve(window.OpenVibeCam);
+ if (kitPending) return kitPending;
+ kitPending = new Promise((resolve, reject) => {
+ const script = document.createElement('script');
+ script.src = CAM_KIT_SRC;
+ script.integrity = CAM_KIT_SRI;
+ script.crossOrigin = 'anonymous';
+ script.async = true;
+ script.addEventListener('load', () => {
+ if (window.OpenVibeCam && typeof window.OpenVibeCam.open === 'function') resolve(window.OpenVibeCam);
+ else reject(new Error('openvibe-sdk/cam: Cam kit loaded without OpenVibeCam.open().'));
+ });
+ script.addEventListener('error', () => { script.remove(); reject(new Error('openvibe-sdk/cam: could not load the Cam kit.')); });
+ (document.head || document.documentElement).appendChild(script);
+ }).finally(() => { kitPending = null; });
+ return kitPending;
+}
+
+/** 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)); }
/**
/**
* Inject the <ov-camera> embed once and resolve to the element class.
* Inject the <ov-camera> embed once and resolve to the element class.
@@ -58,4 +85,4 @@ function defineOvCamera(options = {}) {
@@ -58,4 +85,4 @@ function defineOvCamera(options = {}) {
return load;
return load;
}
}
-module.exports = { defineOvCamera, OV_CAMERA_SRC };
+module.exports = { defineOvCamera, OV_CAMERA_SRC, CAM_KIT_SRC, CAM_KIT_SRI, loadCamKit, open };
@@ -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.106.0';
+const SDK_VERSION = '0.107.0';
module.exports = {
module.exports = {
createClient,
createClient,
@@ -97,5 +97,7 @@ run([
@@ -97,5 +97,7 @@ run([
['server entries really are server-only (sanity)', async () => {
['server entries really are server-only (sanity)', async () => {
assert.match(fs.readFileSync(path.join(ROOT, 'src/auth/tokens.js'), 'utf8'), /client_secret/);
assert.match(fs.readFileSync(path.join(ROOT, 'src/auth/tokens.js'), 'utf8'), /client_secret/);
assert.equal(browserTarget(pkg.exports['./auth']), './src/auth/browser.js');
assert.equal(browserTarget(pkg.exports['./auth']), './src/auth/browser.js');
+ assert.equal(typeof require('../browser').cam.open, 'function', 'the browser entry exposes ov.cam.open');
+ assert.match(fs.readFileSync(path.join(ROOT, 'esm/index.mjs'), 'utf8'), /\bcam\b/, 'the ESM root exports cam');
}],
}],
]);
]);
@@ -15,8 +15,10 @@ const pkg = require('../package.json');
@@ -15,8 +15,10 @@ const pkg = require('../package.json');
run([
run([
['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(), ['OV_CAMERA_SRC', 'defineOvCamera']);
+ assert.deepEqual(Object.keys(cam).sort(), ['CAM_KIT_SRC', 'CAM_KIT_SRI', 'OV_CAMERA_SRC', 'defineOvCamera', 'loadCamKit', 'open']);
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');
+ assert.match(cam.CAM_KIT_SRI, /^sha384-/);
assert.equal(require('openvibe-sdk/cam'), cam);
assert.equal(require('openvibe-sdk/cam'), cam);
assert.deepEqual(pkg.exports['./cam'], {
assert.deepEqual(pkg.exports['./cam'], {
types: './types/cam.d.ts',
types: './types/cam.d.ts',
@@ -27,12 +29,41 @@ run([
@@ -27,12 +29,41 @@ run([
assert.equal(esm.default, cam);
assert.equal(esm.default, cam);
assert.equal(esm.OV_CAMERA_SRC, cam.OV_CAMERA_SRC);
assert.equal(esm.OV_CAMERA_SRC, cam.OV_CAMERA_SRC);
assert.equal(typeof esm.defineOvCamera, 'function');
assert.equal(typeof esm.defineOvCamera, 'function');
+ assert.equal(typeof esm.open, 'function');
}],
}],
['in Node it rejects instead of touching a document', async () => {
['in Node it rejects instead of touching a document', async () => {
assert.equal(typeof global.window, 'undefined');
assert.equal(typeof global.window, 'undefined');
await assert.rejects(cam.defineOvCamera(), /needs a browser/);
await assert.rejects(cam.defineOvCamera(), /needs a browser/);
await assert.rejects(cam.defineOvCamera({ src: 'https://example.test/ov-camera.js' }), /needs a browser/);
await assert.rejects(cam.defineOvCamera({ src: 'https://example.test/ov-camera.js' }), /needs a browser/);
+ await assert.rejects(cam.open({ mode: 'video' }), /needs a browser/);
+ }],
+
+ ['the recorder loader pins one script and forwards the result', async () => {
+ const oldWindow = global.window;
+ const oldDocument = global.document;
+ const tags = [];
+ let kit = null;
+ global.window = {};
+ global.document = { createElement: () => {
+ const listeners = {};
+ return { addEventListener: (name, fn) => { listeners[name] = fn; }, remove() {}, listeners };
+ }, head: { appendChild: (tag) => {
+ tags.push(tag);
+ kit = { open: async (options) => ({ mode: options.mode, file: { name: 'clip.webm' } }) };
+ global.window.OpenVibeCam = kit;
+ queueMicrotask(() => tag.listeners.load());
+ } } };
+ try {
+ const [a, b] = await Promise.all([cam.open({ mode: 'video' }), cam.open({ mode: 'photo' })]);
+ assert.equal(tags.length, 1);
+ assert.equal(tags[0].src, cam.CAM_KIT_SRC);
+ assert.equal(tags[0].integrity, cam.CAM_KIT_SRI);
+ assert.equal(tags[0].crossOrigin, 'anonymous');
+ assert.equal(a.mode, 'video');
+ assert.equal(b.mode, 'photo');
+ assert.equal(await cam.loadCamKit(), kit);
+ } finally { if (oldWindow === undefined) delete global.window; else global.window = oldWindow; if (oldDocument === undefined) delete global.document; else global.document = oldDocument; }
}],
}],
['a browser gets one <script> per load and the class; a defined element resolves without another', async () => {
['a browser gets one <script> per load and the class; a defined element resolves without another', async () => {
@@ -86,7 +117,7 @@ run([
@@ -86,7 +117,7 @@ run([
['the types file names the runtime exports and the element surface', async () => {
['the types file names the runtime exports and the element surface', async () => {
const dts = fs.readFileSync(path.join(ROOT, 'types/cam.d.ts'), 'utf8');
const dts = fs.readFileSync(path.join(ROOT, 'types/cam.d.ts'), 'utf8');
for (const name of [
for (const name of [
- 'OV_CAMERA_SRC', 'defineOvCamera', 'DefineOvCameraOptions',
+ 'OV_CAMERA_SRC', 'defineOvCamera', 'DefineOvCameraOptions', 'CAM_KIT_SRC', 'CAM_KIT_SRI', 'CamKitResult', 'CamKitOptions', 'loadCamKit', 'open(options?',
'OvCameraAttributes', 'OvCameraFacing', 'OvCameraFilter', 'OvCameraTimer', 'OvCameraMode', 'OvCameraUpload',
'OvCameraAttributes', 'OvCameraFacing', 'OvCameraFilter', 'OvCameraTimer', 'OvCameraMode', 'OvCameraUpload',
'OvCameraElement', 'OvCameraCaptureDetail', 'OvCameraErrorCode', 'OvCameraErrorDetail',
'OvCameraElement', 'OvCameraCaptureDetail', 'OvCameraErrorCode', 'OvCameraErrorDetail',
'OvCameraCaptureEvent', 'OvCameraErrorEvent', 'OvCameraEventMap', 'HTMLElementTagNameMap',
'OvCameraCaptureEvent', 'OvCameraErrorEvent', 'OvCameraEventMap', 'HTMLElementTagNameMap',
@@ -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, 93); // Adds the home and feed client (0.106.0); 92 had the Report AI comparison client.
+ assert.equal(subpaths.length, 93); // Cam recorder methods extend the existing cam subpath (0.107.0); the 93-subpath count is unchanged.
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 });
@@ -19,8 +19,15 @@ run([
@@ -19,8 +19,15 @@ run([
const lock = require('../package-lock.json');
const lock = require('../package-lock.json');
assert.equal(lock.version, pkg.version);
assert.equal(lock.version, pkg.version);
assert.equal(lock.packages[''].version, pkg.version);
assert.equal(lock.packages[''].version, pkg.version);
- assert.match(fs.readFileSync(path.join(ROOT, 'CHANGELOG.md'), 'utf8'), new RegExp(`^## ${pkg.version.replace(/\./g, '\\.')} \\(`, 'm'));
+ const changelog = fs.readFileSync(path.join(ROOT, 'CHANGELOG.md'), 'utf8');
+ const versionPattern = pkg.version.replace(/\./g, '\\.');
+ assert.match(changelog, new RegExp(`^## ${versionPattern} (?:\\(|— )`, 'm'));
assert.match(fs.readFileSync(path.join(ROOT, 'browser/openvibe-sdk.mjs'), 'utf8'), new RegExp(`openvibe-sdk ${pkg.version.replace(/\./g, '\\.')},`));
assert.match(fs.readFileSync(path.join(ROOT, 'browser/openvibe-sdk.mjs'), 'utf8'), new RegExp(`openvibe-sdk ${pkg.version.replace(/\./g, '\\.')},`));
+ const browserBundle = await import('../browser/openvibe-sdk.mjs');
+ assert.equal(browserBundle.default.SDK_VERSION, pkg.version);
+ assert.equal(typeof browserBundle.default.cam.open, 'function');
+ const camEsm = await import('../esm/cam.mjs');
+ assert.equal(typeof camEsm.open, 'function');
}],
}],
['the README installs and names this release (it said v0.35.2 and v0.37.0 at 0.51.1)', async () => {
['the README installs and names this release (it said v0.35.2 and v0.37.0 at 0.51.1)', async () => {
@@ -4,6 +4,7 @@ import * as registry from './registry';
@@ -4,6 +4,7 @@ import * as registry from './registry';
import * as modules from './modules';
import * as modules from './modules';
import * as realtime from './realtime';
import * as realtime from './realtime';
import * as media from './media';
import * as media from './media';
+import * as cam from './cam';
import * as community from './community';
import * as community from './community';
import * as homeFeed from './home-feed';
import * as homeFeed from './home-feed';
import * as bot from './bot';
import * as bot from './bot';
@@ -30,6 +31,7 @@ export * as registry from './registry';
@@ -30,6 +31,7 @@ export * as registry from './registry';
export * as modules from './modules';
export * as modules from './modules';
export * as realtime from './realtime';
export * as realtime from './realtime';
export * as media from './media';
export * as media from './media';
+export * as cam from './cam';
export * as community from './community';
export * as community from './community';
export * as homeFeed from './home-feed';
export * as homeFeed from './home-feed';
export * as bot from './bot';
export * as bot from './bot';
@@ -51,6 +53,6 @@ export * as trust from './trust';
@@ -51,6 +53,6 @@ export * as trust from './trust';
declare const sdk: typeof core & {
declare const sdk: typeof core & {
auth: typeof auth; registry: typeof registry; modules: typeof modules; realtime: typeof realtime;
auth: typeof auth; registry: typeof registry; modules: typeof modules; realtime: typeof realtime;
- media: typeof media; community: typeof community; homeFeed: typeof homeFeed; bot: typeof bot; search: typeof search; bench: typeof bench; meme: typeof meme; vision: typeof vision; themes: typeof themes; redact: typeof redact; chat: typeof chat; ai: typeof ai; credentials: typeof credentials; jobs: typeof jobs; tools: typeof tools; projects: typeof projects; geo: typeof geo; locker: typeof locker; trust: typeof trust;
+ media: typeof media; cam: typeof cam; community: typeof community; homeFeed: typeof homeFeed; bot: typeof bot; search: typeof search; bench: typeof bench; meme: typeof meme; vision: typeof vision; themes: typeof themes; redact: typeof redact; chat: typeof chat; ai: typeof ai; credentials: typeof credentials; jobs: typeof jobs; tools: typeof tools; projects: typeof projects; geo: typeof geo; locker: typeof locker; trust: typeof trust;
};
};
export default sdk;
export default sdk;
@@ -7,6 +7,30 @@
@@ -7,6 +7,30 @@
/** The embed script the loader injects when no `src` is given. */
/** The embed script the loader injects when no `src` is given. */
export declare const OV_CAMERA_SRC: string;
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 type CamKitMode = 'video' | 'photo' | 'screen';
+export interface CamKitResult {
+ file: File;
+ mode: CamKitMode;
+ mimeType: string;
+ duration: number;
+ width: number;
+ height: number;
+ maxSeconds: number;
+}
+export interface CamKitOptions {
+ mode?: CamKitMode;
+ maxSeconds?: number;
+ timer?: 0 | 3 | 10;
+ onDone?: (result: CamKitResult) => void | Promise<void>;
+}
+/** Load OpenVibeCam once and return its browser API. */
+export declare function loadCamKit(): Promise<{ open(options?: CamKitOptions): Promise<CamKitResult | null> }>;
+/** Open Cam on this page and return a file after Use this; cancellation resolves to null. */
+export declare function open(options?: CamKitOptions): Promise<CamKitResult | null>;
/** The front camera (`user`) or the back camera (`environment`). */
/** The front camera (`user`) or the back camera (`environment`). */
export type OvCameraFacing = 'user' | 'environment';
export type OvCameraFacing = 'user' | 'environment';
@@ -9,6 +9,7 @@ export * as modules from './modules';
@@ -9,6 +9,7 @@ export * as modules from './modules';
export * as events from './events';
export * as events from './events';
export * as realtime from './realtime';
export * as realtime from './realtime';
export * as media from './media';
export * as media from './media';
+export * as cam from './cam';
export * as community from './community';
export * as community from './community';
export * as homeFeed from './home-feed';
export * as homeFeed from './home-feed';
export * as bot from './bot';
export * as bot from './bot';