diff --git a/package.json b/package.json index f80d71a6..1a4c0a91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fishjam-docs", - "version": "0.24.0", + "version": "0.30.0", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/versioned_docs/version-0.30.0/_common/agents/definition.mdx b/versioned_docs/version-0.30.0/_common/agents/definition.mdx new file mode 100644 index 00000000..c6de7300 --- /dev/null +++ b/versioned_docs/version-0.30.0/_common/agents/definition.mdx @@ -0,0 +1,6 @@ +## What is an Agent? + +An agent is a piece of software that allows your backend server to participate in a Fishjam room, similar to how the Fishjam client SDKs allow your client-side application to participate in a Fishjam room. +They can be used to implement features such as real-time audio transcription, real-time content moderation, conversations with AI agents and more. + +You can simply think of an agent as a peer running within your backend application. diff --git a/versioned_docs/version-0.30.0/_common/agents/remember-to-disconnect.mdx b/versioned_docs/version-0.30.0/_common/agents/remember-to-disconnect.mdx new file mode 100644 index 00000000..d1a45cd5 --- /dev/null +++ b/versioned_docs/version-0.30.0/_common/agents/remember-to-disconnect.mdx @@ -0,0 +1,3 @@ +:::danger[Remember to disconnect your agents!] +It's important to disconnect agents, because **every connected agent generates usage** just as a normal peer. +::: diff --git a/versioned_docs/version-0.30.0/_common/agents/subscriptions.mdx b/versioned_docs/version-0.30.0/_common/agents/subscriptions.mdx new file mode 100644 index 00000000..f4aaa318 --- /dev/null +++ b/versioned_docs/version-0.30.0/_common/agents/subscriptions.mdx @@ -0,0 +1,4 @@ +By default, agents **won't** receive peers' audio streams. +This is by design and aims to prevent unnecessary resource usage by the agents. + +For an agent to start receiving a peer's audio, the peer must be **created** with the **subscribe** option set. diff --git a/versioned_docs/version-0.30.0/_common/compositions/idle-cleanup.mdx b/versioned_docs/version-0.30.0/_common/compositions/idle-cleanup.mdx new file mode 100644 index 00000000..96a4e307 --- /dev/null +++ b/versioned_docs/version-0.30.0/_common/compositions/idle-cleanup.mdx @@ -0,0 +1,6 @@ +:::warning[A composition bills for the whole time it exists] +With that guard off, cleanup waits for the outputs to fall silent too, so one that keeps +publishing is never cleaned up for you. Delete it as soon as you are finished, and do not +leave one running after a test. See +[Cost and lifecycle](../../explanation/compositions#cost-and-lifecycle). +::: diff --git a/versioned_docs/version-0.30.0/ai-skill.mdx b/versioned_docs/version-0.30.0/ai-skill.mdx new file mode 100644 index 00000000..b71a7eb4 --- /dev/null +++ b/versioned_docs/version-0.30.0/ai-skill.mdx @@ -0,0 +1,48 @@ +--- +sidebar_position: 1 +title: Build Fishjam apps with AI +sidebar_label: Build with AI +description: "The Fishjam Skill gives your AI coding assistant up-to-date, correct guidance for building Fishjam apps: right SDK, real APIs, secure auth." +slug: /ai-skill +--- + +# Build Fishjam apps with AI + +The **Fishjam Skill** gives any skills-compatible coding assistant accurate, always-current Fishjam expertise. With it installed, your assistant generates code that uses the right SDK, real API names, and secure auth patterns from the first prompt. + +## What it covers + +The skill is one entry in Software Mansion's `skills` plugin, and it spans the whole Fishjam stack — backend, web, and mobile: + +- **Platform fundamentals** — rooms, peers, tracks, the two-tier auth model, notifications, and the REST API. +- **Server SDKs (Node & Python)** — including AI voice agents and the Gemini Live integration. +- **React web client** — the `@fishjam-cloud/react-client` hooks and providers. +- **React Native / Expo client** — permissions, foreground service, CallKit, screen share, and Picture-in-Picture. + +## Install + +Install the skill into Claude Code (recommended) or any skills-compatible assistant: + +```bash +npx skills add software-mansion-labs/skills +``` + +## How it activates + +No command needed. The skill auto-loads whenever you mention Fishjam or a Fishjam SDK/API in your prompts, like `@fishjam-cloud/react-client`, `FishjamClient`, or `managementToken`. + +## Why it helps + +The skill turns your assistant into a Fishjam specialist: + +- **Always current** — it tracks the latest SDKs and APIs, so your assistant builds on today's Fishjam instead of stale examples. +- **Secure by default** — authentication and tokens follow the patterns we recommend for production, from the first line of code. +- **Full-stack in one place** — backend, web, and mobile share the same guidance, so features connect cleanly end to end. + +:::tip +The skill follows the latest Fishjam release, so your assistant always works against current SDKs and APIs. +::: + +## Links + +- Source and installation details: [software-mansion-labs/skills](https://github.com/software-mansion-labs/skills) (MIT). diff --git a/versioned_docs/version-0.30.0/api/_category_.json b/versioned_docs/version-0.30.0/api/_category_.json new file mode 100644 index 00000000..d38385d4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/_category_.json @@ -0,0 +1,12 @@ +{ + "label": "API", + "position": 7, + "link": { + "type": "generated-index", + "description": "API documentation for Client and Server SDKs.", + "slug": "/api" + }, + "customProps": { + "id": "generated-api" + } +} diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index.md b/versioned_docs/version-0.30.0/api/custom-video-source/index.md new file mode 100644 index 00000000..8ad95144 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index.md @@ -0,0 +1,6 @@ +# @fishjam-cloud/react-native-custom-video-source + +## Modules + +- [index](index/index.md) +- [webgpu](webgpu/index.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedForwardTrack.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedForwardTrack.md new file mode 100644 index 00000000..a9844383 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedForwardTrack.md @@ -0,0 +1,19 @@ +# Function: useManagedForwardTrack() + +> **useManagedForwardTrack**(`enabled`): [`ManagedForwardTrack`](../interfaces/ManagedForwardTrack.md) + +Defined in: [src/internal/useManagedForwardTrack.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedForwardTrack.ts#L29) + +Owns the async lifecycle of a forwarding custom video track: creates it while `enabled`, +exposes the handle + stream once ready, and stops the tracks on disable/unmount (also when +creation resolves after the owner already unmounted). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `enabled` | `boolean` | + +## Returns + +[`ManagedForwardTrack`](../interfaces/ManagedForwardTrack.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedPooledTrack.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedPooledTrack.md new file mode 100644 index 00000000..beb40479 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/functions/useManagedPooledTrack.md @@ -0,0 +1,22 @@ +# Function: useManagedPooledTrack() + +> **useManagedPooledTrack**(`enabled`, `width`, `height`, `poolSize`): [`ManagedPooledTrack`](../interfaces/ManagedPooledTrack.md) + +Defined in: [src/internal/useManagedPooledTrack.ts:77](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L77) + +Owns the async lifecycle of a surface pool + pooled custom video track: allocates both while +`enabled` (re-allocates when the dimensions change), exposes worklet-ready descriptors, and +tears down in the correct order (stop tracks, then dispose the pool) on disable/unmount. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `enabled` | `boolean` | +| `width` | `number` | +| `height` | `number` | +| `poolSize` | `number` | + +## Returns + +[`ManagedPooledTrack`](../interfaces/ManagedPooledTrack.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/index.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/index.md new file mode 100644 index 00000000..cc0ed53a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/index.md @@ -0,0 +1,27 @@ +# index + +Publish your own video frames to Fishjam. + +Source-lifecycle hooks that create a custom video track, publish it, and clean it up — you +supply the frames from any source. Two modes, picked by how you produce frames: + +- [useManagedForwardTrack](functions/useManagedForwardTrack.md) — you already have finished native buffers (a camera, a native + ML pipeline, a compositor); forward each buffer pointer with `forwardFrame` from + `@fishjam-cloud/react-native-webrtc`. +- [useManagedPooledTrack](functions/useManagedPooledTrack.md) — you render the frames yourself; allocate a surface pool, draw + into it, and hand each frame back with `pushFrame`. The `@fishjam-cloud/react-native-custom-video-source/webgpu` + entry point provides a WebGPU camera-rendering toolkit for this mode. + +For a ready-made VisionCamera integration on top of this, use +`@fishjam-cloud/react-native-vision-camera-source`. + +## Interfaces + +- [ManagedForwardTrack](interfaces/ManagedForwardTrack.md) +- [ManagedPooledTrack](interfaces/ManagedPooledTrack.md) +- [WorkletBufferDescriptor](interfaces/WorkletBufferDescriptor.md) + +## Functions + +- [useManagedForwardTrack](functions/useManagedForwardTrack.md) +- [useManagedPooledTrack](functions/useManagedPooledTrack.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedForwardTrack.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedForwardTrack.md new file mode 100644 index 00000000..577c7e34 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedForwardTrack.md @@ -0,0 +1,30 @@ +# Interface: ManagedForwardTrack + +Defined in: [src/internal/useManagedForwardTrack.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedForwardTrack.ts#L16) + +State of a forwarding custom video track managed by [useManagedForwardTrack](../functions/useManagedForwardTrack.md). +While the track is being created (or after an error) `track` and `stream` are `null`. + +## Properties + +### error + +> **error**: `null` \| `Error` + +Defined in: [src/internal/useManagedForwardTrack.ts:19](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedForwardTrack.ts#L19) + +*** + +### stream + +> **stream**: `null` \| `MediaStream` + +Defined in: [src/internal/useManagedForwardTrack.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedForwardTrack.ts#L18) + +*** + +### track + +> **track**: `null` \| `ForwardTrack` + +Defined in: [src/internal/useManagedForwardTrack.ts:17](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedForwardTrack.ts#L17) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedPooledTrack.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedPooledTrack.md new file mode 100644 index 00000000..0f151beb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/ManagedPooledTrack.md @@ -0,0 +1,40 @@ +# Interface: ManagedPooledTrack + +Defined in: [src/internal/useManagedPooledTrack.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L26) + +State of a pooled custom video track managed by [useManagedPooledTrack](../functions/useManagedPooledTrack.md). +While the pool and track are being created (or after an error) all fields are `null`. + +## Properties + +### bufferDescriptors + +> **bufferDescriptors**: `null` \| [`WorkletBufferDescriptor`](WorkletBufferDescriptor.md)[] + +Defined in: [src/internal/useManagedPooledTrack.ts:30](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L30) + +Plain per-surface descriptors (the pool object itself is not worklet-serializable). + +*** + +### error + +> **error**: `null` \| `Error` + +Defined in: [src/internal/useManagedPooledTrack.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L31) + +*** + +### stream + +> **stream**: `null` \| `MediaStream` + +Defined in: [src/internal/useManagedPooledTrack.ts:28](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L28) + +*** + +### track + +> **track**: `null` \| `PooledTrack` + +Defined in: [src/internal/useManagedPooledTrack.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L27) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/WorkletBufferDescriptor.md b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/WorkletBufferDescriptor.md new file mode 100644 index 00000000..832fb282 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/index/interfaces/WorkletBufferDescriptor.md @@ -0,0 +1,37 @@ +# Interface: WorkletBufferDescriptor + +Defined in: [src/internal/useManagedPooledTrack.ts:15](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L15) + +One pooled output surface as plain values the frame worklet can capture and import itself. + +## Properties + +### height + +> **height**: `number` + +Defined in: [src/internal/useManagedPooledTrack.ts:19](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L19) + +*** + +### index + +> **index**: `number` + +Defined in: [src/internal/useManagedPooledTrack.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L16) + +*** + +### surfaceHandle + +> **surfaceHandle**: `bigint` + +Defined in: [src/internal/useManagedPooledTrack.ts:17](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L17) + +*** + +### width + +> **width**: `number` + +Defined in: [src/internal/useManagedPooledTrack.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/internal/useManagedPooledTrack.ts#L18) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/typedoc-sidebar.cjs b/versioned_docs/version-0.30.0/api/custom-video-source/typedoc-sidebar.cjs new file mode 100644 index 00000000..e3d3c40f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */ +const typedocSidebar = {items:[{type:"category",label:"index",items:[{type:"category",label:"Interfaces",items:[{type:"doc",id:"api/custom-video-source/index/interfaces/ManagedForwardTrack",label:"ManagedForwardTrack"},{type:"doc",id:"api/custom-video-source/index/interfaces/ManagedPooledTrack",label:"ManagedPooledTrack"},{type:"doc",id:"api/custom-video-source/index/interfaces/WorkletBufferDescriptor",label:"WorkletBufferDescriptor"}]},{type:"category",label:"Functions",items:[{type:"doc",id:"api/custom-video-source/index/functions/useManagedForwardTrack",label:"useManagedForwardTrack"},{type:"doc",id:"api/custom-video-source/index/functions/useManagedPooledTrack",label:"useManagedPooledTrack"}]}],link:{type:"doc",id:"api/custom-video-source/index/index"}},{type:"category",label:"webgpu",items:[{type:"category",label:"Interfaces",items:[{type:"doc",id:"api/custom-video-source/webgpu/interfaces/CameraPassthroughPipelineOptions",label:"CameraPassthroughPipelineOptions"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/CreateCameraShaderBindingsOptions",label:"CreateCameraShaderBindingsOptions"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/UseCameraWebGpuDeviceResult",label:"UseCameraWebGpuDeviceResult"}]},{type:"category",label:"Type Aliases",items:[{type:"doc",id:"api/custom-video-source/webgpu/type-aliases/WebGpuRuntime",label:"WebGpuRuntime"}]},{type:"category",label:"Functions",items:[{type:"doc",id:"api/custom-video-source/webgpu/functions/getWebGpuRuntime",label:"getWebGpuRuntime"},{type:"doc",id:"api/custom-video-source/webgpu/functions/useCameraWebGpuDeviceWithOverride",label:"useCameraWebGpuDeviceWithOverride"}]},{type:"category",label:"WebGPU",items:[{type:"doc",id:"api/custom-video-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport",label:"assertWebGpuDeviceSupportsCameraImport"},{type:"doc",id:"api/custom-video-source/webgpu/functions/computeAspectFillCrop",label:"computeAspectFillCrop"},{type:"doc",id:"api/custom-video-source/webgpu/functions/computeSquareCrop",label:"computeSquareCrop"},{type:"doc",id:"api/custom-video-source/webgpu/functions/createCameraBindGroup",label:"createCameraBindGroup"},{type:"doc",id:"api/custom-video-source/webgpu/functions/createCameraPassthroughPipeline",label:"createCameraPassthroughPipeline"},{type:"doc",id:"api/custom-video-source/webgpu/functions/createCameraShaderBindings",label:"createCameraShaderBindings"},{type:"doc",id:"api/custom-video-source/webgpu/functions/createCameraTextureResolver",label:"createCameraTextureResolver"},{type:"doc",id:"api/custom-video-source/webgpu/functions/encodeCameraPassthrough",label:"encodeCameraPassthrough"},{type:"doc",id:"api/custom-video-source/webgpu/functions/getOutputSurfaceFormat",label:"getOutputSurfaceFormat"},{type:"doc",id:"api/custom-video-source/webgpu/functions/getRequiredWebGpuCameraFeatures",label:"getRequiredWebGpuCameraFeatures"},{type:"doc",id:"api/custom-video-source/webgpu/functions/packFrameCropParams",label:"packFrameCropParams"},{type:"doc",id:"api/custom-video-source/webgpu/functions/resolveCameraTexture",label:"resolveCameraTexture"},{type:"doc",id:"api/custom-video-source/webgpu/functions/useCameraWebGpuDevice",label:"useCameraWebGpuDevice"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/CameraPassthroughPipeline",label:"CameraPassthroughPipeline"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/CameraShaderBindings",label:"CameraShaderBindings"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/CameraTextureResolver",label:"CameraTextureResolver"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/FrameCrop",label:"FrameCrop"},{type:"doc",id:"api/custom-video-source/webgpu/interfaces/WebGpuFrameRenderContext",label:"WebGpuFrameRenderContext"},{type:"doc",id:"api/custom-video-source/webgpu/type-aliases/WebGpuFrameRenderFunction",label:"WebGpuFrameRenderFunction"},{type:"doc",id:"api/custom-video-source/webgpu/variables/FrameCropParams",label:"FrameCropParams"},{type:"doc",id:"api/custom-video-source/webgpu/variables/sampleCamera",label:"sampleCamera"}]}],link:{type:"doc",id:"api/custom-video-source/webgpu/index"}}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md new file mode 100644 index 00000000..483bea15 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md @@ -0,0 +1,19 @@ +# Function: assertWebGpuDeviceSupportsCameraImport() + +> **assertWebGpuDeviceSupportsCameraImport**(`device`): `void` + +Defined in: [src/webgpu/requiredFeatures.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/requiredFeatures.ts#L31) + +Throws a descriptive error when `device` is missing any feature required to import camera +frames or Fishjam output surfaces on this platform. Called automatically on devices passed as +an override; call it yourself to validate a device early. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeAspectFillCrop.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeAspectFillCrop.md new file mode 100644 index 00000000..9db15ee1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeAspectFillCrop.md @@ -0,0 +1,30 @@ +# Function: computeAspectFillCrop() + +> **computeAspectFillCrop**(`sourceWidth`, `sourceHeight`, `targetAspect`, `uv00`, `uv01`, `uv10`, `uv11`): [`FrameCrop`](../interfaces/FrameCrop.md) + +Defined in: [src/webgpu/cropUtilities.ts:86](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L86) + +Center-crop of a (sourceWidth × sourceHeight) frame to the target aspect ratio (width/height). +A no-op full-frame crop when the source already has the target aspect. Worklet-safe. + +Feed it the upright camera size from the render context: +`computeAspectFillCrop(context.cameraWidth, context.cameraHeight, context.outputWidth / context.outputHeight)`. + +The optional `uv00..uv11` scalars form a UV-space transform applied around the frame center +(identity by default). + +## Parameters + +| Parameter | Type | Default value | +| ------ | ------ | ------ | +| `sourceWidth` | `number` | `undefined` | +| `sourceHeight` | `number` | `undefined` | +| `targetAspect` | `number` | `undefined` | +| `uv00` | `number` | `1` | +| `uv01` | `number` | `0` | +| `uv10` | `number` | `0` | +| `uv11` | `number` | `1` | + +## Returns + +[`FrameCrop`](../interfaces/FrameCrop.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeSquareCrop.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeSquareCrop.md new file mode 100644 index 00000000..8e4dd532 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/computeSquareCrop.md @@ -0,0 +1,23 @@ +# Function: computeSquareCrop() + +> **computeSquareCrop**(`sourceWidth`, `sourceHeight`, `uv00`, `uv01`, `uv10`, `uv11`): [`FrameCrop`](../interfaces/FrameCrop.md) + +Defined in: [src/webgpu/cropUtilities.ts:123](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L123) + +Square center-crop of a (sourceWidth × sourceHeight) frame — the usual shape for square model +inputs. Worklet-safe. The optional `uv00..uv11` scalars are as in [computeAspectFillCrop](computeAspectFillCrop.md). + +## Parameters + +| Parameter | Type | Default value | +| ------ | ------ | ------ | +| `sourceWidth` | `number` | `undefined` | +| `sourceHeight` | `number` | `undefined` | +| `uv00` | `number` | `1` | +| `uv01` | `number` | `0` | +| `uv10` | `number` | `0` | +| `uv11` | `number` | `1` | + +## Returns + +[`FrameCrop`](../interfaces/FrameCrop.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraBindGroup.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraBindGroup.md new file mode 100644 index 00000000..75e87288 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraBindGroup.md @@ -0,0 +1,24 @@ +# Function: createCameraBindGroup() + +> **createCameraBindGroup**(`device`, `cameraShaderBindings`, `cameraTexture`): `GPUBindGroup` + +Defined in: [src/webgpu/cameraShaderBindings.ts:134](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L134) + +Builds the per-frame bind group for the live camera texture. The source hook already does this +for you when you pass `cameraShaderBindings` in its options (see the render context's +`cameraBindGroup`); call it yourself only for advanced multi-layout setups. Worklet-safe. + +A camera texture expires when the frame ends, so a bind group referencing it must be rebuilt +every frame — never cache the result. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `cameraShaderBindings` | [`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) | +| `cameraTexture` | `GPUExternalTexture` | + +## Returns + +`GPUBindGroup` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraPassthroughPipeline.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraPassthroughPipeline.md new file mode 100644 index 00000000..a275b6e7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraPassthroughPipeline.md @@ -0,0 +1,20 @@ +# Function: createCameraPassthroughPipeline() + +> **createCameraPassthroughPipeline**(`device`, `options`): [`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:108](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L108) + +Builds the full-screen camera passthrough pipeline: crop/orientation via [FrameCrop](../interfaces/FrameCrop.md), +platform-correct camera sampling, one triangle. Use it to publish the camera through the WebGPU +tier with zero WGSL of your own, or as the base pass under your overlay passes. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `options` | [`CameraPassthroughPipelineOptions`](../interfaces/CameraPassthroughPipelineOptions.md) | + +## Returns + +[`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraShaderBindings.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraShaderBindings.md new file mode 100644 index 00000000..080a31f8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraShaderBindings.md @@ -0,0 +1,29 @@ +# Function: createCameraShaderBindings() + +> **createCameraShaderBindings**(`device`, `options`): [`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) + +Defined in: [src/webgpu/cameraShaderBindings.ts:102](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L102) + +Builds the camera-sampling bindings against the device your pipelines use. Pass the result to +the source hook's `cameraShaderBindings` option and the render context delivers a ready-made +`cameraBindGroup` every frame — set it at [CameraShaderBindings.bindGroupIndex](../interfaces/CameraShaderBindings.md#bindgroupindex) and call +`sampleCamera(uv)` in your fragment shader. + +```ts +const cam = createCameraShaderBindings(device); +const fragment = tgpu.fragmentFn({ in: { uv: d.location(0, d.vec2f) }, out: d.vec4f })((input) => { + return cam.sampleCamera(input.uv); +}); +const wgsl = cam.bindingDeclarations + tgpu.resolve({ externals: { fragment } }); +``` + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `options` | [`CreateCameraShaderBindingsOptions`](../interfaces/CreateCameraShaderBindingsOptions.md) | + +## Returns + +[`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraTextureResolver.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraTextureResolver.md new file mode 100644 index 00000000..85a6e465 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/createCameraTextureResolver.md @@ -0,0 +1,20 @@ +# Function: createCameraTextureResolver() + +> **createCameraTextureResolver**(`device`, `size`): [`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) + +Defined in: [src/webgpu/cameraTextureResolver.ts:32](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L32) + +Creates a [CameraTextureResolver](../interfaces/CameraTextureResolver.md) with an owned `rgba8unorm` texture of the given size. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `size` | \{ `height`: `number`; `width`: `number`; \} | +| `size.height` | `number` | +| `size.width` | `number` | + +## Returns + +[`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/encodeCameraPassthrough.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/encodeCameraPassthrough.md new file mode 100644 index 00000000..55c70efb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/encodeCameraPassthrough.md @@ -0,0 +1,29 @@ +# Function: encodeCameraPassthrough() + +> **encodeCameraPassthrough**(`device`, `passthrough`, `cameraTexture`, `outputView`, `commandEncoder`, `crop`): `void` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:163](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L163) + +Encodes one full-screen pass drawing the camera into `outputView`, cropped per `crop`. +Worklet-safe; call it inside your render callback, and encode any overlay passes after it on +the same command encoder (with `loadOp: 'load'` so they draw on top). + +At most one call per pipeline instance per frame: the crop lives in a single uniform buffer +written via `queue.writeBuffer`, which lands before the submitted command buffer executes — a +second call in the same frame makes both draws use the second crop. Encode to multiple targets +with different crops by building one pipeline per target. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `passthrough` | [`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) | +| `cameraTexture` | `GPUExternalTexture` | +| `outputView` | `GPUTextureView` | +| `commandEncoder` | `GPUCommandEncoder` | +| `crop` | [`FrameCrop`](../interfaces/FrameCrop.md) | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getOutputSurfaceFormat.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getOutputSurfaceFormat.md new file mode 100644 index 00000000..8e9f9163 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getOutputSurfaceFormat.md @@ -0,0 +1,13 @@ +# Function: getOutputSurfaceFormat() + +> **getOutputSurfaceFormat**(): `GPUTextureFormat` + +Defined in: [src/webgpu/requiredFeatures.ts:51](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/requiredFeatures.ts#L51) + +The pixel format of Fishjam output surfaces on this platform: `'rgba8unorm'` on Android +(AHardwareBuffer), `'bgra8unorm'` on iOS (IOSurface). Use it as the render-target format of any +pipeline that draws into the output texture — a mismatched format renders wrong or black. + +## Returns + +`GPUTextureFormat` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md new file mode 100644 index 00000000..18e2a31f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md @@ -0,0 +1,13 @@ +# Function: getRequiredWebGpuCameraFeatures() + +> **getRequiredWebGpuCameraFeatures**(): `GPUFeatureName`[] + +Defined in: [src/webgpu/requiredFeatures.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/requiredFeatures.ts#L20) + +The GPU features a device must have to import camera frames and Fishjam output surfaces on this +platform. [useCameraWebGpuDevice](useCameraWebGpuDevice.md) requests them for you; pass them yourself as +`requiredFeatures` in `GPUDeviceDescriptor` when you bring your own device. + +## Returns + +`GPUFeatureName`[] diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getWebGpuRuntime.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getWebGpuRuntime.md new file mode 100644 index 00000000..44ffd8bd --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/getWebGpuRuntime.md @@ -0,0 +1,20 @@ +# Function: getWebGpuRuntime() + +> **getWebGpuRuntime**(): `object` + +Defined in: [src/webgpu/webGpuRuntime.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/webGpuRuntime.ts#L16) + +Returns the react-native-webgpu runtime singleton, self-healing when the `RNWebGPU` global is +missing on the calling runtime. The library binds the global once at module load, but that +binding can be absent after a crash-recovery runtime reload or an install-ordering flake; +`WebGPUModule.install()` binds it to the calling runtime and is safe to repeat. + +## Returns + +`object` + +## Throws + +When the runtime cannot be installed (react-native-webgpu missing or its native module +not linked) — returning the still-undefined global would only defer the failure to an opaque +per-frame TypeError. diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/packFrameCropParams.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/packFrameCropParams.md new file mode 100644 index 00000000..5e3ef021 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/packFrameCropParams.md @@ -0,0 +1,18 @@ +# Function: packFrameCropParams() + +> **packFrameCropParams**(`crop`): `ArrayBuffer` + +Defined in: [src/webgpu/cropUtilities.ts:56](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L56) + +Packs a [FrameCrop](../interfaces/FrameCrop.md) into the [FrameCropParams](../variables/FrameCropParams.md) uniform byte layout. +Worklet-safe; upload the result with `device.queue.writeBuffer(buffer, 0, bytes)`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `crop` | [`FrameCrop`](../interfaces/FrameCrop.md) | + +## Returns + +`ArrayBuffer` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/resolveCameraTexture.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/resolveCameraTexture.md new file mode 100644 index 00000000..9ec37c14 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/resolveCameraTexture.md @@ -0,0 +1,24 @@ +# Function: resolveCameraTexture() + +> **resolveCameraTexture**(`device`, `resolver`, `cameraTexture`, `cameraWidth`, `cameraHeight`, `commandEncoder`): `void` + +Defined in: [src/webgpu/cameraTextureResolver.ts:58](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L58) + +Encodes one pass resolving the live camera texture into `resolver.texture`, aspect-filled to +the resolver's size (platform YUV decode included). Worklet-safe; call it inside your render +callback before the passes that sample `resolver.texture`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `resolver` | [`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) | +| `cameraTexture` | `GPUExternalTexture` | +| `cameraWidth` | `number` | +| `cameraHeight` | `number` | +| `commandEncoder` | `GPUCommandEncoder` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDevice.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDevice.md new file mode 100644 index 00000000..bcf8a14a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDevice.md @@ -0,0 +1,19 @@ +# Function: useCameraWebGpuDevice() + +> **useCameraWebGpuDevice**(): [`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) + +Defined in: [src/webgpu/useCameraWebGpuDevice.ts:69](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/useCameraWebGpuDevice.ts#L69) + +The app-wide GPUDevice used for camera work, configured with +[getRequiredWebGpuCameraFeatures](getRequiredWebGpuCameraFeatures.md). All callers share one device, so pipelines you build +against it work with the textures the source hook hands your render callback. + +Build your pipelines once the device arrives: +```tsx +const { device } = useCameraWebGpuDevice(); +const effect = useMemo(() => (device ? buildMyEffect(device) : null), [device]); +``` + +## Returns + +[`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md new file mode 100644 index 00000000..2d944941 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md @@ -0,0 +1,18 @@ +# Function: useCameraWebGpuDeviceWithOverride() + +> **useCameraWebGpuDeviceWithOverride**(`override`): [`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) + +Defined in: [src/webgpu/useCameraWebGpuDevice.ts:97](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/useCameraWebGpuDevice.ts#L97) + +Device resolution for the source hook: the user-provided override (validated) when present, +otherwise the shared device. Always called, so hook order stays stable either way. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `override` | `undefined` \| `GPUDevice` | + +## Returns + +[`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/index.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/index.md new file mode 100644 index 00000000..9d555aa4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/index.md @@ -0,0 +1,52 @@ +# webgpu + +WebGPU camera toolkit — sample the live camera and render your own content into the video you +publish with `useManagedPooledTrack` (from the package's main entry point). Requires `react-native-webgpu` (an optional peer of +this package; only this entry point loads it). + +- [createCameraShaderBindings](functions/createCameraShaderBindings.md) — sample the live camera from your own shaders via + `sampleCamera(uv)`, with the platform's YUV decode handled for you. +- [createCameraPassthroughPipeline](functions/createCameraPassthroughPipeline.md) / [encodeCameraPassthrough](functions/encodeCameraPassthrough.md) — a ready-made + camera→output pass to publish the camera with zero WGSL, or to build overlays on. +- [createCameraTextureResolver](functions/createCameraTextureResolver.md) — opt-in plain-texture camera for pipelines that can't + sample `texture_external`. +- [useCameraWebGpuDevice](functions/useCameraWebGpuDevice.md) — the shared, camera-import-capable GPUDevice. + +## Interfaces + +- [CameraPassthroughPipelineOptions](interfaces/CameraPassthroughPipelineOptions.md) +- [CreateCameraShaderBindingsOptions](interfaces/CreateCameraShaderBindingsOptions.md) +- [UseCameraWebGpuDeviceResult](interfaces/UseCameraWebGpuDeviceResult.md) + +## Type Aliases + +- [WebGpuRuntime](type-aliases/WebGpuRuntime.md) + +## Functions + +- [getWebGpuRuntime](functions/getWebGpuRuntime.md) +- [useCameraWebGpuDeviceWithOverride](functions/useCameraWebGpuDeviceWithOverride.md) + +## WebGPU + +- [assertWebGpuDeviceSupportsCameraImport](functions/assertWebGpuDeviceSupportsCameraImport.md) +- [computeAspectFillCrop](functions/computeAspectFillCrop.md) +- [computeSquareCrop](functions/computeSquareCrop.md) +- [createCameraBindGroup](functions/createCameraBindGroup.md) +- [createCameraPassthroughPipeline](functions/createCameraPassthroughPipeline.md) +- [createCameraShaderBindings](functions/createCameraShaderBindings.md) +- [createCameraTextureResolver](functions/createCameraTextureResolver.md) +- [encodeCameraPassthrough](functions/encodeCameraPassthrough.md) +- [getOutputSurfaceFormat](functions/getOutputSurfaceFormat.md) +- [getRequiredWebGpuCameraFeatures](functions/getRequiredWebGpuCameraFeatures.md) +- [packFrameCropParams](functions/packFrameCropParams.md) +- [resolveCameraTexture](functions/resolveCameraTexture.md) +- [useCameraWebGpuDevice](functions/useCameraWebGpuDevice.md) +- [CameraPassthroughPipeline](interfaces/CameraPassthroughPipeline.md) +- [CameraShaderBindings](interfaces/CameraShaderBindings.md) +- [CameraTextureResolver](interfaces/CameraTextureResolver.md) +- [FrameCrop](interfaces/FrameCrop.md) +- [WebGpuFrameRenderContext](interfaces/WebGpuFrameRenderContext.md) +- [WebGpuFrameRenderFunction](type-aliases/WebGpuFrameRenderFunction.md) +- [FrameCropParams](variables/FrameCropParams.md) +- [sampleCamera](variables/sampleCamera.md) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipeline.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipeline.md new file mode 100644 index 00000000..3aa857a6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipeline.md @@ -0,0 +1,44 @@ +# Interface: CameraPassthroughPipeline + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:78](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L78) + +A ready-made full-screen camera→target render pipeline. Build once at setup with +[createCameraPassthroughPipeline](../functions/createCameraPassthroughPipeline.md); every field is safe to capture into the frame worklet. + +## Properties + +### cameraShaderBindings + +> `readonly` **cameraShaderBindings**: [`CameraShaderBindings`](CameraShaderBindings.md) + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:81](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L81) + +The camera shader bindings the pipeline samples through. + +*** + +### cropBindGroup + +> `readonly` **cropBindGroup**: `GPUBindGroup` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:85](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L85) + +Static bind group with the crop uniform. + +*** + +### cropParamsBuffer + +> `readonly` **cropParamsBuffer**: `GPUBuffer` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:83](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L83) + +Uniform buffer holding the packed FrameCropParams; written by [encodeCameraPassthrough](../functions/encodeCameraPassthrough.md). + +*** + +### pipeline + +> `readonly` **pipeline**: `GPURenderPipeline` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:79](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L79) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md new file mode 100644 index 00000000..8411f4a1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md @@ -0,0 +1,25 @@ +# Interface: CameraPassthroughPipelineOptions + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:65](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L65) + +Options for [createCameraPassthroughPipeline](../functions/createCameraPassthroughPipeline.md). + +## Properties + +### mirror? + +> `optional` **mirror**: `boolean` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:69](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L69) + +Mirror the camera horizontally (the usual selfie self-view convention). Defaults to `false`. + +*** + +### outputFormat? + +> `optional` **outputFormat**: `GPUTextureFormat` + +Defined in: [src/webgpu/cameraPassthroughPipeline.ts:67](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraPassthroughPipeline.ts#L67) + +Render-target format. Defaults to [getOutputSurfaceFormat](../functions/getOutputSurfaceFormat.md) (the Fishjam output surface). diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraShaderBindings.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraShaderBindings.md new file mode 100644 index 00000000..07754965 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraShaderBindings.md @@ -0,0 +1,58 @@ +# Interface: CameraShaderBindings + +Defined in: [src/webgpu/cameraShaderBindings.ts:61](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L61) + +Everything a fragment shader needs to sample the live camera. Build once at setup with +[createCameraShaderBindings](../functions/createCameraShaderBindings.md); the fields are safe to capture into the frame worklet. + +## Properties + +### bindGroupIndex + +> `readonly` **bindGroupIndex**: `number` + +Defined in: [src/webgpu/cameraShaderBindings.ts:77](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L77) + +The group index the bindings are declared at. + +*** + +### bindGroupLayout + +> `readonly` **bindGroupLayout**: `GPUBindGroupLayout` + +Defined in: [src/webgpu/cameraShaderBindings.ts:73](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L73) + +Layout of the camera bind group; place it at [bindGroupIndex](#bindgroupindex) in your pipeline layout. + +*** + +### bindingDeclarations + +> `readonly` **bindingDeclarations**: `string` + +Defined in: [src/webgpu/cameraShaderBindings.ts:71](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L71) + +WGSL declaring the camera `texture_external` and `sampler` at [bindGroupIndex](#bindgroupindex). TypeGPU +cannot emit an external-texture binding, so prepend this to the WGSL your shader resolves to. + +*** + +### sampleCamera + +> `readonly` **sampleCamera**: `TgpuFn`\<(`uv`) => `Vec4f`\> + +Defined in: [src/webgpu/cameraShaderBindings.ts:66](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L66) + +The camera sampler as a TypeGPU function — call `sampleCamera(uv)` from your TGSL fragment +shader. Same value as the exported [sampleCamera](../variables/sampleCamera.md). + +*** + +### sampler + +> `readonly` **sampler**: `GPUSampler` + +Defined in: [src/webgpu/cameraShaderBindings.ts:75](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L75) + +The linear-filtering sampler bound at binding 1. diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraTextureResolver.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraTextureResolver.md new file mode 100644 index 00000000..d01a74d0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CameraTextureResolver.md @@ -0,0 +1,58 @@ +# Interface: CameraTextureResolver + +Defined in: [src/webgpu/cameraTextureResolver.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L16) + +An owned `rgba8unorm` texture the camera frame is resolved into each frame — for pipelines that +want a plain `texture_2d` camera instead of `texture_external`. Build once at setup with +[createCameraTextureResolver](../functions/createCameraTextureResolver.md); every field is safe to capture into the frame worklet. + +Prefer sampling the camera directly via [createCameraShaderBindings](../functions/createCameraShaderBindings.md) when you can: the +resolver costs one extra render pass per frame. + +## Properties + +### height + +> `readonly` **height**: `number` + +Defined in: [src/webgpu/cameraTextureResolver.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L22) + +*** + +### resolvePass + +> `readonly` **resolvePass**: [`CameraPassthroughPipeline`](CameraPassthroughPipeline.md) + +Defined in: [src/webgpu/cameraTextureResolver.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L24) + +**`Internal`** + +The pass used to resolve into [texture](#texture). + +*** + +### texture + +> `readonly` **texture**: `GPUTexture` + +Defined in: [src/webgpu/cameraTextureResolver.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L18) + +The resolved camera texture (`rgba8unorm`, sampled + render-attachment usage). + +*** + +### view + +> `readonly` **view**: `GPUTextureView` + +Defined in: [src/webgpu/cameraTextureResolver.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L20) + +A reusable default view of [texture](#texture). + +*** + +### width + +> `readonly` **width**: `number` + +Defined in: [src/webgpu/cameraTextureResolver.ts:21](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraTextureResolver.ts#L21) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md new file mode 100644 index 00000000..babf11b9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md @@ -0,0 +1,15 @@ +# Interface: CreateCameraShaderBindingsOptions + +Defined in: [src/webgpu/cameraShaderBindings.ts:50](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L50) + +Options for [createCameraShaderBindings](../functions/createCameraShaderBindings.md). + +## Properties + +### bindGroupIndex? + +> `optional` **bindGroupIndex**: `number` + +Defined in: [src/webgpu/cameraShaderBindings.ts:52](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L52) + +Bind group index the camera texture + sampler are declared at. Defaults to `0`. diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/FrameCrop.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/FrameCrop.md new file mode 100644 index 00000000..73f4ddcb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/FrameCrop.md @@ -0,0 +1,88 @@ +# Interface: FrameCrop + +Defined in: [src/webgpu/cropUtilities.ts:30](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L30) + +A center-crop of a source frame plus a UV-space orientation transform, in source pixels. +Produce one with [computeAspectFillCrop](../functions/computeAspectFillCrop.md) or [computeSquareCrop](../functions/computeSquareCrop.md). + +## Properties + +### cropOriginX + +> **cropOriginX**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:33](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L33) + +*** + +### cropOriginY + +> **cropOriginY**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:34](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L34) + +*** + +### cropSizeX + +> **cropSizeX**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L35) + +*** + +### cropSizeY + +> **cropSizeY**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:36](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L36) + +*** + +### sourceHeight + +> **sourceHeight**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:32](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L32) + +*** + +### sourceWidth + +> **sourceWidth**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L31) + +*** + +### uv00 + +> **uv00**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L38) + +uvTransform matrix scalars in (m00, m01, m10, m11) order; identity when omitted at compute time. + +*** + +### uv01 + +> **uv01**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:39](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L39) + +*** + +### uv10 + +> **uv10**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:40](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L40) + +*** + +### uv11 + +> **uv11**: `number` + +Defined in: [src/webgpu/cropUtilities.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L41) diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md new file mode 100644 index 00000000..8f295d2f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md @@ -0,0 +1,25 @@ +# Interface: UseCameraWebGpuDeviceResult + +Defined in: [src/webgpu/useCameraWebGpuDevice.ts:49](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/useCameraWebGpuDevice.ts#L49) + +Result of [useCameraWebGpuDevice](../functions/useCameraWebGpuDevice.md). + +## Properties + +### device + +> **device**: `null` \| `GPUDevice` + +Defined in: [src/webgpu/useCameraWebGpuDevice.ts:51](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/useCameraWebGpuDevice.ts#L51) + +The shared GPUDevice; `null` until acquisition resolves. + +*** + +### error + +> **error**: `null` \| `Error` + +Defined in: [src/webgpu/useCameraWebGpuDevice.ts:53](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/useCameraWebGpuDevice.ts#L53) + +Acquisition failure (no adapter, missing platform features), if any. diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/WebGpuFrameRenderContext.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/WebGpuFrameRenderContext.md new file mode 100644 index 00000000..18aa83e4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/interfaces/WebGpuFrameRenderContext.md @@ -0,0 +1,135 @@ +# Interface: WebGpuFrameRenderContext + +Defined in: [src/webgpu/frameRenderContext.ts:8](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L8) + +Everything your render callback needs for one frame. Handed to the function you pass to +`render(...)` inside the source hook's `onFrame` worklet; every field is valid only until that +function returns. + +## Properties + +### cameraBindGroup? + +> `optional` **cameraBindGroup**: `GPUBindGroup` + +Defined in: [src/webgpu/frameRenderContext.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L31) + +Ready-made bind group for [cameraTexture](#cameratexture), present when the hook's +`cameraShaderBindings` option was provided: set it at the bindings' group index and +`sampleCamera(uv)` works. + +*** + +### cameraHeight + +> **cameraHeight**: `number` + +Defined in: [src/webgpu/frameRenderContext.ts:50](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L50) + +*** + +### cameraIsMirrored + +> **cameraIsMirrored**: `boolean` + +Defined in: [src/webgpu/frameRenderContext.ts:52](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L52) + +Whether the camera feed is mirrored (front cameras usually are). + +*** + +### cameraTexture + +> **cameraTexture**: `GPUExternalTexture` + +Defined in: [src/webgpu/frameRenderContext.ts:25](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L25) + +The live camera frame as a `texture_external`, already rotated upright (and mirrored per the +camera's mirroring). On Android it samples as raw YCbCr — sample it through +`createCameraShaderBindings` (or the ready-made [cameraBindGroup](#camerabindgroup)) for +platform-correct RGB. + +*** + +### cameraWidth + +> **cameraWidth**: `number` + +Defined in: [src/webgpu/frameRenderContext.ts:49](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L49) + +Upright (post-rotation) camera frame size, in pixels — feed it to `computeAspectFillCrop` +together with the output aspect. + +*** + +### commandEncoder + +> **commandEncoder**: `GPUCommandEncoder` + +Defined in: [src/webgpu/frameRenderContext.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L18) + +The command encoder for this frame. Encode your render/compute passes into it — the hook +submits it (a single submit) and delivers the frame after your callback returns. Do not call +`queue.submit` yourself for work targeting [outputTexture](#outputtexture). + +*** + +### device + +> **device**: `GPUDevice` + +Defined in: [src/webgpu/frameRenderContext.ts:10](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L10) + +The device in use (the shared device, or your override). + +*** + +### outputHeight + +> **outputHeight**: `number` + +Defined in: [src/webgpu/frameRenderContext.ts:44](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L44) + +*** + +### outputTexture + +> **outputTexture**: `GPUTexture` + +Defined in: [src/webgpu/frameRenderContext.ts:33](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L33) + +The output texture your passes draw into; its content becomes the published video frame. + +*** + +### outputView + +> **outputView**: `GPUTextureView` + +Defined in: [src/webgpu/frameRenderContext.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L41) + +A cached, reusable default `createView()` of [outputTexture](#outputtexture). Prefer this over calling +`outputTexture.createView()` yourself every frame: `GPUTextureView` has no `destroy()`/`release()` +in react-native-webgpu, so a per-frame view accumulates native (malloc) wrappers on the frame +runtime until GC — a steady leak in a render loop. The output textures are a small fixed pool, so +the hook builds one view per slot and reuses it. + +*** + +### outputWidth + +> **outputWidth**: `number` + +Defined in: [src/webgpu/frameRenderContext.ts:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L43) + +Size of [outputTexture](#outputtexture), in pixels. + +*** + +### queue + +> **queue**: `GPUQueue` + +Defined in: [src/webgpu/frameRenderContext.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L12) + +Shortcut for `device.queue`. diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md new file mode 100644 index 00000000..99f1e17c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md @@ -0,0 +1,18 @@ +# Type Alias: WebGpuFrameRenderFunction() + +> **WebGpuFrameRenderFunction** = (`encode`) => `void` + +Defined in: [src/webgpu/frameRenderContext.ts:61](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/frameRenderContext.ts#L61) + +The `render` function handed to the source hook's `onFrame` worklet. Call it at most once per +frame with your encode function; skipping it drops the frame (nothing is published for it). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `encode` | (`context`) => `void` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuRuntime.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuRuntime.md new file mode 100644 index 00000000..2caf95ad --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/type-aliases/WebGpuRuntime.md @@ -0,0 +1,7 @@ +# Type Alias: WebGpuRuntime + +> **WebGpuRuntime** = *typeof* `RNWebGPU` + +Defined in: [src/webgpu/webGpuRuntime.ts:4](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/webGpuRuntime.ts#L4) + +The react-native-webgpu runtime singleton (the `RNWebGPU` JSI global). diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/FrameCropParams.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/FrameCropParams.md new file mode 100644 index 00000000..87a7c031 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/FrameCropParams.md @@ -0,0 +1,11 @@ +# Variable: FrameCropParams + +> `const` **FrameCropParams**: `WgslStruct`\<\{ `cropOrigin`: `Vec2f`; `cropSize`: `Vec2f`; `sourceSize`: `Vec2u`; `uvTransform`: `Mat2x2f`; \}\> + +Defined in: [src/webgpu/cropUtilities.ts:17](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cropUtilities.ts#L17) + +The TypeGPU schema for the crop uniform. This is the single source of truth for both the WGSL +`struct FrameCropParams` (emitted when the passthrough shader is resolved) and the byte layout +[packFrameCropParams](../functions/packFrameCropParams.md) writes. Its std140 layout is 40 bytes: + + sourceSize: vec2u @0 cropOrigin: vec2f @8 cropSize: vec2f @16 uvTransform: mat2x2f @24 diff --git a/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/sampleCamera.md b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/sampleCamera.md new file mode 100644 index 00000000..50cbfad3 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/custom-video-source/webgpu/variables/sampleCamera.md @@ -0,0 +1,10 @@ +# Variable: sampleCamera + +> `const` **sampleCamera**: `TgpuFn`\<(`uv`) => `d.Vec4f`\> + +Defined in: [src/webgpu/cameraShaderBindings.ts:42](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-custom-video-source/src/webgpu/cameraShaderBindings.ts#L42) + +Samples the live camera and returns upright RGB on both platforms (the Android in-shader BT.709 +YUV decode is included automatically). A TypeGPU function you can call from your own TGSL +fragment shaders. It reads the camera texture + sampler declared by +[CameraShaderBindings.bindingDeclarations](../interfaces/CameraShaderBindings.md#bindingdeclarations), which you must prepend to the resolved shader. diff --git a/versioned_docs/version-0.30.0/api/mobile/classes/MediaStream.md b/versioned_docs/version-0.30.0/api/mobile/classes/MediaStream.md new file mode 100644 index 00000000..0375e609 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/classes/MediaStream.md @@ -0,0 +1,290 @@ +# Class: MediaStream + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:8 + +## Extends + +- `unknown`\<`MediaStreamEventMap`\> + +## Constructors + +### Constructor + +> **new MediaStream**(`arg?`): `MediaStream` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:31 + +A MediaStream can be constructed in several ways, depending on the parameters +that are passed here. + +- undefined: just a new stream, with no tracks. +- MediaStream instance: a new stream, with a copy of the tracks of the passed stream. +- Array of MediaStreamTrack: a new stream with a copy of the tracks in the array. +- object: a new stream instance, represented by the passed info object, this is always + done internally, when the stream is first created in native and the JS wrapper is + built afterwards. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `arg?` | `MediaStream` \| [`MediaStreamTrack`](MediaStreamTrack.md)[] \| \{ `streamId`: `string`; `streamReactTag`: `string`; `tracks`: `MediaStreamTrackInfo`[]; \} | + +#### Returns + +`MediaStream` + +#### Overrides + +`EventTarget.constructor` + +## Properties + +### \_id + +> **\_id**: `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:10 + +*** + +### \_reactTag + +> **\_reactTag**: `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:19 + +The identifier of this MediaStream unique within the associated +WebRTCModule instance. As the id of a remote MediaStream instance is unique +only within the associated RTCPeerConnection, it is not sufficiently unique +to identify this MediaStream across multiple RTCPeerConnections and to +unambiguously differentiate it from a local MediaStream instance not added +to an RTCPeerConnection. + +*** + +### \_tracks + +> **\_tracks**: [`MediaStreamTrack`](MediaStreamTrack.md)[] + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:9 + +## Accessors + +### active + +#### Get Signature + +> **get** **active**(): `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:41 + +##### Returns + +`boolean` + +*** + +### id + +#### Get Signature + +> **get** **id**(): `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:40 + +##### Returns + +`string` + +*** + +### onaddtrack + +#### Get Signature + +> **get** **onaddtrack**(): `any` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:36 + +##### Returns + +`any` + +#### Set Signature + +> **set** **onaddtrack**(`value`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:37 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `any` | + +##### Returns + +`void` + +*** + +### onremovetrack + +#### Get Signature + +> **get** **onremovetrack**(): `any` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:38 + +##### Returns + +`any` + +#### Set Signature + +> **set** **onremovetrack**(`value`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:39 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `any` | + +##### Returns + +`void` + +## Methods + +### addTrack() + +> **addTrack**(`track`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:42 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `track` | [`MediaStreamTrack`](MediaStreamTrack.md) | + +#### Returns + +`void` + +*** + +### clone() + +> **clone**(): `never` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:48 + +#### Returns + +`never` + +*** + +### getAudioTracks() + +> **getAudioTracks**(): [`MediaStreamTrack`](MediaStreamTrack.md)[] + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:46 + +#### Returns + +[`MediaStreamTrack`](MediaStreamTrack.md)[] + +*** + +### getTrackById() + +> **getTrackById**(`trackId`): `undefined` \| [`MediaStreamTrack`](MediaStreamTrack.md) + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:45 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `trackId` | `any` | + +#### Returns + +`undefined` \| [`MediaStreamTrack`](MediaStreamTrack.md) + +*** + +### getTracks() + +> **getTracks**(): [`MediaStreamTrack`](MediaStreamTrack.md)[] + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:44 + +#### Returns + +[`MediaStreamTrack`](MediaStreamTrack.md)[] + +*** + +### getVideoTracks() + +> **getVideoTracks**(): [`MediaStreamTrack`](MediaStreamTrack.md)[] + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:47 + +#### Returns + +[`MediaStreamTrack`](MediaStreamTrack.md)[] + +*** + +### release() + +> **release**(`releaseTracks?`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:50 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `releaseTracks?` | `boolean` | + +#### Returns + +`void` + +*** + +### removeTrack() + +> **removeTrack**(`track`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:43 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `track` | [`MediaStreamTrack`](MediaStreamTrack.md) | + +#### Returns + +`void` + +*** + +### toURL() + +> **toURL**(): `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStream.d.ts:49 + +#### Returns + +`string` diff --git a/versioned_docs/version-0.30.0/api/mobile/classes/MediaStreamTrack.md b/versioned_docs/version-0.30.0/api/mobile/classes/MediaStreamTrack.md new file mode 100644 index 00000000..d630a509 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/classes/MediaStreamTrack.md @@ -0,0 +1,460 @@ +# Class: MediaStreamTrack + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:27 + +## Extends + +- `unknown`\<`MediaStreamTrackEventMap`\> + +## Constructors + +### Constructor + +> **new MediaStreamTrack**(`info`): `MediaStreamTrack` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:38 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | `MediaStreamTrackInfo` | + +#### Returns + +`MediaStreamTrack` + +#### Overrides + +`EventTarget.constructor` + +## Properties + +### \_constraints + +> **\_constraints**: `MediaTrackConstraints` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:28 + +*** + +### \_enabled + +> **\_enabled**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:29 + +*** + +### \_muted + +> **\_muted**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:31 + +*** + +### \_peerConnectionId + +> **\_peerConnectionId**: `number` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:32 + +*** + +### \_readyState + +> **\_readyState**: `MediaStreamTrackState` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:33 + +*** + +### \_settings + +> **\_settings**: `MediaTrackSettings` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:30 + +*** + +### id + +> `readonly` **id**: `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:34 + +*** + +### kind + +> `readonly` **kind**: `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:35 + +*** + +### label + +> `readonly` **label**: `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:36 + +*** + +### remote + +> `readonly` **remote**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:37 + +## Accessors + +### enabled + +#### Get Signature + +> **get** **enabled**(): `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:45 + +##### Returns + +`boolean` + +#### Set Signature + +> **set** **enabled**(`enabled`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:46 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `enabled` | `boolean` | + +##### Returns + +`void` + +*** + +### muted + +#### Get Signature + +> **get** **muted**(): `boolean` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:47 + +##### Returns + +`boolean` + +*** + +### onended + +#### Get Signature + +> **get** **onended**(): `any` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:39 + +##### Returns + +`any` + +#### Set Signature + +> **set** **onended**(`value`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:40 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `any` | + +##### Returns + +`void` + +*** + +### onmute + +#### Get Signature + +> **get** **onmute**(): `any` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:41 + +##### Returns + +`any` + +#### Set Signature + +> **set** **onmute**(`value`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:42 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `any` | + +##### Returns + +`void` + +*** + +### onunmute + +#### Get Signature + +> **get** **onunmute**(): `any` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:43 + +##### Returns + +`any` + +#### Set Signature + +> **set** **onunmute**(`value`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:44 + +##### Parameters + +| Parameter | Type | +| ------ | ------ | +| `value` | `any` | + +##### Returns + +`void` + +*** + +### readyState + +#### Get Signature + +> **get** **readyState**(): `string` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:48 + +##### Returns + +`string` + +## Methods + +### \_registerEvents() + +> **\_registerEvents**(): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:90 + +#### Returns + +`void` + +*** + +### \_setMutedInternal() + +> **\_setMutedInternal**(`muted`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:68 + +Internal function which is used to set the muted state on remote tracks and +emit the mute / unmute event. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `muted` | `boolean` | Whether the track should be marked as muted / unmuted. | + +#### Returns + +`void` + +*** + +### \_setVideoEffect() + +> **\_setVideoEffect**(`name`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:61 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `name` | `string` | + +#### Returns + +`void` + +*** + +### \_setVideoEffects() + +> **\_setVideoEffects**(`names`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:60 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `names` | `string`[] | + +#### Returns + +`void` + +*** + +### \_setVolume() + +> **\_setVolume**(`volume`): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:74 + +Custom API for setting the volume on an individual audio track. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `volume` | `number` | a gain value in the range of 0-10. defaults to 1.0 | + +#### Returns + +`void` + +*** + +### ~~\_switchCamera()~~ + +> **\_switchCamera**(): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:59 + +Private / custom API for switching the cameras on the fly, without the +need for adding / removing tracks or doing any SDP renegotiation. + +This is how the reference application (AppRTCMobile) implements camera +switching. + +#### Returns + +`void` + +#### Deprecated + +Use applyConstraints instead. + +*** + +### applyConstraints() + +> **applyConstraints**(`constraints?`): `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:85 + +Applies a new set of constraints to the track. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `constraints?` | `MediaTrackConstraints` | An object listing the constraints to apply to the track's constrainable properties; any existing constraints are replaced with the new values specified, and any constrainable properties not included are restored to their default constraints. If this parameter is omitted, all currently set custom constraints are cleared. | + +#### Returns + +`Promise`\<`void`\> + +*** + +### clone() + +> **clone**(): `never` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:86 + +#### Returns + +`never` + +*** + +### getCapabilities() + +> **getCapabilities**(): `never` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:87 + +#### Returns + +`never` + +*** + +### getConstraints() + +> **getConstraints**(): `MediaTrackConstraints` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:88 + +#### Returns + +`MediaTrackConstraints` + +*** + +### getSettings() + +> **getSettings**(): `MediaTrackSettings` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:89 + +#### Returns + +`MediaTrackSettings` + +*** + +### release() + +> **release**(): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:91 + +#### Returns + +`void` + +*** + +### stop() + +> **stop**(): `void` + +Defined in: react-native-webrtc/lib/typescript/MediaStreamTrack.d.ts:49 + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/enumerations/AudioDeviceType.md b/versioned_docs/version-0.30.0/api/mobile/enumerations/AudioDeviceType.md new file mode 100644 index 00000000..b97709ea --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/enumerations/AudioDeviceType.md @@ -0,0 +1,93 @@ +# Enumeration: AudioDeviceType + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:2 + +Normalized audio device categories across iOS and Android. + +## Enumeration Members + +### airplay + +> **airplay**: `"airplay"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:9 + +*** + +### bluetooth + +> **bluetooth**: `"bluetooth"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:5 + +*** + +### carAudio + +> **carAudio**: `"carAudio"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:10 + +*** + +### earpiece + +> **earpiece**: `"earpiece"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:3 + +*** + +### hdmi + +> **hdmi**: `"hdmi"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:8 + +*** + +### hearingAid + +> **hearingAid**: `"hearingAid"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:11 + +*** + +### lineOut + +> **lineOut**: `"lineOut"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:12 + +*** + +### speaker + +> **speaker**: `"speaker"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:4 + +*** + +### unknown + +> **unknown**: `"unknown"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:13 + +*** + +### usb + +> **usb**: `"usb"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:7 + +*** + +### wiredHeadset + +> **wiredHeadset**: `"wiredHeadset"` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:6 diff --git a/versioned_docs/version-0.30.0/api/mobile/enumerations/Variant.md b/versioned_docs/version-0.30.0/api/mobile/enumerations/Variant.md new file mode 100644 index 00000000..fc4e6cfa --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/enumerations/Variant.md @@ -0,0 +1,43 @@ +# Enumeration: Variant + +Defined in: ts-client/dist/index.d.mts:51 + +## Enumeration Members + +### UNRECOGNIZED + +> **UNRECOGNIZED**: `-1` + +Defined in: ts-client/dist/index.d.mts:56 + +*** + +### VARIANT\_HIGH + +> **VARIANT\_HIGH**: `3` + +Defined in: ts-client/dist/index.d.mts:55 + +*** + +### VARIANT\_LOW + +> **VARIANT\_LOW**: `1` + +Defined in: ts-client/dist/index.d.mts:53 + +*** + +### VARIANT\_MEDIUM + +> **VARIANT\_MEDIUM**: `2` + +Defined in: ts-client/dist/index.d.mts:54 + +*** + +### VARIANT\_UNSPECIFIED + +> **VARIANT\_UNSPECIFIED**: `0` + +Defined in: ts-client/dist/index.d.mts:52 diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/FishjamProvider.md b/versioned_docs/version-0.30.0/api/mobile/functions/FishjamProvider.md new file mode 100644 index 00000000..85078955 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/FishjamProvider.md @@ -0,0 +1,15 @@ +# Function: FishjamProvider() + +> **FishjamProvider**(`props`): `FunctionComponentElement`\<`FishjamProviderProps`\> + +Defined in: [mobile-client/src/index.ts:152](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/index.ts#L152) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | [`FishjamProviderProps`](../type-aliases/FishjamProviderProps.md) | + +## Returns + +`FunctionComponentElement`\<`FishjamProviderProps`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/RTCPIPView.md b/versioned_docs/version-0.30.0/api/mobile/functions/RTCPIPView.md new file mode 100644 index 00000000..99ba9114 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/RTCPIPView.md @@ -0,0 +1,15 @@ +# Function: RTCPIPView() + +> **RTCPIPView**(`__namedParameters`): `Element` + +Defined in: [mobile-client/src/overrides/RTCView.tsx:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/RTCView.tsx#L31) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`RTCPIPViewProps`](../type-aliases/RTCPIPViewProps.md) | + +## Returns + +`Element` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/RTCView.md b/versioned_docs/version-0.30.0/api/mobile/functions/RTCView.md new file mode 100644 index 00000000..66939d6f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/RTCView.md @@ -0,0 +1,15 @@ +# Function: RTCView() + +> **RTCView**(`__namedParameters`): `Element` + +Defined in: [mobile-client/src/overrides/RTCView.tsx:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/RTCView.tsx#L26) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`RTCVideoViewProps`](../type-aliases/RTCVideoViewProps.md) | + +## Returns + +`Element` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/VoIPProvider.md b/versioned_docs/version-0.30.0/api/mobile/functions/VoIPProvider.md new file mode 100644 index 00000000..91c26d70 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/VoIPProvider.md @@ -0,0 +1,21 @@ +# Function: VoIPProvider() + +> **VoIPProvider**(`__namedParameters`): `Element` + +Defined in: [mobile-client/src/voip/VoIPProvider.tsx:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPProvider.tsx#L41) + +Tracks the current VoIP call state, driven by the native CallKit / Core-Telecom +events from [useVoIPEvents](../variables/useVoIPEvents.md), and exposes it through [useVoIP](useVoIP.md). + +Joining rooms, peer tokens and media are the consumer's — react to `callStatus` and +report back with `reportConnected` / `reportConnectFailed`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`VoIPProviderProps`](../type-aliases/VoIPProviderProps.md) | + +## Returns + +`Element` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/failIncomingCallConnected.md b/versioned_docs/version-0.30.0/api/mobile/functions/failIncomingCallConnected.md new file mode 100644 index 00000000..5b13f4a3 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/failIncomingCallConnected.md @@ -0,0 +1,17 @@ +# Function: failIncomingCallConnected() + +> **failIncomingCallConnected**(`requestId`): `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:21 + +Aborts the parked native answer action. Safe to call after it has timed out. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `requestId` | `string` | + +## Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/fulfillIncomingCallConnected.md b/versioned_docs/version-0.30.0/api/mobile/functions/fulfillIncomingCallConnected.md new file mode 100644 index 00000000..c19a6bc7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/fulfillIncomingCallConnected.md @@ -0,0 +1,18 @@ +# Function: fulfillIncomingCallConnected() + +> **fulfillIncomingCallConnected**(`requestId`): `Promise`\<`boolean`\> + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:17 + +Resolves the parked native answer action once incoming-call media is live. +Returns false when the request has already timed out or been resolved. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `requestId` | `string` | + +## Returns + +`Promise`\<`boolean`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/getPendingAnswerRequestId.md b/versioned_docs/version-0.30.0/api/mobile/functions/getPendingAnswerRequestId.md new file mode 100644 index 00000000..8a7b94cf --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/getPendingAnswerRequestId.md @@ -0,0 +1,11 @@ +# Function: getPendingAnswerRequestId() + +> **getPendingAnswerRequestId**(): `null` \| `string` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:23 + +Returns the answer request that is still awaiting media, if any. + +## Returns + +`null` \| `string` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/isCallHeld.md b/versioned_docs/version-0.30.0/api/mobile/functions/isCallHeld.md new file mode 100644 index 00000000..ae8ab1c9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/isCallHeld.md @@ -0,0 +1,12 @@ +# Function: isCallHeld() + +> **isCallHeld**(): `boolean` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:46 + +Whether the OS currently has the call on hold. Useful on mount, when no `onHeldChanged` +event has been seen yet. + +## Returns + +`boolean` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/pushAudioSamples.md b/versioned_docs/version-0.30.0/api/mobile/functions/pushAudioSamples.md new file mode 100644 index 00000000..8ebd6038 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/pushAudioSamples.md @@ -0,0 +1,27 @@ +# Function: pushAudioSamples() + +> **pushAudioSamples**(`track`, `samples`): `void` + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:91 + +Hand PCM to a custom audio track. + +Call whenever your source produces audio, with any chunk size — the native +layer re-frames and paces it. `Float32Array` samples are expected in +`[-1, 1]` (values outside are clamped); `Int16Array` is taken as-is. Stereo +tracks take interleaved samples in whole frames — a push with an odd sample +count has its trailing sample dropped to keep the channels aligned. +Worklet-safe: it dispatches synchronously to +native on whatever thread you call it from. The samples are copied before the +call returns, so the array may be reused immediately. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `track` | [`CustomAudioTrack`](../interfaces/CustomAudioTrack.md) | +| `samples` | `Float32Array`\<`ArrayBufferLike`\> \| `Int16Array`\<`ArrayBufferLike`\> | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/reportOutgoingCallConnected.md b/versioned_docs/version-0.30.0/api/mobile/functions/reportOutgoingCallConnected.md new file mode 100644 index 00000000..aac06eec --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/reportOutgoingCallConnected.md @@ -0,0 +1,14 @@ +# Function: reportOutgoingCallConnected() + +> **reportOutgoingCallConnected**(): `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:30 + +Reports that an outgoing call's media is connected — the remote party answered. +Until this is called, the OS shows the call as "Calling…" / "Dialing…" and no +call timer runs. No-op for incoming calls, or when there is no active outgoing +call. + +## Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/setCallHeld.md b/versioned_docs/version-0.30.0/api/mobile/functions/setCallHeld.md new file mode 100644 index 00000000..040d625f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/setCallHeld.md @@ -0,0 +1,19 @@ +# Function: setCallHeld() + +> **setCallHeld**(`onHold`): `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:36 + +Asks the OS to hold or resume the current call. The system decides and reports back +through `onHeldChanged`, so treat that event — not this call returning — as the point +the call is actually held. No-op when there is no active call. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `onHold` | `boolean` | + +## Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/setCallMuted.md b/versioned_docs/version-0.30.0/api/mobile/functions/setCallMuted.md new file mode 100644 index 00000000..5180e409 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/setCallMuted.md @@ -0,0 +1,18 @@ +# Function: setCallMuted() + +> **setCallMuted**(`muted`): `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:41 + +Drives the system mute state so the OS call UI reflects an in-app mute, and lets +the mute round-trip back through `onMuteChanged`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `muted` | `boolean` | + +## Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/startPIP.md b/versioned_docs/version-0.30.0/api/mobile/functions/startPIP.md new file mode 100644 index 00000000..6b10f3d2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/startPIP.md @@ -0,0 +1,15 @@ +# Function: startPIP() + +> **startPIP**(`ref`): `void` + +Defined in: react-native-webrtc/lib/typescript/RTCPIPView.d.ts:14 + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `ref` | `RefObject`\<`Component`\<`RTCVideoViewProps`, \{ \}, `any`\> & `NativeMethods`\> | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/stopPIP.md b/versioned_docs/version-0.30.0/api/mobile/functions/stopPIP.md new file mode 100644 index 00000000..403fb4e6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/stopPIP.md @@ -0,0 +1,15 @@ +# Function: stopPIP() + +> **stopPIP**(`ref`): `void` + +Defined in: react-native-webrtc/lib/typescript/RTCPIPView.d.ts:15 + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `ref` | `RefObject`\<`Component`\<`RTCVideoViewProps`, \{ \}, `any`\> & `NativeMethods`\> | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useAudioOutput.md b/versioned_docs/version-0.30.0/api/mobile/functions/useAudioOutput.md new file mode 100644 index 00000000..4b63b209 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useAudioOutput.md @@ -0,0 +1,13 @@ +# Function: useAudioOutput() + +> **useAudioOutput**(): [`UseAudioOutputResult`](../type-aliases/UseAudioOutputResult.md) + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:17 + +Audio output state for the current session. + +Use `.ios` / `.android` for platform-specific actions. + +## Returns + +[`UseAudioOutputResult`](../type-aliases/UseAudioOutputResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCallKit.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKit.md new file mode 100644 index 00000000..dd53e1ac --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKit.md @@ -0,0 +1,67 @@ +# Function: useCallKit() + +> **useCallKit**(): `object` + +Defined in: [mobile-client/src/overrides/hooks.ts:134](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L134) + +## Returns + +`object` + +### endCallKitSession() + +> **endCallKitSession**: (`reason?`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason?` | [`CallEndedReason`](../type-aliases/CallEndedReason.md) | + +#### Returns + +`Promise`\<`void`\> + +### getCallKitSessionStatus() + +> **getCallKitSessionStatus**: () => `Promise`\<`boolean`\> + +#### Returns + +`Promise`\<`boolean`\> + +### isHeld() + +> **isHeld**: () => `boolean` + +#### Returns + +`boolean` + +### setCallHeld() + +> **setCallHeld**: (`onHold`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `onHold` | `boolean` | + +#### Returns + +`Promise`\<`void`\> + +### startCallKitSession() + +> **startCallKitSession**: (`config`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`CallKitConfig`](../type-aliases/CallKitConfig.md) | + +#### Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitEvent.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitEvent.md new file mode 100644 index 00000000..859fe96f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitEvent.md @@ -0,0 +1,22 @@ +# Function: useCallKitEvent() + +> **useCallKitEvent**\<`T`\>(`action`, `callback`): `void` + +Defined in: [mobile-client/src/overrides/hooks.ts:143](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L143) + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* keyof [`CallKitAction`](../type-aliases/CallKitAction.md) | + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `action` | `T` | +| `callback` | (`event`) => `void` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitService.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitService.md new file mode 100644 index 00000000..ed043a2e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCallKitService.md @@ -0,0 +1,15 @@ +# Function: useCallKitService() + +> **useCallKitService**(`config`): `void` + +Defined in: [mobile-client/src/overrides/hooks.ts:139](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L139) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`CallKitConfig`](../type-aliases/CallKitConfig.md) | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCamera.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCamera.md new file mode 100644 index 00000000..e7f839c4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCamera.md @@ -0,0 +1,9 @@ +# Function: useCamera() + +> **useCamera**(): [`UseCameraResult`](../type-aliases/UseCameraResult.md) + +Defined in: [mobile-client/src/overrides/hooks.ts:36](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L36) + +## Returns + +[`UseCameraResult`](../type-aliases/UseCameraResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCameraPermissions.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCameraPermissions.md new file mode 100644 index 00000000..56038eb6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCameraPermissions.md @@ -0,0 +1,28 @@ +# Function: useCameraPermissions() + +> **useCameraPermissions**(): \[() => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>, () => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>\] + +Defined in: [mobile-client/src/hooks/usePermissions.ts:47](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/usePermissions.ts#L47) + +Hook for querying and requesting camera permission on the device. + +## Returns + +\[() => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>, () => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>\] + +A tuple of `[query, request]`: +- `query` – checks the current camera permission status without prompting the user. +- `request` – triggers the native permission dialog and returns the resulting status. + +## Example + +```tsx +import { useCameraPermissions } from "@fishjam-cloud/react-native-client"; +// ---cut--- +const [queryCameraPermission, requestCameraPermission] = useCameraPermissions(); + +const status = await queryCameraPermission(); +if (status !== 'granted') { + await requestCameraPermission(); +} +``` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useConnection.md b/versioned_docs/version-0.30.0/api/mobile/functions/useConnection.md new file mode 100644 index 00000000..c776f7df --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useConnection.md @@ -0,0 +1,53 @@ +# Function: useConnection() + +> **useConnection**(): `object` + +Defined in: react-client/dist/hooks/useConnection.d.ts:17 + +Hook allows to join or leave a room and check the current connection status. + +## Returns + +### joinRoom() + +> **joinRoom**: \<`PeerMetadata`\>(`__namedParameters`) => `Promise`\<`void`\> + +Join room and start streaming camera and microphone + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`JoinRoomConfig`](../interfaces/JoinRoomConfig.md)\<`PeerMetadata`\> | + +#### Returns + +`Promise`\<`void`\> + +### leaveRoom() + +> **leaveRoom**: () => `void` + +Leave room and stop streaming + +#### Returns + +`void` + +### peerStatus + +> **peerStatus**: [`PeerStatus`](../type-aliases/PeerStatus.md) + +Current peer connection status + +### reconnectionStatus + +> **reconnectionStatus**: [`ReconnectionStatus`](../type-aliases/ReconnectionStatus.md) + +Current reconnection status diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCustomAudioSource.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCustomAudioSource.md new file mode 100644 index 00000000..4556289c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCustomAudioSource.md @@ -0,0 +1,45 @@ +# Function: useCustomAudioSource() + +> **useCustomAudioSource**(`options?`): [`UseCustomAudioSourceResult`](../interfaces/UseCustomAudioSourceResult.md) + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:129](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L129) + +Publish your own audio to Fishjam. + +Creates a custom audio track, publishes it, and cleans it up — you supply +the PCM from any source (a synthesizer, a decoder, an audio pipeline) via +`pushAudioSamples`. The published track behaves like a live microphone: +pauses in pushing are fine and play as silence. It is independent of +[useMicrophone](useMicrophone.md) and does not involve the device microphone in any way — +publishing it does not trigger the recording permission. + +Remote peers receive the track with metadata type `"customAudio"` +(`usePeers` exposes it under `customAudioTracks`). + +Push PCM with `pushAudioSamples` (from `@fishjam-cloud/react-native-client`) +and the returned [track](../interfaces/UseCustomAudioSourceResult.md#track) handle — +from the JS thread or from inside a worklet, with any chunk size. The track +re-paces pushes into a continuous stream, filling gaps with silence like a +live microphone. `Float32Array` samples are expected in `[-1, 1]`; +`Int16Array` is taken as-is. + +```tsx +const { startStreaming, stopStreaming, track } = useCustomAudioSource(); + +// e.g. from react-native-audio-api's AudioRecorder: +recorder.onAudioReady({ sampleRate: 48000, bufferLength: 4800, channelCount: 1 }, + ({ buffer }) => track && pushAudioSamples(track, buffer.getChannelData(0))); +``` + +Requires the New Architecture; `startStreaming` reports an error on the old +architecture. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `options?` | [`UseCustomAudioSourceOptions`](../interfaces/UseCustomAudioSourceOptions.md) | + +## Returns + +[`UseCustomAudioSourceResult`](../interfaces/UseCustomAudioSourceResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useCustomSource.md b/versioned_docs/version-0.30.0/api/mobile/functions/useCustomSource.md new file mode 100644 index 00000000..ffef0747 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useCustomSource.md @@ -0,0 +1,39 @@ +# Function: useCustomSource() + +> **useCustomSource**\<`T`\>(`sourceId`): `object` + +Defined in: [mobile-client/src/overrides/hooks.ts:86](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L86) + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* `string` | + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `sourceId` | `T` | + +## Returns + +`object` + +### setStream() + +> **setStream**: (`newStream`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `newStream` | `null` \| [`MediaStream`](../classes/MediaStream.md) | + +#### Returns + +`Promise`\<`void`\> + +### stream + +> **stream**: `undefined` \| [`MediaStream`](../classes/MediaStream.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useDataChannel.md b/versioned_docs/version-0.30.0/api/mobile/functions/useDataChannel.md new file mode 100644 index 00000000..40bbb206 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useDataChannel.md @@ -0,0 +1,11 @@ +# Function: useDataChannel() + +> **useDataChannel**(): [`UseDataChannelResult`](../type-aliases/UseDataChannelResult.md) + +Defined in: react-client/dist/hooks/useDataChannel.d.ts:8 + +Hook for data channel operations - publish and subscribe to data. + +## Returns + +[`UseDataChannelResult`](../type-aliases/UseDataChannelResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useInitializeDevices.md b/versioned_docs/version-0.30.0/api/mobile/functions/useInitializeDevices.md new file mode 100644 index 00000000..c093c007 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useInitializeDevices.md @@ -0,0 +1,23 @@ +# Function: useInitializeDevices() + +> **useInitializeDevices**(): `object` + +Defined in: [mobile-client/src/overrides/hooks.ts:117](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L117) + +## Returns + +`object` + +### initializeDevices() + +> **initializeDevices**: (...`args`) => `Promise`\<[`InitializeDevicesResult`](../type-aliases/InitializeDevicesResult.md)\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | \[[`InitializeDevicesSettings`](../type-aliases/InitializeDevicesSettings.md)\] | + +#### Returns + +`Promise`\<[`InitializeDevicesResult`](../type-aliases/InitializeDevicesResult.md)\> diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamStreamer.md b/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamStreamer.md new file mode 100644 index 00000000..6d585e68 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamStreamer.md @@ -0,0 +1,9 @@ +# Function: useLivestreamStreamer() + +> **useLivestreamStreamer**(): [`UseLivestreamStreamerResult`](../type-aliases/UseLivestreamStreamerResult.md) + +Defined in: [mobile-client/src/overrides/hooks.ts:95](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L95) + +## Returns + +[`UseLivestreamStreamerResult`](../type-aliases/UseLivestreamStreamerResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamViewer.md b/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamViewer.md new file mode 100644 index 00000000..ed13d4c9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useLivestreamViewer.md @@ -0,0 +1,9 @@ +# Function: useLivestreamViewer() + +> **useLivestreamViewer**(): [`UseLivestreamViewerResult`](../type-aliases/UseLivestreamViewerResult.md) + +Defined in: [mobile-client/src/overrides/hooks.ts:109](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L109) + +## Returns + +[`UseLivestreamViewerResult`](../type-aliases/UseLivestreamViewerResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophone.md b/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophone.md new file mode 100644 index 00000000..8dfbc405 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophone.md @@ -0,0 +1,9 @@ +# Function: useMicrophone() + +> **useMicrophone**(): [`UseMicrophoneResult`](../type-aliases/UseMicrophoneResult.md) + +Defined in: [mobile-client/src/overrides/hooks.ts:52](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L52) + +## Returns + +[`UseMicrophoneResult`](../type-aliases/UseMicrophoneResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophonePermissions.md b/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophonePermissions.md new file mode 100644 index 00000000..bc04a77d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useMicrophonePermissions.md @@ -0,0 +1,28 @@ +# Function: useMicrophonePermissions() + +> **useMicrophonePermissions**(): \[() => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>, () => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>\] + +Defined in: [mobile-client/src/hooks/usePermissions.ts:70](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/usePermissions.ts#L70) + +Hook for querying and requesting microphone permission on the device. + +## Returns + +\[() => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>, () => `Promise`\<[`PermissionStatus`](../type-aliases/PermissionStatus.md)\>\] + +A tuple of `[query, request]`: +- `query` – checks the current microphone permission status without prompting the user. +- `request` – triggers the native permission dialog and returns the resulting status. + +## Example + +```tsx +import { useMicrophonePermissions } from "@fishjam-cloud/react-native-client"; +// ---cut--- +const [queryMicPermission, requestMicPermission] = useMicrophonePermissions(); + +const status = await queryMicPermission(); +if (status !== 'granted') { + await requestMicPermission(); +} +``` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/usePeers.md b/versioned_docs/version-0.30.0/api/mobile/functions/usePeers.md new file mode 100644 index 00000000..7d0abb39 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/usePeers.md @@ -0,0 +1,28 @@ +# Function: usePeers() + +> **usePeers**\<`P`, `S`\>(): `object` + +Defined in: [mobile-client/src/overrides/hooks.ts:126](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L126) + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `P` | `Record`\<`string`, `unknown`\> | +| `S` | `Record`\<`string`, `unknown`\> | + +## Returns + +`object` + +### localPeer + +> **localPeer**: `null` \| [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`P`, `S`\> + +### peers + +> **peers**: [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`P`, `S`, [`RemoteTrack`](../type-aliases/RemoteTrack.md)\>[] + +### remotePeers + +> **remotePeers**: [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`P`, `S`, [`RemoteTrack`](../type-aliases/RemoteTrack.md)\>[] diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useScreenShare.md b/versioned_docs/version-0.30.0/api/mobile/functions/useScreenShare.md new file mode 100644 index 00000000..b8be1942 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useScreenShare.md @@ -0,0 +1,9 @@ +# Function: useScreenShare() + +> **useScreenShare**(): [`UseScreenShareResult`](../type-aliases/UseScreenShareResult.md) + +Defined in: [mobile-client/src/overrides/hooks.ts:68](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/hooks.ts#L68) + +## Returns + +[`UseScreenShareResult`](../type-aliases/UseScreenShareResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useTelecom.md b/versioned_docs/version-0.30.0/api/mobile/functions/useTelecom.md new file mode 100644 index 00000000..a69c6a3e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useTelecom.md @@ -0,0 +1,9 @@ +# Function: useTelecom() + +> **useTelecom**(): [`UseTelecomResult`](../type-aliases/UseTelecomResult.md) + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:10 + +## Returns + +[`UseTelecomResult`](../type-aliases/UseTelecomResult.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useTelecomEvent.md b/versioned_docs/version-0.30.0/api/mobile/functions/useTelecomEvent.md new file mode 100644 index 00000000..fb73026e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useTelecomEvent.md @@ -0,0 +1,15 @@ +# Function: useTelecomEvent() + +> **useTelecomEvent**(`callback`): `void` + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:11 + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `callback` | (`event`) => `void` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/functions/useVoIP.md b/versioned_docs/version-0.30.0/api/mobile/functions/useVoIP.md new file mode 100644 index 00000000..a1fd6685 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/functions/useVoIP.md @@ -0,0 +1,14 @@ +# Function: useVoIP() + +> **useVoIP**(): [`VoIPContextValue`](../type-aliases/VoIPContextValue.md) + +Defined in: [mobile-client/src/voip/VoIPContext.ts:104](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L104) + +Returns the current [VoIPContextValue](../type-aliases/VoIPContextValue.md). + +Must be used inside a `VoIPProvider`. Without it the VoIP call machine is not +mounted and this hook throws. + +## Returns + +[`VoIPContextValue`](../type-aliases/VoIPContextValue.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/index.md b/versioned_docs/version-0.30.0/api/mobile/index.md new file mode 100644 index 00000000..0e4d4763 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/index.md @@ -0,0 +1,127 @@ +# @fishjam-cloud/react-native-client + +React Native client SDK for building mobile video and audio apps with Fishjam. + +## Connection + +- [useConnection](functions/useConnection.md) +- [useDataChannel](functions/useDataChannel.md) +- [Metadata](type-aliases/Metadata.md) +- [useUpdatePeerMetadata](variables/useUpdatePeerMetadata.md) +- [useVAD](variables/useVAD.md) + +## Other + +- [failIncomingCallConnected](functions/failIncomingCallConnected.md) +- [FishjamProvider](functions/FishjamProvider.md) +- [fulfillIncomingCallConnected](functions/fulfillIncomingCallConnected.md) +- [getPendingAnswerRequestId](functions/getPendingAnswerRequestId.md) +- [isCallHeld](functions/isCallHeld.md) +- [pushAudioSamples](functions/pushAudioSamples.md) +- [reportOutgoingCallConnected](functions/reportOutgoingCallConnected.md) +- [RTCPIPView](functions/RTCPIPView.md) +- [RTCView](functions/RTCView.md) +- [setCallHeld](functions/setCallHeld.md) +- [setCallMuted](functions/setCallMuted.md) +- [startPIP](functions/startPIP.md) +- [stopPIP](functions/stopPIP.md) +- [useAudioOutput](functions/useAudioOutput.md) +- [useCallKit](functions/useCallKit.md) +- [useCallKitEvent](functions/useCallKitEvent.md) +- [useCallKitService](functions/useCallKitService.md) +- [useCamera](functions/useCamera.md) +- [useCameraPermissions](functions/useCameraPermissions.md) +- [useCustomAudioSource](functions/useCustomAudioSource.md) +- [useCustomSource](functions/useCustomSource.md) +- [useInitializeDevices](functions/useInitializeDevices.md) +- [useLivestreamStreamer](functions/useLivestreamStreamer.md) +- [useLivestreamViewer](functions/useLivestreamViewer.md) +- [useMicrophone](functions/useMicrophone.md) +- [useMicrophonePermissions](functions/useMicrophonePermissions.md) +- [usePeers](functions/usePeers.md) +- [useScreenShare](functions/useScreenShare.md) +- [useTelecom](functions/useTelecom.md) +- [useTelecomEvent](functions/useTelecomEvent.md) +- [useVoIP](functions/useVoIP.md) +- [VoIPProvider](functions/VoIPProvider.md) +- [AudioDeviceType](enumerations/AudioDeviceType.md) +- [Variant](enumerations/Variant.md) +- [MediaStream](classes/MediaStream.md) +- [MediaStreamTrack](classes/MediaStreamTrack.md) +- [CustomAudioSink](interfaces/CustomAudioSink.md) +- [CustomAudioTrack](interfaces/CustomAudioTrack.md) +- [DataChannelOptions](interfaces/DataChannelOptions.md) +- [JoinRoomConfig](interfaces/JoinRoomConfig.md) +- [SimulcastConfig](interfaces/SimulcastConfig.md) +- [UseCustomAudioSourceOptions](interfaces/UseCustomAudioSourceOptions.md) +- [UseCustomAudioSourceResult](interfaces/UseCustomAudioSourceResult.md) +- [AudioDevice](type-aliases/AudioDevice.md) +- [AudioOutputChangedInfo](type-aliases/AudioOutputChangedInfo.md) +- [AuthErrorReason](type-aliases/AuthErrorReason.md) +- [BandwidthLimits](type-aliases/BandwidthLimits.md) +- [Brand](type-aliases/Brand.md) +- [CallEndedReason](type-aliases/CallEndedReason.md) +- [CallKitAction](type-aliases/CallKitAction.md) +- [CallKitConfig](type-aliases/CallKitConfig.md) +- [ConnectStreamerConfig](type-aliases/ConnectStreamerConfig.md) +- [ConnectViewerConfig](type-aliases/ConnectViewerConfig.md) +- [CurrentCall](type-aliases/CurrentCall.md) +- [CustomSource](type-aliases/CustomSource.md) +- [DataCallback](type-aliases/DataCallback.md) +- [DeviceError](type-aliases/DeviceError.md) +- [DeviceItem](type-aliases/DeviceItem.md) +- [FishjamProviderProps](type-aliases/FishjamProviderProps.md) +- [ForegroundServiceConfig](type-aliases/ForegroundServiceConfig.md) +- [InitializeDevicesResult](type-aliases/InitializeDevicesResult.md) +- [InitializeDevicesSettings](type-aliases/InitializeDevicesSettings.md) +- [InitializeDevicesStatus](type-aliases/InitializeDevicesStatus.md) +- [JoinErrorReason](type-aliases/JoinErrorReason.md) +- [MiddlewareResult](type-aliases/MiddlewareResult.md) +- [PeerId](type-aliases/PeerId.md) +- [PeerStatus](type-aliases/PeerStatus.md) +- [PeerWithTracks](type-aliases/PeerWithTracks.md) +- [PermissionStatus](type-aliases/PermissionStatus.md) +- [PersistLastDeviceHandlers](type-aliases/PersistLastDeviceHandlers.md) +- [ReconnectConfig](type-aliases/ReconnectConfig.md) +- [ReconnectionStatus](type-aliases/ReconnectionStatus.md) +- [RemoteTrack](type-aliases/RemoteTrack.md) +- [RoomType](type-aliases/RoomType.md) +- [RTCPIPViewProps](type-aliases/RTCPIPViewProps.md) +- [RTCVideoViewProps](type-aliases/RTCVideoViewProps.md) +- [SimulcastBandwidthLimit](type-aliases/SimulcastBandwidthLimit.md) +- [SimulcastBandwidthLimits](type-aliases/SimulcastBandwidthLimits.md) +- [StreamConfig](type-aliases/StreamConfig.md) +- [StreamerInputs](type-aliases/StreamerInputs.md) +- [TelecomConfig](type-aliases/TelecomConfig.md) +- [TelecomEvent](type-aliases/TelecomEvent.md) +- [TelecomEventType](type-aliases/TelecomEventType.md) +- [Track](type-aliases/Track.md) +- [TrackBandwidthLimit](type-aliases/TrackBandwidthLimit.md) +- [TrackFields](type-aliases/TrackFields.md) +- [TrackId](type-aliases/TrackId.md) +- [TrackMiddleware](type-aliases/TrackMiddleware.md) +- [TracksMiddleware](type-aliases/TracksMiddleware.md) +- [TracksMiddlewareResult](type-aliases/TracksMiddlewareResult.md) +- [UseAudioOutputResult](type-aliases/UseAudioOutputResult.md) +- [UseCameraResult](type-aliases/UseCameraResult.md) +- [UseCustomSourceResult](type-aliases/UseCustomSourceResult.md) +- [UseDataChannelResult](type-aliases/UseDataChannelResult.md) +- [UseInitializeDevicesParams](type-aliases/UseInitializeDevicesParams.md) +- [UseInitializeDevicesReturn](type-aliases/UseInitializeDevicesReturn.md) +- [UseLivestreamStreamerResult](type-aliases/UseLivestreamStreamerResult.md) +- [UseLivestreamViewerResult](type-aliases/UseLivestreamViewerResult.md) +- [UseMicrophoneResult](type-aliases/UseMicrophoneResult.md) +- [UseSandboxProps](type-aliases/UseSandboxProps.md) +- [UseScreenShareResult](type-aliases/UseScreenShareResult.md) +- [UseTelecomResult](type-aliases/UseTelecomResult.md) +- [VoIPCallIntent](type-aliases/VoIPCallIntent.md) +- [VoIPCallStatus](type-aliases/VoIPCallStatus.md) +- [VoIPContextValue](type-aliases/VoIPContextValue.md) +- [VoIPEventHandlers](type-aliases/VoIPEventHandlers.md) +- [VoIPIncomingPayload](type-aliases/VoIPIncomingPayload.md) +- [VoIPProviderProps](type-aliases/VoIPProviderProps.md) +- [ScreenCapturePickerView](variables/ScreenCapturePickerView.md) +- [SimulcastConfig](variables/SimulcastConfig.md) +- [useForegroundService](variables/useForegroundService.md) +- [useSandbox](variables/useSandbox.md) +- [useVoIPEvents](variables/useVoIPEvents.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioSink.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioSink.md new file mode 100644 index 00000000..037dc36e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioSink.md @@ -0,0 +1,33 @@ +# Interface: CustomAudioSink + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:39 + +The native per-track push channel handed back on a track handle's `sink`. + +Backed by a JSI host object, so it is shared *by reference* into a worklet — +calling `push` there dispatches synchronously on the worklet thread with no +hop. You normally don't call this directly; use [pushAudioSamples](../functions/pushAudioSamples.md). + +Push from the *same* worklet runtime the sink was captured into: `push` binds +lazily to whichever runtime first resolves it. Each access to `sink.push` +returns a fresh (functionally identical) function, so a hot loop should hoist +it once (`const push = track.sink.push`) and reuse it, which also skips a +small per-access allocation. + +## Methods + +### push() + +> **push**(`samples`): `void` + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:40 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `samples` | `Float32Array`\<`ArrayBufferLike`\> \| `Int16Array`\<`ArrayBufferLike`\> | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioTrack.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioTrack.md new file mode 100644 index 00000000..b95b1375 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/CustomAudioTrack.md @@ -0,0 +1,47 @@ +# Interface: CustomAudioTrack + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:47 + +Handle for a custom audio track. Plain and worklet-serializable — store it +(not the [MediaStream](../classes/MediaStream.md)) in the ref/shared value your audio-producing +code reads, and pass it to [pushAudioSamples](../functions/pushAudioSamples.md). + +## Properties + +### channelCount + +> `readonly` **channelCount**: `1` \| `2` + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:53 + +The channel count this track was created with. + +*** + +### sampleRateHz + +> `readonly` **sampleRateHz**: `number` + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:51 + +The sample rate this track was created with. + +*** + +### sink + +> `readonly` **sink**: [`CustomAudioSink`](CustomAudioSink.md) + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:55 + +Native push channel; use [pushAudioSamples](../functions/pushAudioSamples.md) rather than calling it directly. + +*** + +### trackId + +> `readonly` **trackId**: `string` + +Defined in: react-native-webrtc/lib/typescript/createCustomAudioTrack.d.ts:49 + +Id of the underlying audio track. diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/DataChannelOptions.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/DataChannelOptions.md new file mode 100644 index 00000000..3ac150b4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/DataChannelOptions.md @@ -0,0 +1,16 @@ +# Interface: DataChannelOptions + +Defined in: ts-client/dist/index.d.mts:501 + +Options for publishing or subscribing to data. + +## Properties + +### reliable + +> **reliable**: `boolean` + +Defined in: ts-client/dist/index.d.mts:506 + +If true, uses the reliable data channel (ordered, guaranteed delivery). +If false, uses the lossy data channel (unordered, low latency). diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/JoinRoomConfig.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/JoinRoomConfig.md new file mode 100644 index 00000000..60967ad1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/JoinRoomConfig.md @@ -0,0 +1,29 @@ +# Interface: JoinRoomConfig\ + +Defined in: react-client/dist/hooks/useConnection.d.ts:2 + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +## Properties + +### peerMetadata? + +> `optional` **peerMetadata**: `PeerMetadata` + +Defined in: react-client/dist/hooks/useConnection.d.ts:10 + +String indexed record with metadata, that will be available to all other peers + +*** + +### peerToken + +> **peerToken**: `string` + +Defined in: react-client/dist/hooks/useConnection.d.ts:6 + +Token received from server (or Room Manager) diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/SimulcastConfig.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/SimulcastConfig.md new file mode 100644 index 00000000..953fa22c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/SimulcastConfig.md @@ -0,0 +1,27 @@ +# Interface: SimulcastConfig + +Defined in: ts-client/dist/index.d.mts:197 + +## Properties + +### disabledVariants + +> **disabledVariants**: [`Variant`](../enumerations/Variant.md)[] + +Defined in: ts-client/dist/index.d.mts:200 + +*** + +### enabled + +> **enabled**: `boolean` + +Defined in: ts-client/dist/index.d.mts:198 + +*** + +### enabledVariants + +> **enabledVariants**: [`Variant`](../enumerations/Variant.md)[] + +Defined in: ts-client/dist/index.d.mts:199 diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceOptions.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceOptions.md new file mode 100644 index 00000000..01fe3684 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceOptions.md @@ -0,0 +1,55 @@ +# Interface: UseCustomAudioSourceOptions + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L20) + +Settings for [useCustomAudioSource](../functions/useCustomAudioSource.md), fixed for the lifetime of a +streaming session (a `startStreaming`/`stopStreaming` pair). + +## Properties + +### channelCount? + +> `optional` **channelCount**: `1` \| `2` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:37](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L37) + +`1` for mono or `2` for interleaved stereo. Defaults to `1`. + +*** + +### maxBufferedDurationMs? + +> `optional` **maxBufferedDurationMs**: `number` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:45](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L45) + +How much pushed-but-not-yet-sent audio to hold, in milliseconds, before +the oldest is dropped. The buffer drains in real time, so this is the +furthest you can push ahead — for example a long text-to-speech utterance +handed over in one call. Must be at least `10`. Defaults to `60000` (one +minute). + +*** + +### sampleRateHz? + +> `optional` **sampleRateHz**: `number` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:33](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L33) + +Sample rate of the PCM you will push, in hertz. Must be a positive +multiple of `100`. Push whatever your source produces natively — it is +resampled downstream. Defaults to `48000`. + +*** + +### sourceId? + +> `optional` **sourceId**: `string` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L27) + +Stable id identifying this custom source. Defaults to +`"customAudioSource"`. Every hook instance that streams at the same time +needs its own id — two instances sharing one silently replace each +other's published track. diff --git a/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceResult.md b/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceResult.md new file mode 100644 index 00000000..ca44cbd0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/interfaces/UseCustomAudioSourceResult.md @@ -0,0 +1,67 @@ +# Interface: UseCustomAudioSourceResult + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:48](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L48) + +## Properties + +### error + +> **error**: `null` \| `Error` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:70](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L70) + +The error that failed the last `startStreaming` or `stopStreaming` call, if any. + +*** + +### isStreaming + +> **isStreaming**: `boolean` + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:50](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L50) + +Whether the custom audio track is currently published. + +*** + +### startStreaming() + +> **startStreaming**: () => `Promise`\<`void`\> + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:64](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L64) + +Create the custom audio track and publish it. Once this resolves the +track is registered — pushed samples are streamed to the room right away +when the peer is connected, or automatically once it connects. No-op when +already streaming. + +#### Returns + +`Promise`\<`void`\> + +*** + +### stopStreaming() + +> **stopStreaming**: () => `Promise`\<`void`\> + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:68](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L68) + +Unpublish and release the custom audio track. No-op when not streaming. + +#### Returns + +`Promise`\<`void`\> + +*** + +### track + +> **track**: `null` \| [`CustomAudioTrack`](CustomAudioTrack.md) + +Defined in: [mobile-client/src/hooks/useCustomAudioSource.ts:57](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/useCustomAudioSource.ts#L57) + +Push handle for the published track; `null` until streaming starts. Hand +it to `pushAudioSamples` whenever your source produces audio. The handle +is plain and worklet-serializable, so it can be shared into a worklet and +pushed from there directly — no thread hop. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioDevice.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioDevice.md new file mode 100644 index 00000000..c949ffc1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioDevice.md @@ -0,0 +1,47 @@ +# Type Alias: AudioDevice + +> **AudioDevice** = `object` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:16 + +Describes a single audio output device. + +## Properties + +### id + +> **id**: `string` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:24 + +Unique device identifier. + +*** + +### name + +> **name**: `string` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:22 + +Human-readable device name. + +*** + +### nativeType + +> **nativeType**: `string` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:20 + +Platform-specific device type string (e.g. AVAudioSession port type on iOS). + +*** + +### type + +> **type**: [`AudioDeviceType`](../enumerations/AudioDeviceType.md) + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:18 + +Normalized device category. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioOutputChangedInfo.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioOutputChangedInfo.md new file mode 100644 index 00000000..2b62b98f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AudioOutputChangedInfo.md @@ -0,0 +1,23 @@ +# Type Alias: AudioOutputChangedInfo + +> **AudioOutputChangedInfo** = `object` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:27 + +Payload emitted when the active audio output or the list of available devices changes. + +## Properties + +### availableAudioOutputs + +> **availableAudioOutputs**: [`AudioDevice`](AudioDevice.md)[] + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:29 + +*** + +### currentAudioOutput + +> **currentAudioOutput**: [`AudioDevice`](AudioDevice.md) \| `null` + +Defined in: react-native-webrtc/lib/typescript/audioOutputManager/AudioOutputManager.d.ts:28 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/AuthErrorReason.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AuthErrorReason.md new file mode 100644 index 00000000..5ce791b0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/AuthErrorReason.md @@ -0,0 +1,5 @@ +# Type Alias: AuthErrorReason + +> **AuthErrorReason** = *typeof* `AUTH_ERROR_REASONS`\[`number`\] + +Defined in: ts-client/dist/index.d.mts:5 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/BandwidthLimits.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/BandwidthLimits.md new file mode 100644 index 00000000..e25e68b5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/BandwidthLimits.md @@ -0,0 +1,21 @@ +# Type Alias: BandwidthLimits + +> **BandwidthLimits** = `object` + +Defined in: react-client/dist/types/public.d.ts:61 + +## Properties + +### simulcast + +> **simulcast**: [`SimulcastBandwidthLimits`](SimulcastBandwidthLimits.md) + +Defined in: react-client/dist/types/public.d.ts:63 + +*** + +### singleStream + +> **singleStream**: `number` + +Defined in: react-client/dist/types/public.d.ts:62 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/Brand.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Brand.md new file mode 100644 index 00000000..a48ef923 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Brand.md @@ -0,0 +1,18 @@ +# Type Alias: Brand\ + +> **Brand**\<`T`, `TBrand`\> = `T` & `object` + +Defined in: react-client/dist/types/public.d.ts:76 + +## Type declaration + +### \[brand\] + +> **\[brand\]**: `TBrand` + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` | +| `TBrand` *extends* `string` | diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallEndedReason.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallEndedReason.md new file mode 100644 index 00000000..3504b401 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallEndedReason.md @@ -0,0 +1,19 @@ +# Type Alias: CallEndedReason + +> **CallEndedReason** = `"local"` \| `"rejected"` \| `"missed"` \| `"remote"` \| `"answeredElsewhere"` \| `"failed"` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:28 + +Cross-platform reason a call ended, surfaced from both Telecom (Android) and +CallKit (iOS): +- `local` — this device hung up (or the system CallKit UI's End/Decline, which + iOS can't distinguish from a plain hang-up). +- `rejected` — the callee actively declined a ringing incoming call (Android only + — CallKit has no ended-reason case for a local decline, so on iOS this also + surfaces as `local`). +- `missed` — an incoming call rang and was never answered, including the native + ring timeout (default 45 seconds), or an Android outgoing call did not connect + before its native timeout (default 60 seconds). +- `remote` — the other party ended the call. +- `answeredElsewhere` — answered on another of the user's devices while ringing. +- `failed` — call setup (e.g. room join) failed. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitAction.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitAction.md new file mode 100644 index 00000000..9554a577 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitAction.md @@ -0,0 +1,53 @@ +# Type Alias: CallKitAction + +> **CallKitAction** = `object` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:14 + +## Properties + +### answer? + +> `optional` **answer**: `string` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:16 + +*** + +### ended? + +> `optional` **ended**: [`CallEndedReason`](CallEndedReason.md) + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:17 + +*** + +### failed? + +> `optional` **failed**: `string` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:18 + +*** + +### held? + +> `optional` **held**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:20 + +*** + +### muted? + +> `optional` **muted**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:19 + +*** + +### started? + +> `optional` **started**: `undefined` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:15 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitConfig.md new file mode 100644 index 00000000..53ab9df9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CallKitConfig.md @@ -0,0 +1,36 @@ +# Type Alias: CallKitConfig + +> **CallKitConfig** = `object` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:2 + +## Properties + +### displayName + +> **displayName**: `string` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:4 + +Label shown in the system call UI and in Recents. + +*** + +### handle? + +> `optional` **handle**: `string` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:11 + +Stable identifier for the remote party (e.g. a user id). It is what iOS persists +in Recents and hands back in the redial intent, so it must be something your app +can resolve - `displayName` alone is ambiguous when two users share a name. +Defaults to `displayName`. + +*** + +### isVideo + +> **isVideo**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/CallKit.d.ts:12 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectStreamerConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectStreamerConfig.md new file mode 100644 index 00000000..c53b7b9a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectStreamerConfig.md @@ -0,0 +1,21 @@ +# Type Alias: ConnectStreamerConfig + +> **ConnectStreamerConfig** = `object` + +Defined in: [mobile-client/src/overrides/types.ts:25](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L25) + +## Properties + +### inputs + +> **inputs**: [`StreamerInputs`](StreamerInputs.md) + +Defined in: [mobile-client/src/overrides/types.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L26) + +*** + +### token + +> **token**: `string` + +Defined in: [mobile-client/src/overrides/types.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L27) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectViewerConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectViewerConfig.md new file mode 100644 index 00000000..91e87fed --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ConnectViewerConfig.md @@ -0,0 +1,5 @@ +# Type Alias: ConnectViewerConfig + +> **ConnectViewerConfig** = \{ `streamId?`: `never`; `token`: `string`; \} \| \{ `streamId`: `string`; `token?`: `never`; \} + +Defined in: react-client/dist/hooks/useLivestreamViewer.d.ts:2 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/CurrentCall.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CurrentCall.md new file mode 100644 index 00000000..027be3fd --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CurrentCall.md @@ -0,0 +1,69 @@ +# Type Alias: CurrentCall + +> **CurrentCall** = `object` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:17](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L17) + +Details of the call currently being handled. + +## Properties + +### displayName + +> **displayName**: `string` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L24) + +Name shown in the CallKit UI (the remote party). + +*** + +### handle + +> **handle**: `string` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L29) + +Stable id of the remote party — use a durable user id, not a display name (which +may not be unique), since this is what Recents hands back for redialing. + +*** + +### isOutgoing + +> **isOutgoing**: `boolean` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L35) + +`true` when this device initiated the call, `false` when receiving it. + +*** + +### isVideo + +> **isVideo**: `boolean` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L31) + +Whether the call is a video call. + +*** + +### roomName + +> **roomName**: `string` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L22) + +Fishjam room the call takes place in. For outgoing calls it is the name passed to +`startCall`; for incoming ones it comes from the VoIP push payload. + +*** + +### startedAt + +> **startedAt**: `number` \| `null` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:33](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L33) + +Timestamp (ms) when the call became `active`, or `null` if not yet connected. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/CustomSource.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CustomSource.md new file mode 100644 index 00000000..6a94fafb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/CustomSource.md @@ -0,0 +1,17 @@ +# Type Alias: CustomSource\ + +> **CustomSource**\<`T`\> = `Omit`\<`ReactClientCustomSource`\<`T`\>, `"stream"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:121](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L121) + +## Type declaration + +### stream? + +> `optional` **stream**: [`MediaStream`](../classes/MediaStream.md) + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* `string` | diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/DataCallback.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DataCallback.md new file mode 100644 index 00000000..2625caca --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DataCallback.md @@ -0,0 +1,17 @@ +# Type Alias: DataCallback() + +> **DataCallback** = (`data`) => `void` + +Defined in: ts-client/dist/index.d.mts:512 + +Callback type for receiving data from a data channel. + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `data` | `Uint8Array` | The received data as a Uint8Array | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceError.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceError.md new file mode 100644 index 00000000..3e703193 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceError.md @@ -0,0 +1,5 @@ +# Type Alias: DeviceError + +> **DeviceError** = \{ `name`: `"OverconstrainedError"`; \} \| \{ `name`: `"NotAllowedError"`; \} \| \{ `name`: `"NotFoundError"`; \} \| \{ `name`: `"UNHANDLED_ERROR"`; \} + +Defined in: react-client/dist/types/public.d.ts:66 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceItem.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceItem.md new file mode 100644 index 00000000..4cfe34c6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/DeviceItem.md @@ -0,0 +1,21 @@ +# Type Alias: DeviceItem + +> **DeviceItem** = `object` + +Defined in: react-client/dist/types/public.d.ts:45 + +## Properties + +### deviceId + +> **deviceId**: `string` + +Defined in: react-client/dist/types/public.d.ts:46 + +*** + +### label + +> **label**: `string` + +Defined in: react-client/dist/types/public.d.ts:47 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/FishjamProviderProps.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/FishjamProviderProps.md new file mode 100644 index 00000000..50538942 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/FishjamProviderProps.md @@ -0,0 +1,5 @@ +# Type Alias: FishjamProviderProps + +> **FishjamProviderProps** = `Omit`\<`ReactClientFishjamProviderProps`, `"persistLastDevice"` \| `"fishjamClient"`\> + +Defined in: [mobile-client/src/index.ts:151](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/index.ts#L151) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/ForegroundServiceConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ForegroundServiceConfig.md new file mode 100644 index 00000000..d28fd22d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ForegroundServiceConfig.md @@ -0,0 +1,79 @@ +# Type Alias: ForegroundServiceConfig + +> **ForegroundServiceConfig** = `object` + +Defined in: [mobile-client/src/useForegroundService.ts:8](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L8) + +Configuration options for foreground service permissions. + +A type representing the configuration for foreground service permissions. + +## Properties + +### channelId? + +> `optional` **channelId**: `string` + +Defined in: [mobile-client/src/useForegroundService.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L24) + +The id of the channel. Must be unique per package. + +*** + +### channelName? + +> `optional` **channelName**: `string` + +Defined in: [mobile-client/src/useForegroundService.ts:28](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L28) + +The user visible name of the channel. + +*** + +### enableCamera? + +> `optional` **enableCamera**: `boolean` + +Defined in: [mobile-client/src/useForegroundService.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L12) + +Indicates whether the camera is enabled for the foreground service. + +*** + +### enableMicrophone? + +> `optional` **enableMicrophone**: `boolean` + +Defined in: [mobile-client/src/useForegroundService.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L16) + +Indicates whether the microphone is enabled for the foreground service. + +*** + +### enableScreenSharing? + +> `optional` **enableScreenSharing**: `boolean` + +Defined in: [mobile-client/src/useForegroundService.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L20) + +Indicates whether screen sharing is enabled for the foreground service. + +*** + +### notificationContent? + +> `optional` **notificationContent**: `string` + +Defined in: [mobile-client/src/useForegroundService.ts:36](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L36) + +The text (second row) of the notification, in a standard notification. + +*** + +### notificationTitle? + +> `optional` **notificationTitle**: `string` + +Defined in: [mobile-client/src/useForegroundService.ts:32](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L32) + +The title (first row) of the notification, in a standard notification. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesResult.md new file mode 100644 index 00000000..da6655f0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesResult.md @@ -0,0 +1,11 @@ +# Type Alias: InitializeDevicesResult + +> **InitializeDevicesResult** = `Omit`\<`ReactClientInitializeDevicesResult`, `"stream"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:123](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L123) + +## Type declaration + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `null` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesSettings.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesSettings.md new file mode 100644 index 00000000..da51ce39 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesSettings.md @@ -0,0 +1,21 @@ +# Type Alias: InitializeDevicesSettings + +> **InitializeDevicesSettings** = `object` + +Defined in: react-client/dist/hooks/internal/devices/useMediaDevices.d.ts:9 + +## Properties + +### enableAudio? + +> `optional` **enableAudio**: `boolean` + +Defined in: react-client/dist/hooks/internal/devices/useMediaDevices.d.ts:11 + +*** + +### enableVideo? + +> `optional` **enableVideo**: `boolean` + +Defined in: react-client/dist/hooks/internal/devices/useMediaDevices.d.ts:10 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesStatus.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesStatus.md new file mode 100644 index 00000000..fa077641 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/InitializeDevicesStatus.md @@ -0,0 +1,5 @@ +# Type Alias: InitializeDevicesStatus + +> **InitializeDevicesStatus** = `"initialized"` \| `"failed"` \| `"initialized_with_errors"` \| `"already_initialized"` + +Defined in: react-client/dist/types/public.d.ts:2 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/JoinErrorReason.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/JoinErrorReason.md new file mode 100644 index 00000000..16f20741 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/JoinErrorReason.md @@ -0,0 +1,5 @@ +# Type Alias: JoinErrorReason + +> **JoinErrorReason** = *typeof* `JOIN_ERRORS`\[`number`\] + +Defined in: ts-client/dist/index.d.mts:941 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/Metadata.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Metadata.md new file mode 100644 index 00000000..956ea26c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Metadata.md @@ -0,0 +1,28 @@ +# Type Alias: Metadata\ + +> **Metadata**\<`PeerMetadata`, `ServerMetadata`\> = `object` + +Defined in: ts-client/dist/index.d.mts:972 + +## Type Parameters + +| Type Parameter | Default type | Description | +| ------ | ------ | ------ | +| `PeerMetadata` | `GenericMetadata` | Type of metadata set by peer while connecting to a room. | +| `ServerMetadata` | `GenericMetadata` | Type of metadata set by the server while creating a peer. | + +## Properties + +### peer + +> **peer**: `PeerMetadata` + +Defined in: ts-client/dist/index.d.mts:973 + +*** + +### server + +> **server**: `ServerMetadata` + +Defined in: ts-client/dist/index.d.mts:974 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/MiddlewareResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/MiddlewareResult.md new file mode 100644 index 00000000..db647cae --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/MiddlewareResult.md @@ -0,0 +1,25 @@ +# Type Alias: MiddlewareResult + +> **MiddlewareResult** = `object` + +Defined in: [mobile-client/src/overrides/types.ts:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L38) + +## Properties + +### onClear()? + +> `optional` **onClear**: () => `void` + +Defined in: [mobile-client/src/overrides/types.ts:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L38) + +#### Returns + +`void` + +*** + +### track + +> **track**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) + +Defined in: [mobile-client/src/overrides/types.ts:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L38) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerId.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerId.md new file mode 100644 index 00000000..c8a05ca1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerId.md @@ -0,0 +1,5 @@ +# Type Alias: PeerId + +> **PeerId** = [`Brand`](Brand.md)\<`string`, `"PeerId"`\> + +Defined in: react-client/dist/types/public.d.ts:12 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerStatus.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerStatus.md new file mode 100644 index 00000000..f5b58918 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerStatus.md @@ -0,0 +1,12 @@ +# Type Alias: PeerStatus + +> **PeerStatus** = `"connecting"` \| `"connected"` \| `"error"` \| `"idle"` + +Defined in: react-client/dist/types/public.d.ts:44 + +Represents the possible statuses of a peer connection. + +- `idle` - Peer is not connected, either never connected or successfully disconnected. +- `connecting` - Peer is in the process of connecting. +- `connected` - Peer has successfully connected. +- `error` - There was an error in the connection process. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerWithTracks.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerWithTracks.md new file mode 100644 index 00000000..4fa74f9c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PeerWithTracks.md @@ -0,0 +1,43 @@ +# Type Alias: PeerWithTracks\ + +> **PeerWithTracks**\<`P`, `S`, `T`\> = `Omit`\<`ReactClientPeerWithTracks`\<`P`, `S`\>, [`TrackFields`](TrackFields.md)\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:136](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L136) + +## Type declaration + +### cameraTrack? + +> `optional` **cameraTrack**: `T` + +### customAudioTracks + +> **customAudioTracks**: `T`[] + +### customVideoTracks + +> **customVideoTracks**: `T`[] + +### microphoneTrack? + +> `optional` **microphoneTrack**: `T` + +### screenShareAudioTrack? + +> `optional` **screenShareAudioTrack**: `T` + +### screenShareVideoTrack? + +> `optional` **screenShareVideoTrack**: `T` + +### tracks + +> **tracks**: `T`[] + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `P` | - | +| `S` | - | +| `T` *extends* [`Track`](Track.md) | [`Track`](Track.md) | diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/PermissionStatus.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PermissionStatus.md new file mode 100644 index 00000000..78e49c6a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PermissionStatus.md @@ -0,0 +1,11 @@ +# Type Alias: PermissionStatus + +> **PermissionStatus** = `"granted"` \| `"denied"` \| `"prompt"` + +Defined in: [mobile-client/src/hooks/usePermissions.ts:11](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/hooks/usePermissions.ts#L11) + +The current status of a device permission. + +- `'granted'` – the user has granted the permission. +- `'denied'` – the user has denied the permission. +- `'prompt'` – the user has not yet been asked (or the permission can be requested again). diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/PersistLastDeviceHandlers.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PersistLastDeviceHandlers.md new file mode 100644 index 00000000..6dbc4c87 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/PersistLastDeviceHandlers.md @@ -0,0 +1,42 @@ +# Type Alias: PersistLastDeviceHandlers + +> **PersistLastDeviceHandlers** = `object` + +Defined in: react-client/dist/types/public.d.ts:49 + +## Properties + +### getLastDevice() + +> **getLastDevice**: (`deviceType`) => `MediaDeviceInfo` \| `null` + +Defined in: react-client/dist/types/public.d.ts:50 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceType` | `"audio"` \| `"video"` | + +#### Returns + +`MediaDeviceInfo` \| `null` + +*** + +### saveLastDevice() + +> **saveLastDevice**: (`info`, `deviceType`) => `void` + +Defined in: react-client/dist/types/public.d.ts:51 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | `MediaDeviceInfo` | +| `deviceType` | `"audio"` \| `"video"` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCPIPViewProps.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCPIPViewProps.md new file mode 100644 index 00000000..c6e2a6f5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCPIPViewProps.md @@ -0,0 +1,11 @@ +# Type Alias: RTCPIPViewProps + +> **RTCPIPViewProps** = `Omit`\<`React.ComponentPropsWithRef`\<*typeof* `OriginalRTCPIPView`\>, `"streamURL"`\> & `object` + +Defined in: [mobile-client/src/overrides/RTCView.tsx:10](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/RTCView.tsx#L10) + +## Type declaration + +### mediaStream + +> **mediaStream**: [`MediaStream`](../classes/MediaStream.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCVideoViewProps.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCVideoViewProps.md new file mode 100644 index 00000000..7ac0ecf2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RTCVideoViewProps.md @@ -0,0 +1,11 @@ +# Type Alias: RTCVideoViewProps + +> **RTCVideoViewProps** = `Omit`\<`React.ComponentPropsWithRef`\<*typeof* `OriginalRTCView`\>, `"streamURL"`\> & `object` + +Defined in: [mobile-client/src/overrides/RTCView.tsx:6](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/RTCView.tsx#L6) + +## Type declaration + +### mediaStream + +> **mediaStream**: [`MediaStream`](../classes/MediaStream.md) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectConfig.md new file mode 100644 index 00000000..ef54d500 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectConfig.md @@ -0,0 +1,37 @@ +# Type Alias: ReconnectConfig + +> **ReconnectConfig** = `object` + +Defined in: ts-client/dist/index.d.mts:945 + +## Properties + +### addTracksOnReconnect? + +> `optional` **addTracksOnReconnect**: `boolean` + +Defined in: ts-client/dist/index.d.mts:949 + +*** + +### delay? + +> `optional` **delay**: `number` + +Defined in: ts-client/dist/index.d.mts:948 + +*** + +### initialDelay? + +> `optional` **initialDelay**: `number` + +Defined in: ts-client/dist/index.d.mts:947 + +*** + +### maxAttempts? + +> `optional` **maxAttempts**: `number` + +Defined in: ts-client/dist/index.d.mts:946 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectionStatus.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectionStatus.md new file mode 100644 index 00000000..344a388a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/ReconnectionStatus.md @@ -0,0 +1,5 @@ +# Type Alias: ReconnectionStatus + +> **ReconnectionStatus** = `"reconnecting"` \| `"idle"` \| `"error"` + +Defined in: ts-client/dist/index.d.mts:944 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/RemoteTrack.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RemoteTrack.md new file mode 100644 index 00000000..a98ff97b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RemoteTrack.md @@ -0,0 +1,15 @@ +# Type Alias: RemoteTrack + +> **RemoteTrack** = `Omit`\<`ReactClientRemoteTrack`, `"stream"` \| `"track"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:116](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L116) + +## Type declaration + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `null` + +### track + +> **track**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/RoomType.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RoomType.md new file mode 100644 index 00000000..8cd16cdb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/RoomType.md @@ -0,0 +1,5 @@ +# Type Alias: RoomType + +> **RoomType** = `"conference"` \| `"livestream"` \| `"audio_only"` + +Defined in: react-client/dist/hooks/useSandbox.d.ts:8 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimit.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimit.md new file mode 100644 index 00000000..91b20381 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimit.md @@ -0,0 +1,9 @@ +# Type Alias: SimulcastBandwidthLimit + +> **SimulcastBandwidthLimit** = `Map`\<[`Variant`](../enumerations/Variant.md), `BandwidthLimit`\> + +Defined in: ts-client/dist/index.d.mts:252 + +Type describing bandwidth limit for simulcast track. +It is a mapping (encoding => BandwidthLimit). +If encoding isn't present in this mapping, it will be assumed that this particular encoding shouldn't have any bandwidth limit diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimits.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimits.md new file mode 100644 index 00000000..1e3c36b4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/SimulcastBandwidthLimits.md @@ -0,0 +1,29 @@ +# Type Alias: SimulcastBandwidthLimits + +> **SimulcastBandwidthLimits** = `object` + +Defined in: react-client/dist/types/public.d.ts:53 + +## Properties + +### 1 + +> **1**: `number` + +Defined in: react-client/dist/types/public.d.ts:54 + +*** + +### 2 + +> **2**: `number` + +Defined in: react-client/dist/types/public.d.ts:55 + +*** + +### 3 + +> **3**: `number` + +Defined in: react-client/dist/types/public.d.ts:56 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamConfig.md new file mode 100644 index 00000000..b569d289 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamConfig.md @@ -0,0 +1,13 @@ +# Type Alias: StreamConfig + +> **StreamConfig** = `object` + +Defined in: react-client/dist/types/public.d.ts:58 + +## Properties + +### sentQualities? + +> `optional` **sentQualities**: [`Variant`](../enumerations/Variant.md)[] \| `false` + +Defined in: react-client/dist/types/public.d.ts:59 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamerInputs.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamerInputs.md new file mode 100644 index 00000000..f620c874 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/StreamerInputs.md @@ -0,0 +1,5 @@ +# Type Alias: StreamerInputs + +> **StreamerInputs** = \{ `audio?`: [`MediaStream`](../classes/MediaStream.md) \| `null`; `video`: [`MediaStream`](../classes/MediaStream.md); \} \| \{ `audio`: [`MediaStream`](../classes/MediaStream.md); `video?`: `null`; \} + +Defined in: [mobile-client/src/overrides/types.ts:21](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L21) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomConfig.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomConfig.md new file mode 100644 index 00000000..04356491 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomConfig.md @@ -0,0 +1,35 @@ +# Type Alias: TelecomConfig + +> **TelecomConfig** = `object` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:1 + +## Properties + +### displayName + +> **displayName**: `string` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:3 + +Label shown in the system call UI and in the call log. + +*** + +### handle? + +> `optional` **handle**: `string` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:9 + +Stable identifier for the remote party (e.g. a user id), used as the call's Telecom +address. Unlike iOS there is no redial-from-Recents path on Android today, so this is +identity only - it is not handed back to the app. Defaults to `displayName`. + +*** + +### isVideo + +> **isVideo**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:10 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEvent.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEvent.md new file mode 100644 index 00000000..3023c966 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEvent.md @@ -0,0 +1,45 @@ +# Type Alias: TelecomEvent + +> **TelecomEvent** = `object` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:29 + +## Properties + +### event + +> **event**: [`TelecomEventType`](TelecomEventType.md) + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:30 + +*** + +### held? + +> `optional` **held**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:34 + +*** + +### muted? + +> `optional` **muted**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:33 + +*** + +### reason? + +> `optional` **reason**: [`CallEndedReason`](CallEndedReason.md) \| `string` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:32 + +*** + +### requestId? + +> `optional` **requestId**: `string` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:31 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEventType.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEventType.md new file mode 100644 index 00000000..141035c9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TelecomEventType.md @@ -0,0 +1,5 @@ +# Type Alias: TelecomEventType + +> **TelecomEventType** = `"started"` \| `"answer"` \| `"ended"` \| `"failed"` \| `"muteChanged"` \| `"holdChanged"` + +Defined in: react-native-webrtc/lib/typescript/Telecom.d.ts:12 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/Track.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Track.md new file mode 100644 index 00000000..14ecdb5b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/Track.md @@ -0,0 +1,15 @@ +# Type Alias: Track + +> **Track** = `Omit`\<`ReactClientTrack`, `"stream"` \| `"track"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:111](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L111) + +## Type declaration + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `null` + +### track + +> **track**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackBandwidthLimit.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackBandwidthLimit.md new file mode 100644 index 00000000..8ae1c104 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackBandwidthLimit.md @@ -0,0 +1,8 @@ +# Type Alias: TrackBandwidthLimit + +> **TrackBandwidthLimit** = `BandwidthLimit` \| [`SimulcastBandwidthLimit`](SimulcastBandwidthLimit.md) + +Defined in: ts-client/dist/index.d.mts:257 + +Type describing bandwidth limitation of a Track, including simulcast and non-simulcast tracks. +A sum type of `BandwidthLimit` and `SimulcastBandwidthLimit` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackFields.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackFields.md new file mode 100644 index 00000000..1fd9061e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackFields.md @@ -0,0 +1,5 @@ +# Type Alias: TrackFields + +> **TrackFields** = `"tracks"` \| `"cameraTrack"` \| `"microphoneTrack"` \| `"screenShareVideoTrack"` \| `"screenShareAudioTrack"` \| `"customVideoTracks"` \| `"customAudioTracks"` + +Defined in: [mobile-client/src/overrides/types.ts:127](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L127) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackId.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackId.md new file mode 100644 index 00000000..dfd76da0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackId.md @@ -0,0 +1,5 @@ +# Type Alias: TrackId + +> **TrackId** = [`Brand`](Brand.md)\<`string`, `"TrackId"`\> + +Defined in: react-client/dist/types/public.d.ts:11 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackMiddleware.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackMiddleware.md new file mode 100644 index 00000000..e2365627 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TrackMiddleware.md @@ -0,0 +1,5 @@ +# Type Alias: TrackMiddleware + +> **TrackMiddleware** = (`track`) => [`MiddlewareResult`](MiddlewareResult.md) \| `Promise`\<[`MiddlewareResult`](MiddlewareResult.md)\> \| `null` + +Defined in: [mobile-client/src/overrides/types.ts:40](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L40) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddleware.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddleware.md new file mode 100644 index 00000000..672858d1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddleware.md @@ -0,0 +1,16 @@ +# Type Alias: TracksMiddleware() + +> **TracksMiddleware** = (`videoTrack`, `audioTrack`) => [`TracksMiddlewareResult`](TracksMiddlewareResult.md) \| `Promise`\<[`TracksMiddlewareResult`](TracksMiddlewareResult.md)\> + +Defined in: [mobile-client/src/overrides/types.ts:48](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L48) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `videoTrack` | [`MediaStreamTrack`](../classes/MediaStreamTrack.md) | +| `audioTrack` | [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` | + +## Returns + +[`TracksMiddlewareResult`](TracksMiddlewareResult.md) \| `Promise`\<[`TracksMiddlewareResult`](TracksMiddlewareResult.md)\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddlewareResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddlewareResult.md new file mode 100644 index 00000000..5ca32736 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/TracksMiddlewareResult.md @@ -0,0 +1,33 @@ +# Type Alias: TracksMiddlewareResult + +> **TracksMiddlewareResult** = `object` + +Defined in: [mobile-client/src/overrides/types.ts:42](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L42) + +## Properties + +### audioTrack + +> **audioTrack**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` + +Defined in: [mobile-client/src/overrides/types.ts:44](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L44) + +*** + +### onClear() + +> **onClear**: () => `void` + +Defined in: [mobile-client/src/overrides/types.ts:45](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L45) + +#### Returns + +`void` + +*** + +### videoTrack + +> **videoTrack**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) + +Defined in: [mobile-client/src/overrides/types.ts:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L43) diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseAudioOutputResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseAudioOutputResult.md new file mode 100644 index 00000000..93785d4d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseAudioOutputResult.md @@ -0,0 +1,45 @@ +# Type Alias: UseAudioOutputResult + +> **UseAudioOutputResult** = `object` + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:2 + +## Properties + +### android + +> **android**: *typeof* `AudioOutputManager.android` + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:10 + +Android-only controls. Throws on other platforms. + +*** + +### availableAudioOutputs + +> **availableAudioOutputs**: [`AudioDevice`](AudioDevice.md)[] + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:6 + +All output devices currently reachable. + +*** + +### currentAudioOutput + +> **currentAudioOutput**: [`AudioDevice`](AudioDevice.md) \| `null` + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:4 + +Active output device, or `null` if not yet known. + +*** + +### ios + +> **ios**: *typeof* `AudioOutputManager.ios` + +Defined in: react-native-webrtc/lib/typescript/useAudioOutput.d.ts:8 + +iOS-only controls. Throws on other platforms. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCameraResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCameraResult.md new file mode 100644 index 00000000..40764473 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCameraResult.md @@ -0,0 +1,43 @@ +# Type Alias: UseCameraResult + +> **UseCameraResult** = `Omit`\<`ReturnType`\<*typeof* `useCameraReactClient`\>, `"cameraStream"` \| `"startCamera"` \| `"currentCameraMiddleware"` \| `"setCameraTrackMiddleware"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:53](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L53) + +## Type declaration + +### cameraStream + +> **cameraStream**: [`MediaStream`](../classes/MediaStream.md) \| `null` + +### currentCameraMiddleware + +> **currentCameraMiddleware**: [`TrackMiddleware`](TrackMiddleware.md) + +### setCameraTrackMiddleware() + +> **setCameraTrackMiddleware**: (`middleware`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `middleware` | [`TrackMiddleware`](TrackMiddleware.md) | + +#### Returns + +`Promise`\<`void`\> + +### startCamera() + +> **startCamera**: (...`args`) => `Promise`\<\[[`MediaStreamTrack`](../classes/MediaStreamTrack.md), `null`\] \| \[`null`, [`DeviceError`](DeviceError.md)\]\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | `Parameters`\<`ReturnType`\<*typeof* `useCameraReactClient`\>\[`"startCamera"`\]\> | + +#### Returns + +`Promise`\<\[[`MediaStreamTrack`](../classes/MediaStreamTrack.md), `null`\] \| \[`null`, [`DeviceError`](DeviceError.md)\]\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCustomSourceResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCustomSourceResult.md new file mode 100644 index 00000000..6f693d5f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseCustomSourceResult.md @@ -0,0 +1,25 @@ +# Type Alias: UseCustomSourceResult + +> **UseCustomSourceResult** = `Omit`\<`ReturnType`\<*typeof* `useCustomSourceReactClient`\>, `"stream"` \| `"setStream"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:100](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L100) + +## Type declaration + +### setStream() + +> **setStream**: (`newStream`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `newStream` | [`MediaStream`](../classes/MediaStream.md) \| `null` | + +#### Returns + +`Promise`\<`void`\> + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `undefined` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseDataChannelResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseDataChannelResult.md new file mode 100644 index 00000000..5eb4e0d1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseDataChannelResult.md @@ -0,0 +1,101 @@ +# Type Alias: UseDataChannelResult + +> **UseDataChannelResult** = `object` + +Defined in: react-client/dist/types/public.d.ts:87 + +## Properties + +### dataChannelError + +> **dataChannelError**: `Error` \| `null` + +Defined in: react-client/dist/types/public.d.ts:120 + +Error that occurred during data publisher operations, or null if no error. + +*** + +### dataChannelLoading + +> **dataChannelLoading**: `boolean` + +Defined in: react-client/dist/types/public.d.ts:116 + +Whether data channels are being initialized. + +*** + +### dataChannelReady + +> **dataChannelReady**: `boolean` + +Defined in: react-client/dist/types/public.d.ts:112 + +Whether data channels are connected and ready to send data. +Resets to false on disconnect. + +*** + +### initializeDataChannel() + +> **initializeDataChannel**: () => `void` + +Defined in: react-client/dist/types/public.d.ts:93 + +Initializes the data channel. + +Requires that the fishjam client is already connected. + +#### Returns + +`void` + +*** + +### publishData() + +> **publishData**: (`payload`, `options`) => `void` + +Defined in: react-client/dist/types/public.d.ts:99 + +Sends binary data through a data channel. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `payload` | `Uint8Array` | The Uint8Array payload to send (first positional argument) | +| `options` | [`DataChannelOptions`](../interfaces/DataChannelOptions.md) | Data channel options; specify `reliable: true` for guaranteed delivery or `reliable: false` for low latency | + +#### Returns + +`void` + +*** + +### subscribeData() + +> **subscribeData**: (`callback`, `options`) => () => `void` + +Defined in: react-client/dist/types/public.d.ts:107 + +Subscribe to incoming data on a data channel. +Can be called before or after channel creation. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | [`DataCallback`](DataCallback.md) | Function called when data is received | +| `options` | [`DataChannelOptions`](../interfaces/DataChannelOptions.md) | Specify `reliable: true` or `reliable: false` to choose channel | + +#### Returns + +Unsubscribe function - call to cancel the subscription + +> (): `void` + +##### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesParams.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesParams.md new file mode 100644 index 00000000..e862ab06 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesParams.md @@ -0,0 +1,21 @@ +# Type Alias: UseInitializeDevicesParams + +> **UseInitializeDevicesParams** = `object` + +Defined in: react-client/dist/hooks/devices/useInitializeDevices.d.ts:1 + +## Properties + +### enableAudio? + +> `optional` **enableAudio**: `boolean` + +Defined in: react-client/dist/hooks/devices/useInitializeDevices.d.ts:3 + +*** + +### enableVideo? + +> `optional` **enableVideo**: `boolean` + +Defined in: react-client/dist/hooks/devices/useInitializeDevices.d.ts:2 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesReturn.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesReturn.md new file mode 100644 index 00000000..81dda62c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseInitializeDevicesReturn.md @@ -0,0 +1,23 @@ +# Type Alias: UseInitializeDevicesReturn + +> **UseInitializeDevicesReturn** = `object` + +Defined in: [mobile-client/src/overrides/types.ts:105](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L105) + +## Properties + +### initializeDevices() + +> **initializeDevices**: (...`args`) => `Promise`\<[`InitializeDevicesResult`](InitializeDevicesResult.md)\> + +Defined in: [mobile-client/src/overrides/types.ts:106](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L106) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | `Parameters`\<`ReturnType`\<*typeof* `useInitializeDevicesReactClient`\>\[`"initializeDevices"`\]\> | + +#### Returns + +`Promise`\<[`InitializeDevicesResult`](InitializeDevicesResult.md)\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamStreamerResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamStreamerResult.md new file mode 100644 index 00000000..12f97a58 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamStreamerResult.md @@ -0,0 +1,22 @@ +# Type Alias: UseLivestreamStreamerResult + +> **UseLivestreamStreamerResult** = `Omit`\<`ReactClientUseLivestreamStreamerResult`, `"connect"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:30](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L30) + +## Type declaration + +### connect() + +> **connect**: (`config`, `urlOverride?`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`ConnectStreamerConfig`](ConnectStreamerConfig.md) | +| `urlOverride?` | `string` | + +#### Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamViewerResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamViewerResult.md new file mode 100644 index 00000000..2a67afa6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseLivestreamViewerResult.md @@ -0,0 +1,11 @@ +# Type Alias: UseLivestreamViewerResult + +> **UseLivestreamViewerResult** = `Omit`\<`ReactClientUseLivestreamViewerResult`, `"stream"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:34](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L34) + +## Type declaration + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `null` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseMicrophoneResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseMicrophoneResult.md new file mode 100644 index 00000000..965da2a8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseMicrophoneResult.md @@ -0,0 +1,43 @@ +# Type Alias: UseMicrophoneResult + +> **UseMicrophoneResult** = `Omit`\<`ReturnType`\<*typeof* `useMicrophoneReactClient`\>, `"toggleMicrophoneMute"` \| `"microphoneStream"` \| `"startMicrophone"` \| `"currentMicrophoneMiddleware"` \| `"setMicrophoneTrackMiddleware"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:65](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L65) + +## Type declaration + +### currentMicrophoneMiddleware + +> **currentMicrophoneMiddleware**: [`TrackMiddleware`](TrackMiddleware.md) + +### microphoneStream + +> **microphoneStream**: [`MediaStream`](../classes/MediaStream.md) \| `null` + +### setMicrophoneTrackMiddleware() + +> **setMicrophoneTrackMiddleware**: (`middleware`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `middleware` | [`TrackMiddleware`](TrackMiddleware.md) | + +#### Returns + +`Promise`\<`void`\> + +### startMicrophone() + +> **startMicrophone**: (...`args`) => `Promise`\<\[[`MediaStreamTrack`](../classes/MediaStreamTrack.md), `null`\] \| \[`null`, [`DeviceError`](DeviceError.md)\]\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| ...`args` | `Parameters`\<`ReturnType`\<*typeof* `useMicrophoneReactClient`\>\[`"startMicrophone"`\]\> | + +#### Returns + +`Promise`\<\[[`MediaStreamTrack`](../classes/MediaStreamTrack.md), `null`\] \| \[`null`, [`DeviceError`](DeviceError.md)\]\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseSandboxProps.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseSandboxProps.md new file mode 100644 index 00000000..73cb75a0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseSandboxProps.md @@ -0,0 +1,13 @@ +# Type Alias: UseSandboxProps + +> **UseSandboxProps** = `object` + +Defined in: react-client/dist/hooks/useSandbox.d.ts:5 + +## Properties + +### sandboxApiUrl + +> **sandboxApiUrl**: `string` + +Defined in: react-client/dist/hooks/useSandbox.d.ts:6 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseScreenShareResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseScreenShareResult.md new file mode 100644 index 00000000..8dfa6447 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseScreenShareResult.md @@ -0,0 +1,51 @@ +# Type Alias: UseScreenShareResult + +> **UseScreenShareResult** = `Omit`\<`ReturnType`\<*typeof* `useScreenShareReactClient`\>, `"stream"` \| `"videoTrack"` \| `"audioTrack"` \| `"currentTracksMiddleware"` \| `"setTracksMiddleware"`\> & `object` + +Defined in: [mobile-client/src/overrides/types.ts:81](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/overrides/types.ts#L81) + +## Type declaration + +### audioTrack + +> **audioTrack**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` + +### currentTracksMiddleware + +> **currentTracksMiddleware**: [`TracksMiddleware`](TracksMiddleware.md) \| `null` + +### presentBroadcastPicker() + +> **presentBroadcastPicker**: () => `Promise`\<`void`\> + +iOS only. Presents the system `RPSystemBroadcastPickerView`. When a +broadcast is active, this opens the system "Stop Broadcast" sheet so +the user can end it cleanly (via `broadcastFinished()`) and avoid the +"Screen sharing stopped" error dialog that `stopStreaming` triggers +by force-closing the host-side socket. No-op on non-iOS. + +#### Returns + +`Promise`\<`void`\> + +### setTracksMiddleware() + +> **setTracksMiddleware**: (`middleware`) => `Promise`\<`void`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `middleware` | [`TracksMiddleware`](TracksMiddleware.md) \| `null` | + +#### Returns + +`Promise`\<`void`\> + +### stream + +> **stream**: [`MediaStream`](../classes/MediaStream.md) \| `null` + +### videoTrack + +> **videoTrack**: [`MediaStreamTrack`](../classes/MediaStreamTrack.md) \| `null` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseTelecomResult.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseTelecomResult.md new file mode 100644 index 00000000..2dbc0a98 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/UseTelecomResult.md @@ -0,0 +1,95 @@ +# Type Alias: UseTelecomResult + +> **UseTelecomResult** = `object` + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:2 + +## Properties + +### endCall() + +> **endCall**: (`reason?`) => `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:4 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason?` | [`CallEndedReason`](CallEndedReason.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### hasActiveCall() + +> **hasActiveCall**: () => `boolean` + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:5 + +#### Returns + +`boolean` + +*** + +### isAnswered() + +> **isAnswered**: () => `boolean` + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:6 + +#### Returns + +`boolean` + +*** + +### isHeld() + +> **isHeld**: () => `boolean` + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:8 + +#### Returns + +`boolean` + +*** + +### setCallHeld() + +> **setCallHeld**: (`onHold`) => `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:7 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `onHold` | `boolean` | + +#### Returns + +`Promise`\<`void`\> + +*** + +### startCall() + +> **startCall**: (`config`) => `Promise`\<`void`\> + +Defined in: react-native-webrtc/lib/typescript/useTelecom.d.ts:3 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`TelecomConfig`](TelecomConfig.md) | + +#### Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallIntent.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallIntent.md new file mode 100644 index 00000000..e71a79e7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallIntent.md @@ -0,0 +1,33 @@ +# Type Alias: VoIPCallIntent + +> **VoIPCallIntent** = `object` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:4 + +## Properties + +### displayName + +> **displayName**: `string` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:8 + +Label iOS showed for the entry. Falls back to `handle` when there is no separate label. + +*** + +### handle + +> **handle**: `string` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:6 + +Stable id of the party to call back - the handle originally reported to CallKit. + +*** + +### isVideo + +> **isVideo**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/VoIP.d.ts:9 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallStatus.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallStatus.md new file mode 100644 index 00000000..5b686d06 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPCallStatus.md @@ -0,0 +1,12 @@ +# Type Alias: VoIPCallStatus + +> **VoIPCallStatus** = `"available"` \| `"incoming"` \| `"connecting"` \| `"active"` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L12) + +Lifecycle state of the current VoIP call. + +- `available` — no call in progress +- `incoming` — a call is ringing, awaiting the user's answer +- `connecting` — the call was started/answered; **your app should be joining its room now** +- `active` — your app reported the media connected and the call is in progress diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPContextValue.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPContextValue.md new file mode 100644 index 00000000..ce1b8e37 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPContextValue.md @@ -0,0 +1,194 @@ +# Type Alias: VoIPContextValue + +> **VoIPContextValue** = `object` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L41) + +Value returned from [useVoIP](../functions/useVoIP.md). + +## Properties + +### callStatus + +> **callStatus**: [`VoIPCallStatus`](VoIPCallStatus.md) + +Defined in: [mobile-client/src/voip/VoIPContext.ts:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L43) + +Current call lifecycle status. + +*** + +### clearCallIntent() + +> **clearCallIntent**: () => `void` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:69](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L69) + +Discards [VoIPContextValue.pendingCallIntent](#pendingcallintent) once you have acted on it. + +#### Returns + +`void` + +*** + +### currentCall + +> **currentCall**: [`CurrentCall`](CurrentCall.md) \| `null` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:47](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L47) + +The call currently being handled, or `null` when `callStatus` is `available`. + +*** + +### endCall() + +> **endCall**: (`reason?`) => `Promise`\<`void`\> + +Defined in: [mobile-client/src/voip/VoIPContext.ts:91](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L91) + +Ends or rejects the current call. Dismisses CallKit/Telecom and resets state back +to `available`; leaving the room is up to you. `reason` (defaults to `local`) is +surfaced to the system call UI/log and to `lastEndedReason`. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason?` | [`CallEndedReason`](CallEndedReason.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### isMuted + +> **isMuted**: `boolean` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:60](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L60) + +Whether the system call UI has the call muted. Reported only, as with [VoIPContextValue.isOnHold](#isonhold). + +*** + +### isOnHold + +> **isOnHold**: `boolean` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:58](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L58) + +Whether the native CallKit/Core-Telecom session is currently held. Reported only — +apply it to your own tracks. + +*** + +### lastEndedReason + +> **lastEndedReason**: [`CallEndedReason`](CallEndedReason.md) \| `null` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:53](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L53) + +Why the most recently handled call ended. `null` until a call has ended at +least once. Surfaced so a consumer can react to `missed`/`rejected`/etc., e.g. +showing a "missed call" notification. + +*** + +### pendingCallIntent + +> **pendingCallIntent**: [`VoIPCallIntent`](VoIPCallIntent.md) \| `null` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:67](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L67) + +A redial requested from the iOS **Recents** list, or `null` when there is none. +It carries only the handle to call, never a room, so mint a room name yourself. +Held until [VoIPContextValue.clearCallIntent](#clearcallintent), so one arriving before your +app has restored its session is not lost. + +*** + +### reportConnected() + +> **reportConnected**: () => `Promise`\<`void`\> + +Defined in: [mobile-client/src/voip/VoIPContext.ts:83](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L83) + +Report that the room join succeeded and media is flowing. Fulfills CallKit's answer +action (or reports the outgoing call as connected) and moves the call to `active`. + +An answered incoming call must be fulfilled within `VoIPFulfillAnswerTimeout` +(10s by default) or the native side ends it and `onEnded` fires. + +#### Returns + +`Promise`\<`void`\> + +*** + +### reportConnectFailed() + +> **reportConnectFailed**: () => `Promise`\<`void`\> + +Defined in: [mobile-client/src/voip/VoIPContext.ts:85](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L85) + +Tell the SDK your room join failed. Ends the call with reason `failed`. + +#### Returns + +`Promise`\<`void`\> + +*** + +### setCallHeld() + +> **setCallHeld**: (`onHold`) => `Promise`\<`void`\> + +Defined in: [mobile-client/src/voip/VoIPContext.ts:93](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L93) + +Requests that the native CallKit/Core-Telecom session be held or resumed. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `onHold` | `boolean` | + +#### Returns + +`Promise`\<`void`\> + +*** + +### startCall() + +> **startCall**: (`to`, `roomName`) => `Promise`\<`void`\> + +Defined in: [mobile-client/src/voip/VoIPContext.ts:75](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L75) + +Reports an outgoing call to `to` in `roomName` to CallKit/Core-Telecom and moves +to `connecting`. Run your own signaling (ringing the callee) *before* calling this. +It does **not** join the room — react to `callStatus` becoming `connecting` for that. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `to` | `string` | +| `roomName` | `string` | + +#### Returns + +`Promise`\<`void`\> + +*** + +### voipToken + +> **voipToken**: `string` \| `null` + +Defined in: [mobile-client/src/voip/VoIPContext.ts:45](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPContext.ts#L45) + +This device's VoIP push token, or `null` until APNs has issued one. diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPEventHandlers.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPEventHandlers.md new file mode 100644 index 00000000..f8f21459 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPEventHandlers.md @@ -0,0 +1,149 @@ +# Type Alias: VoIPEventHandlers + +> **VoIPEventHandlers** = `object` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:21 + +## Properties + +### onAnswered()? + +> `optional` **onAnswered**: (`requestId`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:23 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `requestId` | `string` | + +#### Returns + +`void` + +*** + +### onCallIntent()? + +> `optional` **onCallIntent**: (`intent`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:28 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `intent` | [`VoIPCallIntent`](VoIPCallIntent.md) | + +#### Returns + +`void` + +*** + +### onEnded()? + +> `optional` **onEnded**: (`reason?`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:24 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason?` | [`CallEndedReason`](CallEndedReason.md) | + +#### Returns + +`void` + +*** + +### onHeldChanged()? + +> `optional` **onHeldChanged**: (`onHold`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:26 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `onHold` | `boolean` | + +#### Returns + +`void` + +*** + +### onIncoming()? + +> `optional` **onIncoming**: (`payload`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:22 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `payload` | [`VoIPIncomingPayload`](VoIPIncomingPayload.md) | + +#### Returns + +`void` + +*** + +### onMuteChanged()? + +> `optional` **onMuteChanged**: (`muted`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:27 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `muted` | `boolean` | + +#### Returns + +`void` + +*** + +### onRegistered()? + +> `optional` **onRegistered**: (`token`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:25 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `token` | `string` | + +#### Returns + +`void` + +*** + +### onWaitingCallDeclined()? + +> `optional` **onWaitingCallDeclined**: (`payload`) => `void` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:29 + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `payload` | [`VoIPIncomingPayload`](VoIPIncomingPayload.md) | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPIncomingPayload.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPIncomingPayload.md new file mode 100644 index 00000000..ebfdeafb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPIncomingPayload.md @@ -0,0 +1,54 @@ +# Type Alias: VoIPIncomingPayload + +> **VoIPIncomingPayload** = `object` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:3 + +## Properties + +### avatarUrl? + +> `optional` **avatarUrl**: `string` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:19 + +Optional URL of the caller's avatar, forwarded verbatim from the push payload. +On Android it is downloaded and shown in the incoming-call notification and +full-screen UI; on iOS CallKit cannot render it, so it is provided only for +your own in-app UI. + +*** + +### displayName + +> **displayName**: `string` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:5 + +*** + +### handle + +> **handle**: `string` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:11 + +Stable id of the caller, taken from the push payload's `handle` (falls back to +`displayName`). On iOS this is what lands in Recents and comes back as the redial +intent's handle; on Android it is the call's Telecom address. + +*** + +### isVideo + +> **isVideo**: `boolean` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:12 + +*** + +### roomName + +> **roomName**: `string` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:4 diff --git a/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPProviderProps.md b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPProviderProps.md new file mode 100644 index 00000000..56197b02 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/type-aliases/VoIPProviderProps.md @@ -0,0 +1,33 @@ +# Type Alias: VoIPProviderProps + +> **VoIPProviderProps** = `PropsWithChildren` & `object` + +Defined in: [mobile-client/src/voip/VoIPProvider.tsx:21](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/voip/VoIPProvider.tsx#L21) + +Props of [VoIPProvider](../functions/VoIPProvider.md) — the configuration of the VoIP call machine. + +## Type declaration + +### isVideo? + +> `optional` **isVideo**: `boolean` + +Whether outgoing calls are video calls — reflected in the CallKit session. +Make sure the underlying room type is set accordingly. Defaults to `false` (audio-only). + +### onWaitingCallDeclined()? + +> `optional` **onWaitingCallDeclined**: (`payload`) => `void` + +A waiting or overflow incoming call was declined from native UI. Does not +change local call state - use for signaling (e.g. `call-rejected` to the caller). + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `payload` | [`VoIPIncomingPayload`](VoIPIncomingPayload.md) | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/typedoc-sidebar.cjs b/versioned_docs/version-0.30.0/api/mobile/typedoc-sidebar.cjs new file mode 100644 index 00000000..a5e12d2e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */ +const typedocSidebar = {items:[{type:"category",label:"Connection",items:[{type:"doc",id:"api/mobile/functions/useConnection",label:"useConnection"},{type:"doc",id:"api/mobile/functions/useDataChannel",label:"useDataChannel"},{type:"doc",id:"api/mobile/type-aliases/Metadata",label:"Metadata"},{type:"doc",id:"api/mobile/variables/useUpdatePeerMetadata",label:"useUpdatePeerMetadata"},{type:"doc",id:"api/mobile/variables/useVAD",label:"useVAD"}]},{type:"category",label:"Other",items:[{type:"doc",id:"api/mobile/functions/failIncomingCallConnected",label:"failIncomingCallConnected"},{type:"doc",id:"api/mobile/functions/FishjamProvider",label:"FishjamProvider"},{type:"doc",id:"api/mobile/functions/fulfillIncomingCallConnected",label:"fulfillIncomingCallConnected"},{type:"doc",id:"api/mobile/functions/getPendingAnswerRequestId",label:"getPendingAnswerRequestId"},{type:"doc",id:"api/mobile/functions/isCallHeld",label:"isCallHeld"},{type:"doc",id:"api/mobile/functions/pushAudioSamples",label:"pushAudioSamples"},{type:"doc",id:"api/mobile/functions/reportOutgoingCallConnected",label:"reportOutgoingCallConnected"},{type:"doc",id:"api/mobile/functions/RTCPIPView",label:"RTCPIPView"},{type:"doc",id:"api/mobile/functions/RTCView",label:"RTCView"},{type:"doc",id:"api/mobile/functions/setCallHeld",label:"setCallHeld"},{type:"doc",id:"api/mobile/functions/setCallMuted",label:"setCallMuted"},{type:"doc",id:"api/mobile/functions/startPIP",label:"startPIP"},{type:"doc",id:"api/mobile/functions/stopPIP",label:"stopPIP"},{type:"doc",id:"api/mobile/functions/useAudioOutput",label:"useAudioOutput"},{type:"doc",id:"api/mobile/functions/useCallKit",label:"useCallKit"},{type:"doc",id:"api/mobile/functions/useCallKitEvent",label:"useCallKitEvent"},{type:"doc",id:"api/mobile/functions/useCallKitService",label:"useCallKitService"},{type:"doc",id:"api/mobile/functions/useCamera",label:"useCamera"},{type:"doc",id:"api/mobile/functions/useCameraPermissions",label:"useCameraPermissions"},{type:"doc",id:"api/mobile/functions/useCustomAudioSource",label:"useCustomAudioSource"},{type:"doc",id:"api/mobile/functions/useCustomSource",label:"useCustomSource"},{type:"doc",id:"api/mobile/functions/useInitializeDevices",label:"useInitializeDevices"},{type:"doc",id:"api/mobile/functions/useLivestreamStreamer",label:"useLivestreamStreamer"},{type:"doc",id:"api/mobile/functions/useLivestreamViewer",label:"useLivestreamViewer"},{type:"doc",id:"api/mobile/functions/useMicrophone",label:"useMicrophone"},{type:"doc",id:"api/mobile/functions/useMicrophonePermissions",label:"useMicrophonePermissions"},{type:"doc",id:"api/mobile/functions/usePeers",label:"usePeers"},{type:"doc",id:"api/mobile/functions/useScreenShare",label:"useScreenShare"},{type:"doc",id:"api/mobile/functions/useTelecom",label:"useTelecom"},{type:"doc",id:"api/mobile/functions/useTelecomEvent",label:"useTelecomEvent"},{type:"doc",id:"api/mobile/functions/useVoIP",label:"useVoIP"},{type:"doc",id:"api/mobile/functions/VoIPProvider",label:"VoIPProvider"},{type:"doc",id:"api/mobile/enumerations/AudioDeviceType",label:"AudioDeviceType"},{type:"doc",id:"api/mobile/enumerations/Variant",label:"Variant"},{type:"doc",id:"api/mobile/classes/MediaStream",label:"MediaStream"},{type:"doc",id:"api/mobile/classes/MediaStreamTrack",label:"MediaStreamTrack"},{type:"doc",id:"api/mobile/interfaces/CustomAudioSink",label:"CustomAudioSink"},{type:"doc",id:"api/mobile/interfaces/CustomAudioTrack",label:"CustomAudioTrack"},{type:"doc",id:"api/mobile/interfaces/DataChannelOptions",label:"DataChannelOptions"},{type:"doc",id:"api/mobile/interfaces/JoinRoomConfig",label:"JoinRoomConfig"},{type:"doc",id:"api/mobile/interfaces/SimulcastConfig",label:"SimulcastConfig"},{type:"doc",id:"api/mobile/interfaces/UseCustomAudioSourceOptions",label:"UseCustomAudioSourceOptions"},{type:"doc",id:"api/mobile/interfaces/UseCustomAudioSourceResult",label:"UseCustomAudioSourceResult"},{type:"doc",id:"api/mobile/type-aliases/AudioDevice",label:"AudioDevice"},{type:"doc",id:"api/mobile/type-aliases/AudioOutputChangedInfo",label:"AudioOutputChangedInfo"},{type:"doc",id:"api/mobile/type-aliases/AuthErrorReason",label:"AuthErrorReason"},{type:"doc",id:"api/mobile/type-aliases/BandwidthLimits",label:"BandwidthLimits"},{type:"doc",id:"api/mobile/type-aliases/Brand",label:"Brand"},{type:"doc",id:"api/mobile/type-aliases/CallEndedReason",label:"CallEndedReason"},{type:"doc",id:"api/mobile/type-aliases/CallKitAction",label:"CallKitAction"},{type:"doc",id:"api/mobile/type-aliases/CallKitConfig",label:"CallKitConfig"},{type:"doc",id:"api/mobile/type-aliases/ConnectStreamerConfig",label:"ConnectStreamerConfig"},{type:"doc",id:"api/mobile/type-aliases/ConnectViewerConfig",label:"ConnectViewerConfig"},{type:"doc",id:"api/mobile/type-aliases/CurrentCall",label:"CurrentCall"},{type:"doc",id:"api/mobile/type-aliases/CustomSource",label:"CustomSource"},{type:"doc",id:"api/mobile/type-aliases/DataCallback",label:"DataCallback"},{type:"doc",id:"api/mobile/type-aliases/DeviceError",label:"DeviceError"},{type:"doc",id:"api/mobile/type-aliases/DeviceItem",label:"DeviceItem"},{type:"doc",id:"api/mobile/type-aliases/FishjamProviderProps",label:"FishjamProviderProps"},{type:"doc",id:"api/mobile/type-aliases/ForegroundServiceConfig",label:"ForegroundServiceConfig"},{type:"doc",id:"api/mobile/type-aliases/InitializeDevicesResult",label:"InitializeDevicesResult"},{type:"doc",id:"api/mobile/type-aliases/InitializeDevicesSettings",label:"InitializeDevicesSettings"},{type:"doc",id:"api/mobile/type-aliases/InitializeDevicesStatus",label:"InitializeDevicesStatus"},{type:"doc",id:"api/mobile/type-aliases/JoinErrorReason",label:"JoinErrorReason"},{type:"doc",id:"api/mobile/type-aliases/MiddlewareResult",label:"MiddlewareResult"},{type:"doc",id:"api/mobile/type-aliases/PeerId",label:"PeerId"},{type:"doc",id:"api/mobile/type-aliases/PeerStatus",label:"PeerStatus"},{type:"doc",id:"api/mobile/type-aliases/PeerWithTracks",label:"PeerWithTracks"},{type:"doc",id:"api/mobile/type-aliases/PermissionStatus",label:"PermissionStatus"},{type:"doc",id:"api/mobile/type-aliases/PersistLastDeviceHandlers",label:"PersistLastDeviceHandlers"},{type:"doc",id:"api/mobile/type-aliases/ReconnectConfig",label:"ReconnectConfig"},{type:"doc",id:"api/mobile/type-aliases/ReconnectionStatus",label:"ReconnectionStatus"},{type:"doc",id:"api/mobile/type-aliases/RemoteTrack",label:"RemoteTrack"},{type:"doc",id:"api/mobile/type-aliases/RoomType",label:"RoomType"},{type:"doc",id:"api/mobile/type-aliases/RTCPIPViewProps",label:"RTCPIPViewProps"},{type:"doc",id:"api/mobile/type-aliases/RTCVideoViewProps",label:"RTCVideoViewProps"},{type:"doc",id:"api/mobile/type-aliases/SimulcastBandwidthLimit",label:"SimulcastBandwidthLimit"},{type:"doc",id:"api/mobile/type-aliases/SimulcastBandwidthLimits",label:"SimulcastBandwidthLimits"},{type:"doc",id:"api/mobile/type-aliases/StreamConfig",label:"StreamConfig"},{type:"doc",id:"api/mobile/type-aliases/StreamerInputs",label:"StreamerInputs"},{type:"doc",id:"api/mobile/type-aliases/TelecomConfig",label:"TelecomConfig"},{type:"doc",id:"api/mobile/type-aliases/TelecomEvent",label:"TelecomEvent"},{type:"doc",id:"api/mobile/type-aliases/TelecomEventType",label:"TelecomEventType"},{type:"doc",id:"api/mobile/type-aliases/Track",label:"Track"},{type:"doc",id:"api/mobile/type-aliases/TrackBandwidthLimit",label:"TrackBandwidthLimit"},{type:"doc",id:"api/mobile/type-aliases/TrackFields",label:"TrackFields"},{type:"doc",id:"api/mobile/type-aliases/TrackId",label:"TrackId"},{type:"doc",id:"api/mobile/type-aliases/TrackMiddleware",label:"TrackMiddleware"},{type:"doc",id:"api/mobile/type-aliases/TracksMiddleware",label:"TracksMiddleware"},{type:"doc",id:"api/mobile/type-aliases/TracksMiddlewareResult",label:"TracksMiddlewareResult"},{type:"doc",id:"api/mobile/type-aliases/UseAudioOutputResult",label:"UseAudioOutputResult"},{type:"doc",id:"api/mobile/type-aliases/UseCameraResult",label:"UseCameraResult"},{type:"doc",id:"api/mobile/type-aliases/UseCustomSourceResult",label:"UseCustomSourceResult"},{type:"doc",id:"api/mobile/type-aliases/UseDataChannelResult",label:"UseDataChannelResult"},{type:"doc",id:"api/mobile/type-aliases/UseInitializeDevicesParams",label:"UseInitializeDevicesParams"},{type:"doc",id:"api/mobile/type-aliases/UseInitializeDevicesReturn",label:"UseInitializeDevicesReturn"},{type:"doc",id:"api/mobile/type-aliases/UseLivestreamStreamerResult",label:"UseLivestreamStreamerResult"},{type:"doc",id:"api/mobile/type-aliases/UseLivestreamViewerResult",label:"UseLivestreamViewerResult"},{type:"doc",id:"api/mobile/type-aliases/UseMicrophoneResult",label:"UseMicrophoneResult"},{type:"doc",id:"api/mobile/type-aliases/UseSandboxProps",label:"UseSandboxProps"},{type:"doc",id:"api/mobile/type-aliases/UseScreenShareResult",label:"UseScreenShareResult"},{type:"doc",id:"api/mobile/type-aliases/UseTelecomResult",label:"UseTelecomResult"},{type:"doc",id:"api/mobile/type-aliases/VoIPCallIntent",label:"VoIPCallIntent"},{type:"doc",id:"api/mobile/type-aliases/VoIPCallStatus",label:"VoIPCallStatus"},{type:"doc",id:"api/mobile/type-aliases/VoIPContextValue",label:"VoIPContextValue"},{type:"doc",id:"api/mobile/type-aliases/VoIPEventHandlers",label:"VoIPEventHandlers"},{type:"doc",id:"api/mobile/type-aliases/VoIPIncomingPayload",label:"VoIPIncomingPayload"},{type:"doc",id:"api/mobile/type-aliases/VoIPProviderProps",label:"VoIPProviderProps"},{type:"doc",id:"api/mobile/variables/ScreenCapturePickerView",label:"ScreenCapturePickerView"},{type:"doc",id:"api/mobile/variables/SimulcastConfig",label:"SimulcastConfig"},{type:"doc",id:"api/mobile/variables/useForegroundService",label:"useForegroundService"},{type:"doc",id:"api/mobile/variables/useSandbox",label:"useSandbox"},{type:"doc",id:"api/mobile/variables/useVoIPEvents",label:"useVoIPEvents"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/ScreenCapturePickerView.md b/versioned_docs/version-0.30.0/api/mobile/variables/ScreenCapturePickerView.md new file mode 100644 index 00000000..a6e889f7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/ScreenCapturePickerView.md @@ -0,0 +1,5 @@ +# Variable: ScreenCapturePickerView + +> `const` **ScreenCapturePickerView**: `HostComponent` + +Defined in: react-native-webrtc/lib/typescript/ScreenCapturePickerView.d.ts:1 diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/SimulcastConfig.md b/versioned_docs/version-0.30.0/api/mobile/variables/SimulcastConfig.md new file mode 100644 index 00000000..e8dbd27d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/SimulcastConfig.md @@ -0,0 +1,5 @@ +# Variable: SimulcastConfig + +> **SimulcastConfig**: `MessageFns`\<[`SimulcastConfig`](../interfaces/SimulcastConfig.md)\> + +Defined in: ts-client/dist/index.d.mts:197 diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/useForegroundService.md b/versioned_docs/version-0.30.0/api/mobile/variables/useForegroundService.md new file mode 100644 index 00000000..c21d3d55 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/useForegroundService.md @@ -0,0 +1,20 @@ +# Variable: useForegroundService() + +> `const` **useForegroundService**: (`config`) => `void` = `externalUseForegroundService` + +Defined in: [mobile-client/src/useForegroundService.ts:47](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/mobile-client/src/useForegroundService.ts#L47) + +Hook for managing a foreground service on Android. + +A hook for managing a foreground service on Android. Does nothing on other platforms. +You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing. + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `config` | `ForegroundServiceConfig` | Configuration options for the foreground service. | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/useSandbox.md b/versioned_docs/version-0.30.0/api/mobile/variables/useSandbox.md new file mode 100644 index 00000000..a5e903c6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/useSandbox.md @@ -0,0 +1,88 @@ +# Variable: useSandbox() + +> `const` **useSandbox**: (`props`) => `object` + +Defined in: react-client/dist/hooks/useSandbox.d.ts:9 + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | [`UseSandboxProps`](../type-aliases/UseSandboxProps.md) | + +## Returns + +`object` + +### getSandboxLivestream() + +> **getSandboxLivestream**: (`roomName`, `isPublic?`) => `Promise`\<\{ `room`: \{ `id`: `string`; `name`: `string`; \}; `streamerToken`: `string`; \}\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomName` | `string` | +| `isPublic?` | `boolean` | + +#### Returns + +`Promise`\<\{ `room`: \{ `id`: `string`; `name`: `string`; \}; `streamerToken`: `string`; \}\> + +### getSandboxMoqPublisherAccess() + +> **getSandboxMoqPublisherAccess**: (`streamName`) => `Promise`\<`MoqAccess`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `streamName` | `string` | + +#### Returns + +`Promise`\<`MoqAccess`\> + +### getSandboxMoqSubscriberAccess() + +> **getSandboxMoqSubscriberAccess**: (`streamName`) => `Promise`\<`MoqAccess`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `streamName` | `string` | + +#### Returns + +`Promise`\<`MoqAccess`\> + +### getSandboxPeerToken() + +> **getSandboxPeerToken**: (`roomName`, `peerName`, `roomType?`) => `Promise`\<`string`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomName` | `string` | +| `peerName` | `string` | +| `roomType?` | [`RoomType`](../type-aliases/RoomType.md) | + +#### Returns + +`Promise`\<`string`\> + +### getSandboxViewerToken() + +> **getSandboxViewerToken**: (`roomName`) => `Promise`\<`string`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomName` | `string` | + +#### Returns + +`Promise`\<`string`\> diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/useUpdatePeerMetadata.md b/versioned_docs/version-0.30.0/api/mobile/variables/useUpdatePeerMetadata.md new file mode 100644 index 00000000..1c7eb9e2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/useUpdatePeerMetadata.md @@ -0,0 +1,31 @@ +# Variable: useUpdatePeerMetadata() + +> `const` **useUpdatePeerMetadata**: \<`PeerMetadata`\>() => `object` + +Defined in: react-client/dist/hooks/useUpdatePeerMetadata.d.ts:8 + +Hook provides a method to update the metadata of the local peer. + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +## Returns + +### updatePeerMetadata() + +> **updatePeerMetadata**: (`peerMetadata`) => `void` + +Updates metadata visible to other peers + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `peerMetadata` | `PeerMetadata` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/useVAD.md b/versioned_docs/version-0.30.0/api/mobile/variables/useVAD.md new file mode 100644 index 00000000..1b9f9932 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/useVAD.md @@ -0,0 +1,25 @@ +# Variable: useVAD() + +> `const` **useVAD**: (`options`) => `Record`\<[`PeerId`](../type-aliases/PeerId.md), `boolean`\> + +Defined in: react-client/dist/hooks/useVAD.d.ts:29 + +Voice activity detection. Use this hook to check if voice is detected in the audio track for given peer(s). + +Remote peer VAD is driven by `vadNotification` messages from the backend. +If the local peer's id is included in `peerIds`, local VAD is determined client-side +by polling the microphone's audio level (see `useLocalVAD`). + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `peerIds`: `ReadonlyArray`\<[`PeerId`](../type-aliases/PeerId.md)\>; \} | Options object. | +| `options.peerIds` | `ReadonlyArray`\<[`PeerId`](../type-aliases/PeerId.md)\> | List of peer ids to subscribe to for VAD notifications. Include the local peer's id to also track whether the local user is speaking. Example usage: `import { useVAD, type PeerId } from "@fishjam-cloud/react-client"; function WhoIsTalkingComponent({ peerIds }: { peerIds: PeerId[] }) { const peersInfo = useVAD({ peerIds }); const activePeers = (Object.keys(peersInfo) as PeerId[]).filter((peerId) => peersInfo[peerId]); return "Now talking: " + activePeers.join(", "); }` | + +## Returns + +`Record`\<[`PeerId`](../type-aliases/PeerId.md), `boolean`\> + +A record where each key is a peer id and the boolean value indicates +whether voice activity is currently detected for that peer. diff --git a/versioned_docs/version-0.30.0/api/mobile/variables/useVoIPEvents.md b/versioned_docs/version-0.30.0/api/mobile/variables/useVoIPEvents.md new file mode 100644 index 00000000..48544a8c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/mobile/variables/useVoIPEvents.md @@ -0,0 +1,5 @@ +# Variable: useVoIPEvents + +> `const` **useVoIPEvents**: *typeof* `useVoIPEventsIos` + +Defined in: react-native-webrtc/lib/typescript/useVoIPEvents.d.ts:32 diff --git a/versioned_docs/version-0.30.0/api/reference.md b/versioned_docs/version-0.30.0/api/reference.md new file mode 100644 index 00000000..a52d50a5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/reference.md @@ -0,0 +1,65 @@ +--- +type: reference +--- + +# Reference + +Describes APIs for direct interaction with Fishjam. + +Fishjam publishes documentation for the Sandbox API, Fishjam Server APIs, and the Composition API. + +## Sandbox API + +[Sandbox API OpenAPI](https://github.com/fishjam-cloud/documentation/tree/main/static/api/room-manager-openapi.yaml) + +See also: [What is the Sandbox API?](../explanation/sandbox-api-concept) + +## Server + +Fishjam Server provides a REST API for managing rooms, peers, and [recordings](../how-to/compositions/record-a-composition), and +[Protobufs](https://protobuf.dev) for +receiving structured live updates from the server. +The notifications can be configured using Webhook or Websocket. + +### REST API + +[Server REST API Reference](/api/rest) + +### Protobufs + +- [Server Notification Protobufs](https://github.com/fishjam-cloud/documentation/tree/main/static/api/protobuf/server_notifications.proto) +- [Agent Message Protobufs](https://github.com/fishjam-cloud/documentation/tree/main/static/api/protobuf/agent_notifications.proto) + +#### Webhook + +When using webhooks for receiving notifications, configure your webhook URL in +the **Webhooks** tab of the [Fishjam Dashboard](https://fishjam.io/app). +Fishjam then delivers all notifications to that URL. + +The HTTP POST to your webhook URL uses "application/x-protobuf" content type. +The body is binary data, that represents encoded `ServerMessage`. + +Setting `batchWebhookNotifications` to `true` in the `RoomConfig` is recommended. Fishjam then coalesces several notifications into one POST: the body is still a single `ServerMessage`, but its `notification_batch` field holds a `NotificationBatch`, which carries the individual notifications as a repeated list of `ServerMessage`s (see `server_notifications.proto`). This delivers notifications faster and with fewer requests. The SDK decoders unwrap the batch for you. + +For more information see also [server setup documentation](../how-to/backend/server-setup#webhooks) + +#### Websocket + +After opening the Websocket connection to +`https://fishjam.io/api/v1/connect/{fishjamId}/socket/server/websocket`, +the first message that must be sent is an `AuthRequest`, +with a valid Management Token. + +Next, you can should subscribe to notifications by sending `SubscribeRequest` event with `SERVER_NOTIFICATION` event type. + +## Compositions + +[Compositions](../explanation/compositions) are managed through the Composition API. All requests go to `https://rtc.fishjam.io`. + +### REST API + +[Composition REST API Reference](/api/compositions) + +Calls authenticate with your Management Token, from the [**Fishjam developer panel**](https://fishjam.io/app). + +Request bodies are snake_case and closed: a field the endpoint does not define is rejected with `422` rather than ignored, so a misspelling fails loudly instead of silently doing nothing. diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/agent/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/agent/index.md new file mode 100644 index 00000000..5e7d6404 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/agent/index.md @@ -0,0 +1,295 @@ +--- +title: agent +sidebar_label: agent +custom_edit_url: null +--- + +# fishjam.agent + + + +## Agent +```python +class Agent: +``` +Allows for connecting to a Fishjam room as an agent peer. + +Provides callbacks for receiving audio. + +Attributes: +- id: The unique identifier of the agent. +- room_id: The ID of the room the agent is connecting to. + +### __init__ +```python +def __init__(id: str, room_id: str, token: str, fishjam_url: str) +``` +Creates an Agent instance. + +This constructor should not be called directly. +Instead, you should call :func:`fishjam.FishjamClient.create_agent`. + +Args: +- id: The unique identifier for the agent. +- room_id: The ID of the room the agent will join. +- token: The authentication token for the agent. +- fishjam_url: The URL of the Fishjam instance. + +### id +```python +id +``` + + +### room_id +```python +room_id +``` + + +### connect +```python +def connect(self) +``` +Connects the agent to Fishjam to start receiving messages. + +Incoming messages from Fishjam will be routed to handlers +defined with :func:`on_track_data`. + +Yields: +- AgentSession: An active session for sending media and handling events. + +Raises: +- AgentAuthError: If authentication with the Fishjam server fails. + +--- +## AgentError +```python +class AgentError(Exception): +``` +Base exception class for all agent exceptions. + +--- +## AgentSession +```python +class AgentSession: +``` +Represents an active connection session for an Agent. + +### __init__ +```python +def __init__( + agent: fishjam.agent.agent.Agent, + websocket: websockets.asyncio.client.ClientConnection +) +``` +Initializes the AgentSession. + +Args: +- agent: The Agent instance owning this session. +- websocket: The active websocket connection. + +### agent +```python +agent +``` + + +### receive +```python +def receive( + self +) -> AsyncIterator[AgentResponseTrackData | AgentResponseTrackImage] +``` +Returns an async iterator over incoming messages from Fishjam. + +Yields: +- IncomingAgentMessage: The next message received from the server. + +### add_track +```python +def add_track( + self, + options: fishjam.agent.agent.OutgoingAudioTrackOptions +) -> fishjam.agent.agent.OutgoingTrack +``` +Adds a track to the connected agent with the specified options. + +Args: +- options: Configuration options and metadata for the new track. + +Returns: +- OutgoingTrack: An object used to send data over the added track. + +### capture_image +```python +def capture_image(self, track_id: str) +``` +Requests a image capture from a remote track. + +The captured image will be delivered as an +:class:`IncomingTrackImage` message through :func:`receive`. + +Args: +- track_id: The identifier of the track to capture an image from. + +### disconnect +```python +def disconnect(self) +``` +Ends the agent session by closing the websocket connection. + +Useful when you don't use the context manager to obtain the session. + +--- +## AgentAuthError +```python +class AgentAuthError(fishjam.agent.errors.AgentError): +``` +Agent failed to authenticate properly. + +### __init__ +```python +def __init__(reason: str) +``` + + +### reason +```python +reason +``` + + +--- +## IncomingTrackData +```python +IncomingTrackData = + +``` + + +--- +## IncomingTrackImage +```python +IncomingTrackImage = + +``` + + +--- +## OutgoingTrack +```python +class OutgoingTrack: +``` +Represents an outgoing track of an agent connected to Fishjam. + +This is created by :func:`Agent.add_track`. + +Attributes: +- id: The global identifier of the track. +- session: The agent the track belongs to. +- options: The parameters used to create the track. + +### __init__ +```python +def __init__( + id: str, + session: fishjam.agent.agent.AgentSession, + options: fishjam.agent.agent.OutgoingAudioTrackOptions +) +``` + + +### id +```python +id: str +``` + + +### session +```python +session: fishjam.agent.agent.AgentSession +``` + + +### options +```python +options: fishjam.agent.agent.OutgoingAudioTrackOptions +``` + + +### send_chunk +```python +def send_chunk(self, data: bytes) +``` +Sends a chunk of audio to Fishjam on this track. + +Peers connected to the room of the agent will receive this data. + +Args: +- data: The raw audio bytes to send. + +### interrupt +```python +def interrupt(self) +``` +Interrupts the current track. + +Any audio that has been sent, but not played, will be cleared and +prevented from playing. Audio sent after the interrupt will be played +normally. + +--- +## OutgoingAudioTrackOptions +```python +class OutgoingAudioTrackOptions: +``` +Parameters of an outgoing audio track. + +Attributes: +- encoding: The encoding of the audio source. Defaults to raw 16-bit PCM. +- sample_rate: The sample rate of the audio source. Defaults to 16000. +- channels: The number of channels in the audio source. Supported values are + 1 (mono) and 2 (stereo). Defaults to 1 (mono). +- metadata: Custom metadata for the track. Must be JSON-encodable. + +### __init__ +```python +def __init__( + encoding: TrackEncoding = , + sample_rate: Literal[16000, 24000] = 16000, + channels: Literal[1, 2] = 1, + metadata: dict[str, typing.Any] | None = None +) +``` + + +### encoding +```python +encoding: TrackEncoding = + +``` + + +### sample_rate +```python +sample_rate: Literal[16000, 24000] = 16000 + +``` + + +### channels +```python +channels: Literal[1, 2] = 1 + +``` + + +### metadata +```python +metadata: dict[str, typing.Any] | None = None + +``` + + +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/errors/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/errors/index.md new file mode 100644 index 00000000..bace8c6a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/errors/index.md @@ -0,0 +1,73 @@ +--- +title: errors +sidebar_label: errors +custom_edit_url: null +--- + +# fishjam.errors + + + +## MissingFishjamIdError +```python +class MissingFishjamIdError(ValueError): +``` +Inappropriate argument value (of correct type). + +--- +## HTTPError +```python +class HTTPError(Exception): +``` + + +--- +## BadRequestError +```python +class BadRequestError(HTTPError): +``` + + +--- +## UnauthorizedError +```python +class UnauthorizedError(HTTPError): +``` + + +--- +## NotFoundError +```python +class NotFoundError(HTTPError): +``` + + +--- +## ServiceUnavailableError +```python +class ServiceUnavailableError(HTTPError): +``` + + +--- +## InternalServerError +```python +class InternalServerError(HTTPError): +``` + + +--- +## ConflictError +```python +class ConflictError(HTTPError): +``` + + +--- +## InvalidFishjamCredentialsError +```python +class InvalidFishjamCredentialsError(HTTPError): +``` + + +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/events/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/events/index.md new file mode 100644 index 00000000..723c4c72 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/events/index.md @@ -0,0 +1,1052 @@ +--- +title: events +sidebar_label: events +custom_edit_url: null +--- + +# fishjam.events + + + +## ServerMessageRoomCreated +```python +class ServerMessageRoomCreated(betterproto.Message): +``` +Notification sent when a room is created + +### __init__ +```python +def __init__(room_id: str = ) +``` + + +### room_id +```python +room_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageRoomDeleted +```python +class ServerMessageRoomDeleted(betterproto.Message): +``` +Notification sent when a room is deleted + +### __init__ +```python +def __init__(room_id: str = ) +``` + + +### room_id +```python +room_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageRoomCrashed +```python +class ServerMessageRoomCrashed(betterproto.Message): +``` +Notification sent when a room crashes + +### __init__ +```python +def __init__(room_id: str = ) +``` + + +### room_id +```python +room_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerAdded +```python +class ServerMessagePeerAdded(betterproto.Message): +``` +Notification sent when a peer is added + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerConnected +```python +class ServerMessagePeerConnected(betterproto.Message): +``` +Notification sent when a peer connects + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerDeleted +```python +class ServerMessagePeerDeleted(betterproto.Message): +``` +Notification sent when a peer is removed + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerDisconnected +```python +class ServerMessagePeerDisconnected(betterproto.Message): +``` +Notification sent when a peer disconnects from FJ + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerMetadataUpdated +```python +class ServerMessagePeerMetadataUpdated(betterproto.Message): +``` +Notification sent when peer updates its metadata + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + metadata: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### metadata +```python +metadata: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessagePeerCrashed +```python +class ServerMessagePeerCrashed(betterproto.Message): +``` +Notification sent when a peer crashes + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + reason: str = , + peer_type: ServerMessagePeerType = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### reason +```python +reason: str +``` + + +### peer_type +```python +peer_type: ServerMessagePeerType +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageStreamConnected +```python +class ServerMessageStreamConnected(betterproto.Message): +``` +Notification sent when streamer successfully connects + +### __init__ +```python +def __init__(stream_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageStreamDisconnected +```python +class ServerMessageStreamDisconnected(betterproto.Message): +``` +Notification sent when streamer disconnects + +### __init__ +```python +def __init__(stream_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageStreamerConnected +```python +class ServerMessageStreamerConnected(betterproto.Message): +``` + + +### __init__ +```python +def __init__(stream_id: str = , streamer_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +### streamer_id +```python +streamer_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageStreamerDisconnected +```python +class ServerMessageStreamerDisconnected(betterproto.Message): +``` + + +### __init__ +```python +def __init__(stream_id: str = , streamer_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +### streamer_id +```python +streamer_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageChannelAdded +```python +class ServerMessageChannelAdded(betterproto.Message): +``` +Notification sent when a peer creates a channel + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + component_id: str = , + channel_id: str = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### component_id +```python +component_id: str +``` + + +### channel_id +```python +channel_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageChannelRemoved +```python +class ServerMessageChannelRemoved(betterproto.Message): +``` +Notification sent when a peer deletes a channel + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + component_id: str = , + channel_id: str = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### component_id +```python +component_id: str +``` + + +### channel_id +```python +channel_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageTrackAdded +```python +class ServerMessageTrackAdded(betterproto.Message): +``` +Notification sent when peer or component adds new track + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + component_id: str = , + track: Track = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### component_id +```python +component_id: str +``` + + +### track +```python +track: Track +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageTrackMetadataUpdated +```python +class ServerMessageTrackMetadataUpdated(betterproto.Message): +``` +Notification sent when metadata of a multimedia track is updated + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + component_id: str = , + track: Track = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### component_id +```python +component_id: str +``` + + +### track +```python +track: Track +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageTrackRemoved +```python +class ServerMessageTrackRemoved(betterproto.Message): +``` +Notification sent when a track is removed + +### __init__ +```python +def __init__( + room_id: str = , + peer_id: str = , + component_id: str = , + track: Track = +) +``` + + +### room_id +```python +room_id: str +``` + + +### peer_id +```python +peer_id: str +``` + + +### component_id +```python +component_id: str +``` + + +### track +```python +track: Track +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageViewerConnected +```python +class ServerMessageViewerConnected(betterproto.Message): +``` +Notification sent when viewer successfully connects + +### __init__ +```python +def __init__(stream_id: str = , viewer_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +### viewer_id +```python +viewer_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## ServerMessageViewerDisconnected +```python +class ServerMessageViewerDisconnected(betterproto.Message): +``` +Notification sent when viewer disconnects + +### __init__ +```python +def __init__(stream_id: str = , viewer_id: str = ) +``` + + +### stream_id +```python +stream_id: str +``` + + +### viewer_id +```python +viewer_id: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## Track +```python +class Track(betterproto.Message): +``` +Describes a media track + +### __init__ +```python +def __init__( + id: str = , + type: TrackType = , + metadata: str = +) +``` + + +### id +```python +id: str +``` + + +### type +```python +type: TrackType +``` + + +### metadata +```python +metadata: str +``` + + +#### Inherited Members +* **Message**: + * `SerializeToString` + * `parse` + * `FromString` + * `to_dict` + * `from_dict` + * `to_json` + * `from_json` + * `to_pydict` + * `from_pydict` + * `is_set` +--- +## TrackEncoding +```python +class TrackEncoding(betterproto.Enum): +``` +The base class for protobuf enumerations, all generated enumerations will inherit +from this. Bases :class:`enum.IntEnum`. + +### TRACK_ENCODING_UNSPECIFIED +```python +TRACK_ENCODING_UNSPECIFIED = + +``` + + +### TRACK_ENCODING_PCM16 +```python +TRACK_ENCODING_PCM16 = + +``` + + +### TRACK_ENCODING_OPUS +```python +TRACK_ENCODING_OPUS = + +``` + + +#### Inherited Members +* **Enum**: + * `from_string` + + + + + +* **Enum**: + * `name` + * `value` +--- +## TrackType +```python +class TrackType(betterproto.Enum): +``` +Defines types of tracks being published by peers and component + +### TRACK_TYPE_UNSPECIFIED +```python +TRACK_TYPE_UNSPECIFIED = + +``` + + +### TRACK_TYPE_VIDEO +```python +TRACK_TYPE_VIDEO = + +``` + + +### TRACK_TYPE_AUDIO +```python +TRACK_TYPE_AUDIO = + +``` + + +#### Inherited Members +* **Enum**: + * `from_string` + + + + + +* **Enum**: + * `name` + * `value` +--- +## ServerMessagePeerType +```python +class ServerMessagePeerType(betterproto.Enum): +``` +The base class for protobuf enumerations, all generated enumerations will inherit +from this. Bases :class:`enum.IntEnum`. + +### PEER_TYPE_UNSPECIFIED +```python +PEER_TYPE_UNSPECIFIED = + +``` + + +### PEER_TYPE_WEBRTC +```python +PEER_TYPE_WEBRTC = + +``` + + +### PEER_TYPE_AGENT +```python +PEER_TYPE_AGENT = + +``` + + +### PEER_TYPE_VAPI +```python +PEER_TYPE_VAPI = + +``` + + +#### Inherited Members +* **Enum**: + * `from_string` + + + + + +* **Enum**: + * `name` + * `value` +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/index.md new file mode 100644 index 00000000..b44cdf3a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/index.md @@ -0,0 +1,826 @@ +--- +title: fishjam +sidebar_label: fishjam +custom_edit_url: null +--- + +# fishjam + + +## Submodules +- [events](fishjam/events) +- [errors](fishjam/errors) +- [room](fishjam/room) +- [peer](fishjam/peer) +- [agent](fishjam/agent) +- [integrations](fishjam/integrations) + +## FishjamClient +```python +class FishjamClient(Client): +``` +Allows for managing rooms. + +### __init__ +```python +def __init__(fishjam_id: str, management_token: str) +``` +Create a FishjamClient instance. + +Does not contact the Fishjam backend — use :meth:`create_and_verify` +or :meth:`check_credentials` to verify credentials live. + +Args: +- fishjam_id: The unique identifier for the Fishjam instance. +- management_token: The token used for authenticating management operations. + +### create_and_verify +```python +def create_and_verify( + cls, + *, + fishjam_id: str, + management_token: str +) -> FishjamClient +``` +Construct a FishjamClient and verify its credentials against the backend. + +Args: +- fishjam_id: The unique identifier for the Fishjam instance. +- management_token: The token used for authenticating management operations. + +Returns: +- FishjamClient: A client whose credentials have been verified. + +Raises: +- InvalidFishjamCredentialsError: If the token is rejected. + +### check_credentials +```python +def check_credentials(self) -> None +``` +Verify the management token via a single ``/validate`` call. + +Raises: +- InvalidFishjamCredentialsError: If the token is rejected. + +### create_peer +```python +def create_peer( + self, + room_id: str, + options: PeerOptions | None = None +) -> tuple[Peer, str] +``` +Creates a peer in the room. + +Args: +- room_id: The ID of the room where the peer will be created. +- options: Configuration options for the peer. Defaults to None. + +Returns: +- A tuple containing: + - Peer: The created peer object. + - str: The peer token needed to authenticate to Fishjam. + +### create_agent +```python +def create_agent( + self, + room_id: str, + options: AgentOptions | None = None +) +``` +Creates an agent in the room. + +Args: +- room_id: The ID of the room where the agent will be created. +- options: Configuration options for the agent. Defaults to None. + +Returns: +- Agent: The created agent instance initialized with peer ID, room ID, token, + and Fishjam URL. + +### create_vapi_agent +```python +def create_vapi_agent( + self, + room_id: str, + options: PeerOptionsVapi +) -> Peer +``` +Creates a vapi agent in the room. + +Args: +- room_id: The ID of the room where the vapi agent will be created. +- options: Configuration options for the vapi peer. + +Returns: +- - Peer: The created peer object. + +### create_room +```python +def create_room( + self, + options: RoomOptions | None = None +) -> Room +``` +Creates a new room. + +Args: +- options: Configuration options for the room. Defaults to None. + +Returns: +- Room: The created Room object. + +### get_all_rooms +```python +def get_all_rooms(self) -> list[Room] +``` +Returns list of all rooms. + +Returns: +- list[Room]: A list of all available Room objects. + +### get_room +```python +def get_room(self, room_id: str) -> Room +``` +Returns room with the given id. + +Args: +- room_id: The ID of the room to retrieve. + +Returns: +- Room: The Room object corresponding to the given ID. + +### delete_peer +```python +def delete_peer(self, room_id: str, peer_id: str) -> None +``` +Deletes a peer from a room. + +Args: +- room_id: The ID of the room the peer belongs to. +- peer_id: The ID of the peer to delete. + +### delete_room +```python +def delete_room(self, room_id: str) -> None +``` +Deletes a room. + +Args: +- room_id: The ID of the room to delete. + +### refresh_peer_token +```python +def refresh_peer_token(self, room_id: str, peer_id: str) -> str +``` +Refreshes a peer token. + +Args: +- room_id: The ID of the room. +- peer_id: The ID of the peer whose token needs refreshing. + +Returns: +- str: The new peer token. + +### create_livestream_viewer_token +```python +def create_livestream_viewer_token(self, room_id: str) -> str +``` +Generates a viewer token for livestream rooms. + +Args: +- room_id: The ID of the livestream room. + +Returns: +- str: The generated viewer token. + +### create_livestream_streamer_token +```python +def create_livestream_streamer_token(self, room_id: str) -> str +``` +Generates a streamer token for livestream rooms. + +Args: +- room_id: The ID of the livestream room. + +Returns: +- str: The generated streamer token. + +### create_moq_access +```python +def create_moq_access( + self, + publish_path: str | None = None, + subscribe_path: str | None = None +) -> MoqAccess +``` +Generates MoQ relay connection details. + +Args: +- publish_path: Path the access grants publish access to. +- subscribe_path: Path the access grants subscribe access to. + +Returns: +- MoqAccess: The relay connection details, containing the +- ``connection_url`` (with the JWT embedded as a ``?jwt=`` query +- parameter) and the ``token`` itself. + +### subscribe_peer +```python +def subscribe_peer(self, room_id: str, peer_id: str, target_peer_id: str) +``` +Subscribes a peer to all tracks of another peer. + +Args: +- room_id: The ID of the room. +- peer_id: The ID of the subscribing peer. +- target_peer_id: The ID of the peer to subscribe to. + +### subscribe_tracks +```python +def subscribe_tracks(self, room_id: str, peer_id: str, track_ids: list[str]) +``` +Subscribes a peer to specific tracks of another peer. + +Args: +- room_id: The ID of the room. +- peer_id: The ID of the subscribing peer. +- track_ids: A list of track IDs to subscribe to. + +#### Inherited Members +* **Client**: + * `client` + * `warnings_shown` +--- +## FishjamNotifier +```python +class FishjamNotifier: +``` +Allows for receiving WebSocket messages from Fishjam. + +### __init__ +```python +def __init__(fishjam_id: str, management_token: str) +``` +Create a FishjamNotifier instance with an ID and management token. + +### on_server_notification +```python +def on_server_notification( + self, + handler: Union[Callable[[Union[ServerMessageRoomCreated, ServerMessageRoomDeleted, ServerMessageRoomCrashed, ServerMessagePeerAdded, ServerMessagePeerDeleted, ServerMessagePeerConnected, ServerMessagePeerDisconnected, ServerMessagePeerMetadataUpdated, ServerMessagePeerCrashed, ServerMessageStreamerConnected, ServerMessageStreamerDisconnected, ServerMessageChannelAdded, ServerMessageChannelRemoved, ServerMessageViewerConnected, ServerMessageViewerDisconnected, ServerMessageTrackAdded, ServerMessageTrackRemoved, ServerMessageTrackMetadataUpdated]], NoneType], Callable[[Union[ServerMessageRoomCreated, ServerMessageRoomDeleted, ServerMessageRoomCrashed, ServerMessagePeerAdded, ServerMessagePeerDeleted, ServerMessagePeerConnected, ServerMessagePeerDisconnected, ServerMessagePeerMetadataUpdated, ServerMessagePeerCrashed, ServerMessageStreamerConnected, ServerMessageStreamerDisconnected, ServerMessageChannelAdded, ServerMessageChannelRemoved, ServerMessageViewerConnected, ServerMessageViewerDisconnected, ServerMessageTrackAdded, ServerMessageTrackRemoved, ServerMessageTrackMetadataUpdated]], Coroutine[Any, Any, None]]] +) +``` +Decorator for defining a handler for Fishjam notifications. + +Args: +- handler: The function to be registered as the notification handler. + +Returns: +- NotificationHandler: The original handler function (unmodified). + +### connect +```python +def connect(self) +``` +Connects to Fishjam and listens for all incoming messages. + +It runs until the connection isn't closed. + +The incoming messages are handled by the functions defined using the +`on_server_notification` decorator. + +The handler have to be defined before calling `connect`, +otherwise the messages won't be received. + +### wait_ready +```python +def wait_ready(self) -> None +``` +Waits until the notifier is connected and authenticated to Fishjam. + +If already connected, returns immediately. + +--- +## decode_server_notifications +```python +def decode_server_notifications( + binary: bytes +) -> List[Union[ServerMessageRoomCreated, ServerMessageRoomDeleted, ServerMessageRoomCrashed, ServerMessagePeerAdded, ServerMessagePeerDeleted, ServerMessagePeerConnected, ServerMessagePeerDisconnected, ServerMessagePeerMetadataUpdated, ServerMessagePeerCrashed, ServerMessageStreamerConnected, ServerMessageStreamerDisconnected, ServerMessageChannelAdded, ServerMessageChannelRemoved, ServerMessageViewerConnected, ServerMessageViewerDisconnected, ServerMessageTrackAdded, ServerMessageTrackRemoved, ServerMessageTrackMetadataUpdated]] +``` +Decode a received protobuf payload into a list of notifications. + +Handles both single notifications and batches transparently: a single +notification is returned as a one-element list, a batch is unpacked into +its members (in order), and anything unsupported yields an empty list. + +The available notifications are listed in the `fishjam.events` module. + +Args: +- binary: The raw binary data received from the webhook. + +Returns: +- list[AllowedNotification]: The decoded notifications, in order. Empty + when the payload carries no supported notification. + +--- +## receive_binary +```python +def receive_binary( + binary: bytes +) -> Union[ServerMessageRoomCreated, ServerMessageRoomDeleted, ServerMessageRoomCrashed, ServerMessagePeerAdded, ServerMessagePeerDeleted, ServerMessagePeerConnected, ServerMessagePeerDisconnected, ServerMessagePeerMetadataUpdated, ServerMessagePeerCrashed, ServerMessageStreamerConnected, ServerMessageStreamerDisconnected, ServerMessageChannelAdded, ServerMessageChannelRemoved, ServerMessageViewerConnected, ServerMessageViewerDisconnected, ServerMessageTrackAdded, ServerMessageTrackRemoved, ServerMessageTrackMetadataUpdated, List[Union[ServerMessageRoomCreated, ServerMessageRoomDeleted, ServerMessageRoomCrashed, ServerMessagePeerAdded, ServerMessagePeerDeleted, ServerMessagePeerConnected, ServerMessagePeerDisconnected, ServerMessagePeerMetadataUpdated, ServerMessagePeerCrashed, ServerMessageStreamerConnected, ServerMessageStreamerDisconnected, ServerMessageChannelAdded, ServerMessageChannelRemoved, ServerMessageViewerConnected, ServerMessageViewerDisconnected, ServerMessageTrackAdded, ServerMessageTrackRemoved, ServerMessageTrackMetadataUpdated]], NoneType] +``` +Transforms a received protobuf notification into a notification instance. + +.. deprecated:: +- Use `decode_server_notifications` instead, which always returns a list +- and handles batched payloads with a single, consistent return type. + +The available notifications are listed in `fishjam.events` module. + +Args: +- binary: The raw binary data received from the webhook. + +Returns: +- AllowedNotification: A single notification when the payload carries one. +- list[AllowedNotification]: The unpacked notifications, in order, when the + payload is a batch (webhook batching enabled). +- None: When the payload is not a supported notification. + +--- +## PeerMetadata +```python +class PeerMetadata: +``` +Custom metadata set by the peer + +Example: +- \{'name': 'FishjamUser'\} + +### __init__ +```python +def __init__() +``` +Method generated by attrs for class PeerMetadata. + +### additional_properties +```python +additional_properties: dict[str, typing.Any] +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +### additional_keys +```python +additional_keys: list[str] +``` + + +--- +## PeerOptions +```python +class PeerOptions: +``` +Options specific to a WebRTC Peer. + +Attributes: +- metadata: Peer metadata. +- subscribe_mode: Configuration of peer's subscribing policy. + +### __init__ +```python +def __init__( + metadata: dict[str, typing.Any] | None = None, + subscribe_mode: Literal['auto', 'manual'] = 'auto' +) +``` + + +### metadata +```python +metadata: dict[str, typing.Any] | None = None + +``` +Peer metadata + +### subscribe_mode +```python +subscribe_mode: Literal['auto', 'manual'] = 'auto' + +``` +Configuration of peer's subscribing policy + +--- +## PeerOptionsVapi +```python +class PeerOptionsVapi: +``` +Options specific to the VAPI peer + +Attributes: +- api_key (str): VAPI API key +- call_id (str): VAPI call ID +- subscribe_mode (SubscribeMode | Unset): Configuration of peer's subscribing policy + +### __init__ +```python +def __init__( + api_key: str, + call_id: str, + subscribe_mode: SubscribeMode | Unset = +) +``` +Method generated by attrs for class PeerOptionsVapi. + +### api_key +```python +api_key: str +``` + + +### call_id +```python +call_id: str +``` + + +### subscribe_mode +```python +subscribe_mode: SubscribeMode | Unset +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +--- +## RoomOptions +```python +class RoomOptions: +``` +Description of a room options. + +Attributes: +- max_peers: Maximum amount of peers allowed into the room. +- video_codec: Enforces video codec for each peer in the room. +- webhook_url: URL where Fishjam notifications will be sent. +- room_type: The use-case of the room. If not provided, this defaults + to conference. +- public: True if livestream viewers can omit specifying a token. +- batch_webhook_notifications: If true, webhook notifications for this room + are coalesced into a single NotificationBatch per HTTP send instead + of one request per notification. + +### __init__ +```python +def __init__( + max_peers: int | None = None, + video_codec: Optional[Literal['h264', 'vp8']] = None, + webhook_url: str | None = None, + room_type: Literal['conference', 'audio_only', 'livestream', 'full_feature', 'broadcaster', 'audio_only_livestream'] = 'conference', + public: bool = False, + batch_webhook_notifications: bool = False +) +``` + + +### max_peers +```python +max_peers: int | None = None + +``` +Maximum amount of peers allowed into the room + +### video_codec +```python +video_codec: Optional[Literal['h264', 'vp8']] = None + +``` +Enforces video codec for each peer in the room + +### webhook_url +```python +webhook_url: str | None = None + +``` +URL where Fishjam notifications will be sent + +### room_type +```python +room_type: Literal['conference', 'audio_only', 'livestream', 'full_feature', 'broadcaster', 'audio_only_livestream'] = 'conference' + +``` +The use-case of the room. If not provided, this defaults to conference. + +### public +```python +public: bool = False + +``` +True if livestream viewers can omit specifying a token. + +### batch_webhook_notifications +```python +batch_webhook_notifications: bool = False + +``` +Coalesce webhook notifications into a single NotificationBatch per send. + +--- +## AgentOptions +```python +class AgentOptions: +``` +Options specific to an Agent Peer. + +Attributes: +- output: Configuration for the agent's output options. +- subscribe_mode: Configuration of peer's subscribing policy. + +### __init__ +```python +def __init__( + output: AgentOutputOptions = , + subscribe_mode: Literal['auto', 'manual'] = 'auto' +) +``` + + +### output +```python +output: AgentOutputOptions +``` + + +### subscribe_mode +```python +subscribe_mode: Literal['auto', 'manual'] = 'auto' + +``` + + +--- +## AgentOutputOptions +```python +class AgentOutputOptions: +``` +Options of the desired format of audio tracks going from Fishjam to the agent. + +Attributes: +- audio_format: The format of the audio stream (e.g., 'pcm16'). +- audio_sample_rate: The sample rate of the audio stream. + +### __init__ +```python +def __init__( + audio_format: Literal['pcm16'] = 'pcm16', + audio_sample_rate: Literal[16000, 24000] = 16000 +) +``` + + +### audio_format +```python +audio_format: Literal['pcm16'] = 'pcm16' + +``` + + +### audio_sample_rate +```python +audio_sample_rate: Literal[16000, 24000] = 16000 + +``` + + +--- +## Room +```python +class Room: +``` +Description of the room state. + +Attributes: +- config: Room configuration. +- id: Room ID. +- peers: List of all peers. + +### __init__ +```python +def __init__( + config: RoomConfig, + id: str, + peers: list[Peer] +) +``` + + +### config +```python +config: RoomConfig +``` +Room configuration + +### id +```python +id: str +``` +Room ID + +### peers +```python +peers: list[Peer] +``` +List of all peers + +--- +## Peer +```python +class Peer: +``` +Describes peer status + +Attributes: +- id (str): Assigned peer id Example: 4a1c1164-5fb7-425d-89d7-24cdb8fff1cf. +- metadata (None | PeerMetadata): Custom metadata set by the peer Example: \{'name': 'FishjamUser'\}. +- status (PeerStatus): Informs about the peer status Example: disconnected. +- subscribe_mode (SubscribeMode): Configuration of peer's subscribing policy +- subscriptions (Subscriptions): Describes peer's subscriptions in manual mode +- tracks (list[Track]): List of all peer's tracks +- type_ (PeerType): Peer type Example: webrtc. + +### __init__ +```python +def __init__( + id: str, + metadata: None | PeerMetadata, + status: PeerStatus, + subscribe_mode: SubscribeMode, + subscriptions: Subscriptions, + tracks: list[Track], + type_: PeerType +) +``` +Method generated by attrs for class Peer. + +### id +```python +id: str +``` + + +### metadata +```python +metadata: None | PeerMetadata +``` + + +### status +```python +status: PeerStatus +``` + + +### subscribe_mode +```python +subscribe_mode: SubscribeMode +``` + + +### subscriptions +```python +subscriptions: Subscriptions +``` + + +### tracks +```python +tracks: list[Track] +``` + + +### type_ +```python +type_: PeerType +``` + + +### additional_properties +```python +additional_properties: dict[str, typing.Any] +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +### additional_keys +```python +additional_keys: list[str] +``` + + +--- +## MoqAccess +```python +class MoqAccess: +``` +Connection details for a MoQ relay client + +Attributes: +- connection_url (str): Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to + a MoQ client SDK. Example: https://relay.fishjam.io/abc123?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.... +- token (str): JWT authorizing the MoQ relay connection, also embedded in `connection_url` Example: eyJhbGciOiJIUz + I1NiIsInR5cCI6IkpXVCJ9.eyJyb290IjoiZmlzaGphbSIsInB1dCI6WyJteS1zdHJlYW0iXSwiZ2V0IjpbXSwiaWF0IjoxNzEzMzYwMDAwLCJle + HAiOjE3MTMzNjM2MDB9.abc123. + +### __init__ +```python +def __init__(connection_url: str, token: str) +``` +Method generated by attrs for class MoqAccess. + +### connection_url +```python +connection_url: str +``` + + +### token +```python +token: str +``` + + +### additional_properties +```python +additional_properties: dict[str, typing.Any] +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +### additional_keys +```python +additional_keys: list[str] +``` + + +--- +## MissingFishjamIdError +```python +class MissingFishjamIdError(ValueError): +``` +Inappropriate argument value (of correct type). + +--- +## InvalidFishjamCredentialsError +```python +class InvalidFishjamCredentialsError(fishjam.errors.HTTPError): +``` + + +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/gemini/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/gemini/index.md new file mode 100644 index 00000000..44d3e133 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/gemini/index.md @@ -0,0 +1,18 @@ +--- +title: gemini +sidebar_label: gemini +custom_edit_url: null +--- + +# fishjam.integrations.gemini + + + +## GeminiIntegration +```python +GeminiIntegration = + +``` +Integration with the Gemini Live API. + +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/index.md new file mode 100644 index 00000000..a8c2dfd8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/integrations/index.md @@ -0,0 +1,12 @@ +--- +title: integrations +sidebar_label: integrations +custom_edit_url: null +--- + +# fishjam.integrations + + +## Submodules +- [gemini](integrations/gemini) + diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/peer/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/peer/index.md new file mode 100644 index 00000000..5c956ae8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/peer/index.md @@ -0,0 +1,107 @@ +--- +title: peer +sidebar_label: peer +custom_edit_url: null +--- + +# fishjam.peer + + + +## PeerMetadata +```python +class PeerMetadata: +``` +Custom metadata set by the peer + +Example: +- \{'name': 'FishjamUser'\} + +### __init__ +```python +def __init__() +``` +Method generated by attrs for class PeerMetadata. + +### additional_properties +```python +additional_properties: dict[str, typing.Any] +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +### additional_keys +```python +additional_keys: list[str] +``` + + +--- +## PeerStatus +```python +class PeerStatus(str, enum.Enum): +``` +Informs about the peer status + +### CONNECTED +```python +CONNECTED = + +``` + + +### DISCONNECTED +```python +DISCONNECTED = + +``` + + +#### Inherited Members +* **Enum**: + * `name` + * `value` +--- +## PeerType +```python +class PeerType(str, enum.Enum): +``` +Peer type + +### AGENT +```python +AGENT = + +``` + + +### VAPI +```python +VAPI = + +``` + + +### WEBRTC +```python +WEBRTC = + +``` + + +#### Inherited Members +* **Enum**: + * `name` + * `value` +--- diff --git a/versioned_docs/version-0.30.0/api/server-python/fishjam/room/index.md b/versioned_docs/version-0.30.0/api/server-python/fishjam/room/index.md new file mode 100644 index 00000000..f1a07568 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server-python/fishjam/room/index.md @@ -0,0 +1,167 @@ +--- +title: room +sidebar_label: room +custom_edit_url: null +--- + +# fishjam.room + + + +## RoomConfig +```python +class RoomConfig: +``` +Room configuration + +Attributes: +- batch_webhook_notifications (bool | Unset): If true, webhook notifications for this room are coalesced into a + single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are + unaffected. Default: False. +- max_peers (int | None | Unset): Maximum amount of peers allowed into the room Example: 10. +- public (bool | Unset): True if livestream viewers can omit specifying a token. Default: False. +- room_type (RoomType | Unset): The use-case of the room. If not provided, this defaults to conference. +- video_codec (VideoCodec | Unset): Enforces video codec for each peer in the room +- webhook_url (None | str | Unset): URL where Fishjam notifications will be sent Example: + https://backend.address.com/fishjam-notifications-endpoint. + +### __init__ +```python +def __init__( + batch_webhook_notifications: bool | Unset = False, + max_peers: int | None | Unset = , + public: bool | Unset = False, + room_type: RoomType | Unset = , + video_codec: VideoCodec | Unset = , + webhook_url: None | str | Unset = +) +``` +Method generated by attrs for class RoomConfig. + +### batch_webhook_notifications +```python +batch_webhook_notifications: bool | Unset +``` + + +### max_peers +```python +max_peers: int | None | Unset +``` + + +### public +```python +public: bool | Unset +``` + + +### room_type +```python +room_type: RoomType | Unset +``` + + +### video_codec +```python +video_codec: VideoCodec | Unset +``` + + +### webhook_url +```python +webhook_url: None | str | Unset +``` + + +### to_dict +```python +def to_dict(self) -> dict[str, typing.Any] +``` + + +### from_dict +```python +def from_dict(cls: type[~T], src_dict: Mapping[str, typing.Any]) -> ~T +``` + + +--- +## VideoCodec +```python +class VideoCodec(str, enum.Enum): +``` +Enforces video codec for each peer in the room + +### H264 +```python +H264 = + +``` + + +### VP8 +```python +VP8 = + +``` + + +#### Inherited Members +* **Enum**: + * `name` + * `value` +--- +## RoomType +```python +class RoomType(str, enum.Enum): +``` +The use-case of the room. If not provided, this defaults to conference. + +### AUDIO_ONLY +```python +AUDIO_ONLY = + +``` + + +### AUDIO_ONLY_LIVESTREAM +```python +AUDIO_ONLY_LIVESTREAM = + +``` + + +### BROADCASTER +```python +BROADCASTER = + +``` + + +### CONFERENCE +```python +CONFERENCE = + +``` + + +### FULL_FEATURE +```python +FULL_FEATURE = + +``` + + +### LIVESTREAM +```python +LIVESTREAM = + +``` + + +#### Inherited Members +* **Enum**: + * `name` + * `value` +--- diff --git a/versioned_docs/version-0.30.0/api/server/classes/BadRequestException.md b/versioned_docs/version-0.30.0/api/server/classes/BadRequestException.md new file mode 100644 index 00000000..0899327e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/BadRequestException.md @@ -0,0 +1,53 @@ +# Class: BadRequestException + +Defined in: [js-server-sdk/src/exceptions/index.ts:34](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L34) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new BadRequestException**(`info`): `BadRequestException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`BadRequestException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/FishjamAgent.md b/versioned_docs/version-0.30.0/api/server/classes/FishjamAgent.md new file mode 100644 index 00000000..5cfc4e5c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/FishjamAgent.md @@ -0,0 +1,170 @@ +# Class: FishjamAgent + +Defined in: [js-server-sdk/src/agent.ts:47](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L47) + +## Extends + +- `TypedEventEmitter`\<[`AgentEvents`](../type-aliases/AgentEvents.md), `this`\> + +## Constructors + +### Constructor + +> **new FishjamAgent**(`config`, `agentToken`, `callbacks?`, `peerWebsocketUrl?`): `FishjamAgent` + +Defined in: [js-server-sdk/src/agent.ts:55](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L55) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`FishjamConfig`](../type-aliases/FishjamConfig.md) | +| `agentToken` | `string` | +| `callbacks?` | [`AgentCallbacks`](../type-aliases/AgentCallbacks.md) | +| `peerWebsocketUrl?` | `string` | + +#### Returns + +`FishjamAgent` + +#### Overrides + +`(EventEmitter as new () => TypedEmitter).constructor` + +## Methods + +### awaitConnected() + +> **awaitConnected**(): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/agent.ts:94](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L94) + +Await Agent connection to Fishjam. + +#### Returns + +`Promise`\<`void`\> + +*** + +### captureImage() + +> **captureImage**(`trackId`, `timeoutMs`): `Promise`\<`AgentResponse_TrackImage`\> + +Defined in: [js-server-sdk/src/agent.ts:155](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L155) + +Request a captured image from the given track + +#### Parameters + +| Parameter | Type | Default value | Description | +| ------ | ------ | ------ | ------ | +| `trackId` | [`TrackId`](../type-aliases/TrackId.md) | `undefined` | the track to capture an image from | +| `timeoutMs` | `number` | `5000` | timeout in milliseconds (default: 5000) | + +#### Returns + +`Promise`\<`AgentResponse_TrackImage`\> + +a promise that resolves with the captured image data + +*** + +### createTrack() + +> **createTrack**(`codecParameters`, `metadata`): [`AgentTrack`](../type-aliases/AgentTrack.md) + +Defined in: [js-server-sdk/src/agent.ts:102](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L102) + +Creates an outgoing audio track for the agent + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `codecParameters` | [`AudioCodecParameters`](../type-aliases/AudioCodecParameters.md) | +| `metadata` | `object` | + +#### Returns + +[`AgentTrack`](../type-aliases/AgentTrack.md) + +a new audio track + +*** + +### deleteTrack() + +> **deleteTrack**(`trackId`): `void` + +Defined in: [js-server-sdk/src/agent.ts:134](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L134) + +Deletes an outgoing audio track for the agent + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `trackId` | [`TrackId`](../type-aliases/TrackId.md) | + +#### Returns + +`void` + +*** + +### disconnect() + +> **disconnect**(): `void` + +Defined in: [js-server-sdk/src/agent.ts:180](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L180) + +#### Returns + +`void` + +*** + +### interruptTrack() + +> **interruptTrack**(`trackId`): `void` + +Defined in: [js-server-sdk/src/agent.ts:125](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L125) + +Interrupt track identified by `trackId`. + +Any audio that has been sent by the agent, but not played +by Fishjam will be cleared and be prevented from playing. + +Audio sent after the interrupt will be played normally. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `trackId` | [`TrackId`](../type-aliases/TrackId.md) | + +#### Returns + +`void` + +*** + +### sendData() + +> **sendData**(`trackId`, `data`): `void` + +Defined in: [js-server-sdk/src/agent.ts:143](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L143) + +Send audio data for the given track + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `trackId` | [`TrackId`](../type-aliases/TrackId.md) | +| `data` | `Uint8Array` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/server/classes/FishjamBaseException.md b/versioned_docs/version-0.30.0/api/server/classes/FishjamBaseException.md new file mode 100644 index 00000000..44e4f7a2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/FishjamBaseException.md @@ -0,0 +1,59 @@ +# Class: FishjamBaseException + +Defined in: [js-server-sdk/src/exceptions/index.ts:24](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L24) + +## Extends + +- `Error` + +## Extended by + +- [`BadRequestException`](BadRequestException.md) +- [`UnauthorizedException`](UnauthorizedException.md) +- [`ForbiddenException`](ForbiddenException.md) +- [`RoomNotFoundException`](RoomNotFoundException.md) +- [`FishjamNotFoundException`](FishjamNotFoundException.md) +- [`InvalidFishjamCredentialsException`](InvalidFishjamCredentialsException.md) +- [`PeerNotFoundException`](PeerNotFoundException.md) +- [`RecordingNotFoundException`](RecordingNotFoundException.md) +- [`ServiceUnavailableException`](ServiceUnavailableException.md) +- [`QuotaExceededException`](QuotaExceededException.md) +- [`UnknownException`](UnknownException.md) + +## Constructors + +### Constructor + +> **new FishjamBaseException**(`info`): `FishjamBaseException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`FishjamBaseException` + +#### Overrides + +`Error.constructor` + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) diff --git a/versioned_docs/version-0.30.0/api/server/classes/FishjamClient.md b/versioned_docs/version-0.30.0/api/server/classes/FishjamClient.md new file mode 100644 index 00000000..0b7b7fb7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/FishjamClient.md @@ -0,0 +1,485 @@ +# Class: FishjamClient + +Defined in: [js-server-sdk/src/client.ts:28](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L28) + +Client class that allows to manage Rooms and Peers for a Fishjam App. +It requires the Fishjam ID and management token that can be retrieved from the Fishjam Dashboard. + +## Constructors + +### Constructor + +> **new FishjamClient**(`config`): `FishjamClient` + +Defined in: [js-server-sdk/src/client.ts:53](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L53) + +Create new instance of Fishjam Client. + +Does not verify credentials against the backend — use +[FishjamClient.create](#create) or call +[FishjamClient.checkCredentials](#checkcredentials) afterwards for that. + +Example usage: +``` +const fishjamClient = new FishjamClient({ + fishjamId: fastify.config.FISHJAM_ID, + managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN, +}); +``` + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`FishjamConfig`](../type-aliases/FishjamConfig.md) | + +#### Returns + +`FishjamClient` + +## Methods + +### checkCredentials() + +> **checkCredentials**(): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:106](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L106) + +Verifies the configured credentials by making a single lightweight +call to the Fishjam backend. Resolves on success, throws +[InvalidFishjamCredentialsException](InvalidFishjamCredentialsException.md) on 401/404 from the backend, +otherwise rethrows the standard mapped exception. + +#### Returns + +`Promise`\<`void`\> + +*** + +### create() + +> `static` **create**(`config`): `Promise`\<`FishjamClient`\> + +Defined in: [js-server-sdk/src/client.ts:94](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L94) + +Async factory: constructs a client and verifies credentials against +the backend. + +Throws [InvalidFishjamCredentialsException](InvalidFishjamCredentialsException.md) when the +`fishjamId` / `managementToken` pair is rejected by the backend. + +Example: +``` +const client = await FishjamClient.create({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, +}); +``` + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`FishjamConfig`](../type-aliases/FishjamConfig.md) | + +#### Returns + +`Promise`\<`FishjamClient`\> + +*** + +### createAgent() + +> **createAgent**(`roomId`, `options`, `callbacks?`): `Promise`\<\{ `agent`: [`FishjamAgent`](FishjamAgent.md); `peer`: [`Peer`](../type-aliases/Peer.md); \}\> + +Defined in: [js-server-sdk/src/client.ts:185](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L185) + +Create a new agent assigned to a room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `options` | [`PeerOptionsAgent`](../interfaces/PeerOptionsAgent.md) | +| `callbacks?` | [`AgentCallbacks`](../type-aliases/AgentCallbacks.md) | + +#### Returns + +`Promise`\<\{ `agent`: [`FishjamAgent`](FishjamAgent.md); `peer`: [`Peer`](../type-aliases/Peer.md); \}\> + +*** + +### createLivestreamStreamerToken() + +> **createLivestreamStreamerToken**(`roomId`): `Promise`\<[`StreamerToken`](../interfaces/StreamerToken.md)\> + +Defined in: [js-server-sdk/src/client.ts:302](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L302) + +Creates a livestream streamer token for the given room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | + +#### Returns + +`Promise`\<[`StreamerToken`](../interfaces/StreamerToken.md)\> + +a livestream streamer token + +*** + +### createLivestreamViewerToken() + +> **createLivestreamViewerToken**(`roomId`): `Promise`\<[`ViewerToken`](../interfaces/ViewerToken.md)\> + +Defined in: [js-server-sdk/src/client.ts:290](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L290) + +Creates a livestream viewer token for the given room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | + +#### Returns + +`Promise`\<[`ViewerToken`](../interfaces/ViewerToken.md)\> + +a livestream viewer token + +*** + +### createMoqAccess() + +> **createMoqAccess**(`config?`): `Promise`\<[`MoqAccess`](../interfaces/MoqAccess.md)\> + +Defined in: [js-server-sdk/src/client.ts:314](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L314) + +Creates MoQ access. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config?` | [`MoqAccessConfig`](../interfaces/MoqAccessConfig.md) | + +#### Returns + +`Promise`\<[`MoqAccess`](../interfaces/MoqAccess.md)\> + +connection details containing the relay URL with the JWT embedded as a `?jwt=` query parameter, and the token itself + +*** + +### createPeer() + +> **createPeer**(`roomId`, `options`): `Promise`\<\{ `peer`: [`Peer`](../type-aliases/Peer.md); `peerToken`: `string`; \}\> + +Defined in: [js-server-sdk/src/client.ts:169](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L169) + +Create a new peer assigned to a room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `options` | [`PeerOptionsWebRTC`](../interfaces/PeerOptionsWebRTC.md) | + +#### Returns + +`Promise`\<\{ `peer`: [`Peer`](../type-aliases/Peer.md); `peerToken`: `string`; \}\> + +*** + +### createRecording() + +> **createRecording**(`config`): `Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +Defined in: [js-server-sdk/src/client.ts:325](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L325) + +Create a new recording. Capturing starts synchronously, so the returned recording is `active`. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`RecordingConfig`](../interfaces/RecordingConfig.md) | + +#### Returns + +`Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +*** + +### createRoom() + +> **createRoom**(`config`): `Promise`\<[`Room`](../type-aliases/Room.md)\> + +Defined in: [js-server-sdk/src/client.ts:134](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L134) + +Create a new room. All peers connected to the same room will be able to send/receive streams to each other. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`RoomConfig`](../interfaces/RoomConfig.md) | + +#### Returns + +`Promise`\<[`Room`](../type-aliases/Room.md)\> + +*** + +### createVapiAgent() + +> **createVapiAgent**(`roomId`, `options`): `Promise`\<\{ `peer`: [`Peer`](../type-aliases/Peer.md); \}\> + +Defined in: [js-server-sdk/src/client.ts:208](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L208) + +Create a new VAPI agent assigned to a room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `options` | [`PeerOptionsVapi`](../interfaces/PeerOptionsVapi.md) | + +#### Returns + +`Promise`\<\{ `peer`: [`Peer`](../type-aliases/Peer.md); \}\> + +*** + +### deletePeer() + +> **deletePeer**(`roomId`, `peerId`): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:236](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L236) + +Delete a peer - this will also disconnect the peer from the room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `peerId` | [`PeerId`](../type-aliases/PeerId.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### deleteRecording() + +> **deleteRecording**(`recordingId`): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:382](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L382) + +Delete a recording. Its stored media is removed asynchronously. +A recording that is still `active` cannot be deleted — stop it first or wait for it to finish. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `recordingId` | [`RecordingId`](../type-aliases/RecordingId.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### deleteRoom() + +> **deleteRoom**(`roomId`): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:146](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L146) + +Delete an existing room. All peers connected to this room will be disconnected and removed. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### getAllRecordings() + +> **getAllRecordings**(`metadata?`): `Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>[]\> + +Defined in: [js-server-sdk/src/client.ts:350](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L350) + +Get a list of all recordings, optionally filtered by metadata. +Returns recordings whose metadata contains all the given key-value pairs. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `metadata?` | `Record`\<`string`, `unknown`\> | + +#### Returns + +`Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>[]\> + +*** + +### getAllRooms() + +> **getAllRooms**(): `Promise`\<[`Room`](../type-aliases/Room.md)[]\> + +Defined in: [js-server-sdk/src/client.ts:157](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L157) + +Get a list of all existing rooms. + +#### Returns + +`Promise`\<[`Room`](../type-aliases/Room.md)[]\> + +*** + +### getRecording() + +> **getRecording**(`recordingId`): `Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +Defined in: [js-server-sdk/src/client.ts:337](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L337) + +Get details about a given recording. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `recordingId` | [`RecordingId`](../type-aliases/RecordingId.md) | + +#### Returns + +`Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +*** + +### getRoom() + +> **getRoom**(`roomId`): `Promise`\<[`Room`](../type-aliases/Room.md)\> + +Defined in: [js-server-sdk/src/client.ts:224](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L224) + +Get details about a given room. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | + +#### Returns + +`Promise`\<[`Room`](../type-aliases/Room.md)\> + +*** + +### refreshPeerToken() + +> **refreshPeerToken**(`roomId`, `peerId`): `Promise`\<`string`\> + +Defined in: [js-server-sdk/src/client.ts:277](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L277) + +Refresh the peer token for an already existing peer. +If an already created peer has not been connected to the room for more than 24 hours, the token will become invalid. This method can be used to generate a new peer token for the existing peer. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `peerId` | [`PeerId`](../type-aliases/PeerId.md) | + +#### Returns + +`Promise`\<`string`\> + +refreshed peer token + +*** + +### stopRecording() + +> **stopRecording**(`recordingId`): `Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +Defined in: [js-server-sdk/src/client.ts:369](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L369) + +Stop an active recording. Finalization is asynchronous: the recording stays `active` until +the capture is finalized, then becomes `finished`. Stopping a recording that is no longer active is a no-op. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `recordingId` | [`RecordingId`](../type-aliases/RecordingId.md) | + +#### Returns + +`Promise`\<[`Override`](../type-aliases/Override.md)\<`Recording`, \{ `id`: [`RecordingId`](../type-aliases/RecordingId.md); `status`: [`RecordingStatus`](../type-aliases/RecordingStatus.md); \}\>\> + +*** + +### subscribePeer() + +> **subscribePeer**(`roomId`, `subscriberPeerId`, `publisherPeerId`): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:248](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L248) + +Subscribe a peer to another peer - this will make all tracks from the publisher available to the subscriber. +Using this function only makes sense if subscribeMode is set to manual + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `subscriberPeerId` | [`PeerId`](../type-aliases/PeerId.md) | +| `publisherPeerId` | [`PeerId`](../type-aliases/PeerId.md) | + +#### Returns + +`Promise`\<`void`\> + +*** + +### subscribeTracks() + +> **subscribeTracks**(`roomId`, `subscriberPeerId`, `tracks`): `Promise`\<`void`\> + +Defined in: [js-server-sdk/src/client.ts:260](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/client.ts#L260) + +Subscribe a peer to specific tracks from another peer - this will make only the specified tracks from the publisher available to the subscriber. +Using this function only makes sense if subscribeMode is set to manual + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomId` | [`RoomId`](../type-aliases/RoomId.md) | +| `subscriberPeerId` | [`PeerId`](../type-aliases/PeerId.md) | +| `tracks` | [`TrackId`](../type-aliases/TrackId.md)[] | + +#### Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/server/classes/FishjamNotFoundException.md b/versioned_docs/version-0.30.0/api/server/classes/FishjamNotFoundException.md new file mode 100644 index 00000000..7c3d3b8a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/FishjamNotFoundException.md @@ -0,0 +1,53 @@ +# Class: FishjamNotFoundException + +Defined in: [js-server-sdk/src/exceptions/index.ts:42](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L42) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new FishjamNotFoundException**(`info`): `FishjamNotFoundException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`FishjamNotFoundException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/FishjamWSNotifier.md b/versioned_docs/version-0.30.0/api/server/classes/FishjamWSNotifier.md new file mode 100644 index 00000000..08bcc3ca --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/FishjamWSNotifier.md @@ -0,0 +1,47 @@ +# Class: FishjamWSNotifier + +Defined in: [js-server-sdk/src/ws\_notifier.ts:12](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/ws_notifier.ts#L12) + +Notifier object that can be used to get notified about various events related to the Fishjam App. + +## Extends + +- `TypedEventEmitter`\<[`NotificationEvents`](../type-aliases/NotificationEvents.md), `this`\> + +## Constructors + +### Constructor + +> **new FishjamWSNotifier**(`config`, `onError`, `onClose`): `FishjamWSNotifier` + +Defined in: [js-server-sdk/src/ws\_notifier.ts:15](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/ws_notifier.ts#L15) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`FishjamConfig`](../type-aliases/FishjamConfig.md) | +| `onError` | [`ErrorEventHandler`](../type-aliases/ErrorEventHandler.md) | +| `onClose` | [`CloseEventHandler`](../type-aliases/CloseEventHandler.md) | + +#### Returns + +`FishjamWSNotifier` + +#### Overrides + +`(EventEmitter as new () => TypedEmitter).constructor` + +## Methods + +### disconnect() + +> **disconnect**(): `void` + +Defined in: [js-server-sdk/src/ws\_notifier.ts:34](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/ws_notifier.ts#L34) + +Close the underlying WebSocket and stop emitting notifications. + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/server/classes/ForbiddenException.md b/versioned_docs/version-0.30.0/api/server/classes/ForbiddenException.md new file mode 100644 index 00000000..0a339905 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/ForbiddenException.md @@ -0,0 +1,53 @@ +# Class: ForbiddenException + +Defined in: [js-server-sdk/src/exceptions/index.ts:38](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L38) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new ForbiddenException**(`info`): `ForbiddenException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`ForbiddenException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/InvalidFishjamCredentialsException.md b/versioned_docs/version-0.30.0/api/server/classes/InvalidFishjamCredentialsException.md new file mode 100644 index 00000000..19efb216 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/InvalidFishjamCredentialsException.md @@ -0,0 +1,53 @@ +# Class: InvalidFishjamCredentialsException + +Defined in: [js-server-sdk/src/exceptions/index.ts:44](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L44) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new InvalidFishjamCredentialsException**(`info`): `InvalidFishjamCredentialsException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`InvalidFishjamCredentialsException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/MissingFishjamIdException.md b/versioned_docs/version-0.30.0/api/server/classes/MissingFishjamIdException.md new file mode 100644 index 00000000..16eab04d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/MissingFishjamIdException.md @@ -0,0 +1,23 @@ +# Class: MissingFishjamIdException + +Defined in: [js-server-sdk/src/exceptions/index.ts:1](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L1) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new MissingFishjamIdException**(): `MissingFishjamIdException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:2](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L2) + +#### Returns + +`MissingFishjamIdException` + +#### Overrides + +`Error.constructor` diff --git a/versioned_docs/version-0.30.0/api/server/classes/PeerNotFoundException.md b/versioned_docs/version-0.30.0/api/server/classes/PeerNotFoundException.md new file mode 100644 index 00000000..d48f3898 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/PeerNotFoundException.md @@ -0,0 +1,53 @@ +# Class: PeerNotFoundException + +Defined in: [js-server-sdk/src/exceptions/index.ts:46](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L46) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new PeerNotFoundException**(`info`): `PeerNotFoundException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`PeerNotFoundException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/QuotaExceededException.md b/versioned_docs/version-0.30.0/api/server/classes/QuotaExceededException.md new file mode 100644 index 00000000..cf621b53 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/QuotaExceededException.md @@ -0,0 +1,53 @@ +# Class: QuotaExceededException + +Defined in: [js-server-sdk/src/exceptions/index.ts:52](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L52) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new QuotaExceededException**(`info`): `QuotaExceededException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`QuotaExceededException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/RecordingNotFoundException.md b/versioned_docs/version-0.30.0/api/server/classes/RecordingNotFoundException.md new file mode 100644 index 00000000..88c43612 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/RecordingNotFoundException.md @@ -0,0 +1,53 @@ +# Class: RecordingNotFoundException + +Defined in: [js-server-sdk/src/exceptions/index.ts:48](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L48) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new RecordingNotFoundException**(`info`): `RecordingNotFoundException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`RecordingNotFoundException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/RoomNotFoundException.md b/versioned_docs/version-0.30.0/api/server/classes/RoomNotFoundException.md new file mode 100644 index 00000000..3db2654d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/RoomNotFoundException.md @@ -0,0 +1,53 @@ +# Class: RoomNotFoundException + +Defined in: [js-server-sdk/src/exceptions/index.ts:40](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L40) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new RoomNotFoundException**(`info`): `RoomNotFoundException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`RoomNotFoundException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/ServiceUnavailableException.md b/versioned_docs/version-0.30.0/api/server/classes/ServiceUnavailableException.md new file mode 100644 index 00000000..3089ffe8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/ServiceUnavailableException.md @@ -0,0 +1,53 @@ +# Class: ServiceUnavailableException + +Defined in: [js-server-sdk/src/exceptions/index.ts:50](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L50) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new ServiceUnavailableException**(`info`): `ServiceUnavailableException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`ServiceUnavailableException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/StaleSdkException.md b/versioned_docs/version-0.30.0/api/server/classes/StaleSdkException.md new file mode 100644 index 00000000..6e48487f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/StaleSdkException.md @@ -0,0 +1,39 @@ +# Class: StaleSdkException + +Defined in: [js-server-sdk/src/exceptions/index.ts:7](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L7) + +## Extends + +- `Error` + +## Constructors + +### Constructor + +> **new StaleSdkException**(`status`): `StaleSdkException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:10](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L10) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `status` | `number` | + +#### Returns + +`StaleSdkException` + +#### Overrides + +`Error.constructor` + +## Properties + +### status + +> **status**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:9](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L9) + +Raw wire value received from the server. diff --git a/versioned_docs/version-0.30.0/api/server/classes/UnauthorizedException.md b/versioned_docs/version-0.30.0/api/server/classes/UnauthorizedException.md new file mode 100644 index 00000000..654a5587 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/UnauthorizedException.md @@ -0,0 +1,53 @@ +# Class: UnauthorizedException + +Defined in: [js-server-sdk/src/exceptions/index.ts:36](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L36) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new UnauthorizedException**(`info`): `UnauthorizedException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`UnauthorizedException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/classes/UnknownException.md b/versioned_docs/version-0.30.0/api/server/classes/UnknownException.md new file mode 100644 index 00000000..b958a7d7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/classes/UnknownException.md @@ -0,0 +1,53 @@ +# Class: UnknownException + +Defined in: [js-server-sdk/src/exceptions/index.ts:54](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L54) + +## Extends + +- [`FishjamBaseException`](FishjamBaseException.md) + +## Constructors + +### Constructor + +> **new UnknownException**(`info`): `UnknownException` + +Defined in: [js-server-sdk/src/exceptions/index.ts:27](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L27) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | [`FishjamExceptionInfo`](../interfaces/FishjamExceptionInfo.md) | + +#### Returns + +`UnknownException` + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`constructor`](FishjamBaseException.md#constructor) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L26) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`details`](FishjamBaseException.md#details) + +*** + +### statusCode + +> **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L25) + +#### Inherited from + +[`FishjamBaseException`](FishjamBaseException.md).[`statusCode`](FishjamBaseException.md#statuscode) diff --git a/versioned_docs/version-0.30.0/api/server/functions/decodeServerNotifications.md b/versioned_docs/version-0.30.0/api/server/functions/decodeServerNotifications.md new file mode 100644 index 00000000..94e0bfe8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/functions/decodeServerNotifications.md @@ -0,0 +1,41 @@ +# Function: decodeServerNotifications() + +> **decodeServerNotifications**(`data`): [`ServerNotification`](../type-aliases/ServerNotification.md)[] + +Defined in: [js-server-sdk/src/webhook.ts:33](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/webhook.ts#L33) + +Decode a raw Fishjam webhook body (`application/x-protobuf`) into typed, +mapped notifications. + +A room/stream created with `batchWebhookNotifications: true` may deliver +several notifications coalesced into a single `NotificationBatch`; this helper +transparently unwraps that batch, so a single message and a batch are handled +the same way. Notifications are returned in wire order, with the same payload +mapping the [FishjamWSNotifier](../classes/FishjamWSNotifier.md) applies (branded ids, `peerType`/`track` +enums). Non-surfaced variants (handshake, deprecated) are omitted. + +Accepts a Node `Buffer` (a `Uint8Array` subclass), a `Uint8Array`, or an +`ArrayBuffer`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `data` | `ArrayBuffer` \| `Uint8Array`\<`ArrayBufferLike`\> | + +## Returns + +[`ServerNotification`](../type-aliases/ServerNotification.md)[] + +## Example + +```ts +import { decodeServerNotifications } from '@fishjam-cloud/js-server-sdk'; + +declare const body: Uint8Array; +declare const handlePeerConnected: (notification: unknown) => void; +// ---cut--- +for (const { type, notification } of decodeServerNotifications(body)) { + if (type === 'peerConnected') handlePeerConnected(notification); +} +``` diff --git a/versioned_docs/version-0.30.0/api/server/functions/verifyWebhookSignature.md b/versioned_docs/version-0.30.0/api/server/functions/verifyWebhookSignature.md new file mode 100644 index 00000000..80ac3d17 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/functions/verifyWebhookSignature.md @@ -0,0 +1,41 @@ +# Function: verifyWebhookSignature() + +> **verifyWebhookSignature**(`body`, `signature`, `secret`): `boolean` + +Defined in: [js-server-sdk/src/webhook.ts:61](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/webhook.ts#L61) + +Verify the signature of a raw Fishjam webhook request. + +Fishjam signs each webhook delivery with the room's signing secret and sends +the result in the `x-fishjam-signature-256` header as +`sha256=`. Pass the raw, +not-yet-decoded request body, the header value, and your secret; the comparison +is constant-time (signatures of the wrong length are rejected early, which +leaks only the expected signature length — public knowledge for SHA-256). +Verify before calling [decodeServerNotifications](decodeServerNotifications.md). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `body` | `ArrayBuffer` \| `Uint8Array`\<`ArrayBufferLike`\> | +| `signature` | `string` | +| `secret` | `string` | + +## Returns + +`boolean` + +## Example + +```ts +import { verifyWebhookSignature, decodeServerNotifications } from '@fishjam-cloud/js-server-sdk'; + +declare const body: Uint8Array; +declare const signatureHeader: string; +// ---cut--- +if (!verifyWebhookSignature(body, signatureHeader, process.env.WEBHOOK_SECRET!)) { + throw new Error('Invalid webhook signature'); +} +const notifications = decodeServerNotifications(body); +``` diff --git a/versioned_docs/version-0.30.0/api/server/index.md b/versioned_docs/version-0.30.0/api/server/index.md new file mode 100644 index 00000000..34045486 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/index.md @@ -0,0 +1,102 @@ +# @fishjam-cloud/js-server-sdk + +Server-side Node.js SDK for creating and managing Fishjam rooms, peers, agents, and receiving real-time server notifications. + +## Client + +- [FishjamClient](classes/FishjamClient.md) +- [FishjamWSNotifier](classes/FishjamWSNotifier.md) + +## Notifications + +- [decodeServerNotifications](functions/decodeServerNotifications.md) +- [verifyWebhookSignature](functions/verifyWebhookSignature.md) + +## Other + +- [BadRequestException](classes/BadRequestException.md) +- [FishjamAgent](classes/FishjamAgent.md) +- [FishjamBaseException](classes/FishjamBaseException.md) +- [FishjamNotFoundException](classes/FishjamNotFoundException.md) +- [ForbiddenException](classes/ForbiddenException.md) +- [InvalidFishjamCredentialsException](classes/InvalidFishjamCredentialsException.md) +- [MissingFishjamIdException](classes/MissingFishjamIdException.md) +- [PeerNotFoundException](classes/PeerNotFoundException.md) +- [QuotaExceededException](classes/QuotaExceededException.md) +- [RecordingNotFoundException](classes/RecordingNotFoundException.md) +- [RoomNotFoundException](classes/RoomNotFoundException.md) +- [ServiceUnavailableException](classes/ServiceUnavailableException.md) +- [StaleSdkException](classes/StaleSdkException.md) +- [UnauthorizedException](classes/UnauthorizedException.md) +- [UnknownException](classes/UnknownException.md) +- [FishjamExceptionInfo](interfaces/FishjamExceptionInfo.md) +- [MoqAccess](interfaces/MoqAccess.md) +- [MoqAccessConfig](interfaces/MoqAccessConfig.md) +- [PeerOptionsAgent](interfaces/PeerOptionsAgent.md) +- [PeerOptionsVapi](interfaces/PeerOptionsVapi.md) +- [PeerOptionsWebRTC](interfaces/PeerOptionsWebRTC.md) +- [RecordingConfig](interfaces/RecordingConfig.md) +- [RecordingSource](interfaces/RecordingSource.md) +- [RoomConfig](interfaces/RoomConfig.md) +- [ServerMessage](interfaces/ServerMessage.md) +- [StreamerToken](interfaces/StreamerToken.md) +- [ViewerToken](interfaces/ViewerToken.md) +- [AgentCallbacks](type-aliases/AgentCallbacks.md) +- [AgentEvents](type-aliases/AgentEvents.md) +- [AgentTrack](type-aliases/AgentTrack.md) +- [AudioCodecParameters](type-aliases/AudioCodecParameters.md) +- [Brand](type-aliases/Brand.md) +- [ChannelAdded](type-aliases/ChannelAdded.md) +- [ChannelRemoved](type-aliases/ChannelRemoved.md) +- [CloseEventHandler](type-aliases/CloseEventHandler.md) +- [ErrorEventHandler](type-aliases/ErrorEventHandler.md) +- [ExpectedAgentEvents](type-aliases/ExpectedAgentEvents.md) +- [ExpectedEvents](type-aliases/ExpectedEvents.md) +- [FishjamConfig](type-aliases/FishjamConfig.md) +- [IgnoredEvents](type-aliases/IgnoredEvents.md) +- [IncomingTrackData](type-aliases/IncomingTrackData.md) +- [IncomingTrackImage](type-aliases/IncomingTrackImage.md) +- [NotificationEvents](type-aliases/NotificationEvents.md) +- [OutgoingTrackData](type-aliases/OutgoingTrackData.md) +- [Override](type-aliases/Override.md) +- [Peer](type-aliases/Peer.md) +- [PeerAdded](type-aliases/PeerAdded.md) +- [PeerConnected](type-aliases/PeerConnected.md) +- [PeerCrashed](type-aliases/PeerCrashed.md) +- [PeerDeleted](type-aliases/PeerDeleted.md) +- [PeerDisconnected](type-aliases/PeerDisconnected.md) +- [PeerId](type-aliases/PeerId.md) +- [PeerMetadataUpdated](type-aliases/PeerMetadataUpdated.md) +- [PeerOptions](type-aliases/PeerOptions.md) +- [PeerStatus](type-aliases/PeerStatus.md) +- [PeerType](type-aliases/PeerType.md) +- [Recording](type-aliases/Recording.md) +- [RecordingId](type-aliases/RecordingId.md) +- [RecordingStatus](type-aliases/RecordingStatus.md) +- [RecordingStatusChanged](type-aliases/RecordingStatusChanged.md) +- [Room](type-aliases/Room.md) +- [RoomCrashed](type-aliases/RoomCrashed.md) +- [RoomCreated](type-aliases/RoomCreated.md) +- [RoomDeleted](type-aliases/RoomDeleted.md) +- [RoomId](type-aliases/RoomId.md) +- [RoomType](type-aliases/RoomType.md) +- [ServerNotification](type-aliases/ServerNotification.md) +- [StreamerConnected](type-aliases/StreamerConnected.md) +- [StreamerDisconnected](type-aliases/StreamerDisconnected.md) +- [Track](type-aliases/Track.md) +- [TrackAdded](type-aliases/TrackAdded.md) +- [TrackForwarding](type-aliases/TrackForwarding.md) +- [TrackForwardingRemoved](type-aliases/TrackForwardingRemoved.md) +- [TrackId](type-aliases/TrackId.md) +- [TrackMetadataUpdated](type-aliases/TrackMetadataUpdated.md) +- [TrackRemoved](type-aliases/TrackRemoved.md) +- [TrackType](type-aliases/TrackType.md) +- [VadNotification](type-aliases/VadNotification.md) +- [VadStatus](type-aliases/VadStatus.md) +- [VideoCodec](type-aliases/VideoCodec.md) +- [ViewerConnected](type-aliases/ViewerConnected.md) +- [ViewerDisconnected](type-aliases/ViewerDisconnected.md) +- [PeerStatus](variables/PeerStatus.md) +- [RoomType](variables/RoomType.md) +- [ServerMessage](variables/ServerMessage.md) +- [VideoCodec](variables/VideoCodec.md) diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/FishjamExceptionInfo.md b/versioned_docs/version-0.30.0/api/server/interfaces/FishjamExceptionInfo.md new file mode 100644 index 00000000..999e5f08 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/FishjamExceptionInfo.md @@ -0,0 +1,27 @@ +# Interface: FishjamExceptionInfo + +Defined in: [js-server-sdk/src/exceptions/index.ts:18](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L18) + +## Properties + +### details? + +> `optional` **details**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:21](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L21) + +*** + +### message + +> **message**: `string` + +Defined in: [js-server-sdk/src/exceptions/index.ts:19](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L19) + +*** + +### statusCode? + +> `optional` **statusCode**: `number` + +Defined in: [js-server-sdk/src/exceptions/index.ts:20](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/exceptions/index.ts#L20) diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccess.md b/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccess.md new file mode 100644 index 00000000..10d48953 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccess.md @@ -0,0 +1,37 @@ +# Interface: MoqAccess + +Defined in: fishjam-openapi/dist/index.d.ts:234 + +Connection details for a MoQ relay client + +## Export + +MoqAccess + +## Properties + +### connection\_url + +> **connection\_url**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:240 + +Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK. + +#### Memberof + +MoqAccess + +*** + +### token + +> **token**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:246 + +JWT authorizing the MoQ relay connection, also embedded in `connection_url` + +#### Memberof + +MoqAccess diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccessConfig.md b/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccessConfig.md new file mode 100644 index 00000000..61c192f0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/MoqAccessConfig.md @@ -0,0 +1,37 @@ +# Interface: MoqAccessConfig + +Defined in: fishjam-openapi/dist/index.d.ts:273 + +MoQ access configuration + +## Export + +MoqAccessConfig + +## Properties + +### publishPath? + +> `optional` **publishPath**: `null` \| `string` + +Defined in: fishjam-openapi/dist/index.d.ts:279 + +Path under the root the token grants publish access to + +#### Memberof + +MoqAccessConfig + +*** + +### subscribePath? + +> `optional` **subscribePath**: `null` \| `string` + +Defined in: fishjam-openapi/dist/index.d.ts:285 + +Path under the root the token grants subscribe access to + +#### Memberof + +MoqAccessConfig diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsAgent.md b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsAgent.md new file mode 100644 index 00000000..b027834e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsAgent.md @@ -0,0 +1,33 @@ +# Interface: PeerOptionsAgent + +Defined in: fishjam-openapi/dist/index.d.ts:807 + +Options specific to the Agent peer + +## Export + +PeerOptionsAgent + +## Properties + +### output? + +> `optional` **output**: `AgentOutput` + +Defined in: fishjam-openapi/dist/index.d.ts:813 + +#### Memberof + +PeerOptionsAgent + +*** + +### subscribeMode? + +> `optional` **subscribeMode**: `SubscribeMode` + +Defined in: fishjam-openapi/dist/index.d.ts:819 + +#### Memberof + +PeerOptionsAgent diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsVapi.md b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsVapi.md new file mode 100644 index 00000000..5f7a1a3c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsVapi.md @@ -0,0 +1,49 @@ +# Interface: PeerOptionsVapi + +Defined in: fishjam-openapi/dist/index.d.ts:894 + +Options specific to the VAPI peer + +## Export + +PeerOptionsVapi + +## Properties + +### apiKey + +> **apiKey**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:900 + +VAPI API key + +#### Memberof + +PeerOptionsVapi + +*** + +### callId + +> **callId**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:906 + +VAPI call ID + +#### Memberof + +PeerOptionsVapi + +*** + +### subscribeMode? + +> `optional` **subscribeMode**: `SubscribeMode` + +Defined in: fishjam-openapi/dist/index.d.ts:912 + +#### Memberof + +PeerOptionsVapi diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsWebRTC.md b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsWebRTC.md new file mode 100644 index 00000000..27b2ec57 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/PeerOptionsWebRTC.md @@ -0,0 +1,39 @@ +# Interface: PeerOptionsWebRTC + +Defined in: fishjam-openapi/dist/index.d.ts:987 + +Options specific to the WebRTC peer + +## Export + +PeerOptionsWebRTC + +## Properties + +### metadata? + +> `optional` **metadata**: `object` + +Defined in: fishjam-openapi/dist/index.d.ts:993 + +Custom peer metadata + +#### Index Signature + +\[`key`: `string`\]: `any` + +#### Memberof + +PeerOptionsWebRTC + +*** + +### subscribeMode? + +> `optional` **subscribeMode**: `SubscribeMode` + +Defined in: fishjam-openapi/dist/index.d.ts:1001 + +#### Memberof + +PeerOptionsWebRTC diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/RecordingConfig.md b/versioned_docs/version-0.30.0/api/server/interfaces/RecordingConfig.md new file mode 100644 index 00000000..6307f920 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/RecordingConfig.md @@ -0,0 +1,35 @@ +# Interface: RecordingConfig + +Defined in: fishjam-openapi/dist/index.d.ts:393 + +Recording configuration + +## Export + +RecordingConfig + +## Properties + +### metadata? + +> `optional` **metadata**: `null` \| \{[`key`: `string`]: `any`; \} + +Defined in: fishjam-openapi/dist/index.d.ts:399 + +Free-form, user-supplied metadata used to organize and filter recordings + +#### Memberof + +RecordingConfig + +*** + +### source + +> **source**: [`RecordingSource`](RecordingSource.md) + +Defined in: fishjam-openapi/dist/index.d.ts:407 + +#### Memberof + +RecordingConfig diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/RecordingSource.md b/versioned_docs/version-0.30.0/api/server/interfaces/RecordingSource.md new file mode 100644 index 00000000..55ccdf92 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/RecordingSource.md @@ -0,0 +1,51 @@ +# Interface: RecordingSource + +Defined in: fishjam-openapi/dist/index.d.ts:347 + +The source for the recording + +## Export + +RecordingSource + +## Properties + +### compositionURL + +> **compositionURL**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:353 + +URL of the composition to record + +#### Memberof + +RecordingSource + +*** + +### outputId + +> **outputId**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:359 + +Id of the output being recorded + +#### Memberof + +RecordingSource + +*** + +### scaleRatio? + +> `optional` **scaleRatio**: `number` + +Defined in: fishjam-openapi/dist/index.d.ts:365 + +Scale factor for the recording relative to the source output (>0; may upscale or downscale). Defaults to 1. + +#### Memberof + +RecordingSource diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/RoomConfig.md b/versioned_docs/version-0.30.0/api/server/interfaces/RoomConfig.md new file mode 100644 index 00000000..26e03010 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/RoomConfig.md @@ -0,0 +1,91 @@ +# Interface: RoomConfig + +Defined in: fishjam-openapi/dist/index.d.ts:1542 + +Room configuration + +## Export + +RoomConfig + +## Properties + +### batchWebhookNotifications? + +> `optional` **batchWebhookNotifications**: `boolean` + +Defined in: fishjam-openapi/dist/index.d.ts:1548 + +If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. + +#### Memberof + +RoomConfig + +*** + +### maxPeers? + +> `optional` **maxPeers**: `null` \| `number` + +Defined in: fishjam-openapi/dist/index.d.ts:1554 + +Maximum amount of peers allowed into the room + +#### Memberof + +RoomConfig + +*** + +### public? + +> `optional` **public**: `boolean` + +Defined in: fishjam-openapi/dist/index.d.ts:1560 + +True if livestream viewers can omit specifying a token. + +#### Memberof + +RoomConfig + +*** + +### roomType? + +> `optional` **roomType**: [`RoomType`](../type-aliases/RoomType.md) + +Defined in: fishjam-openapi/dist/index.d.ts:1566 + +#### Memberof + +RoomConfig + +*** + +### videoCodec? + +> `optional` **videoCodec**: [`VideoCodec`](../type-aliases/VideoCodec.md) + +Defined in: fishjam-openapi/dist/index.d.ts:1572 + +#### Memberof + +RoomConfig + +*** + +### ~~webhookUrl?~~ + +> `optional` **webhookUrl**: `null` \| `string` + +Defined in: fishjam-openapi/dist/index.d.ts:1579 + +Deprecated: configure the webhook in the Dashboard instead. URL where Fishjam notifications will be sent; overrides the Dashboard-configured webhook URL + +#### Memberof + +RoomConfig + +#### Deprecated diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/ServerMessage.md b/versioned_docs/version-0.30.0/api/server/interfaces/ServerMessage.md new file mode 100644 index 00000000..aaf8825b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/ServerMessage.md @@ -0,0 +1,283 @@ +# Interface: ServerMessage + +Defined in: fishjam-proto/dist/index.d.ts:82 + +Defines any type of message passed between FJ and server peer + +## Properties + +### authenticated? + +> `optional` **authenticated**: `ServerMessage_Authenticated` + +Defined in: fishjam-proto/dist/index.d.ts:83 + +*** + +### authRequest? + +> `optional` **authRequest**: `ServerMessage_AuthRequest` + +Defined in: fishjam-proto/dist/index.d.ts:84 + +*** + +### channelAdded? + +> `optional` **channelAdded**: `ServerMessage_ChannelAdded` + +Defined in: fishjam-proto/dist/index.d.ts:99 + +*** + +### channelRemoved? + +> `optional` **channelRemoved**: `ServerMessage_ChannelRemoved` + +Defined in: fishjam-proto/dist/index.d.ts:100 + +*** + +### ~~componentCrashed?~~ + +> `optional` **componentCrashed**: `ServerMessage_ComponentCrashed` + +Defined in: fishjam-proto/dist/index.d.ts:122 + +#### Deprecated + +*** + +### ~~hlsPlayable?~~ + +> `optional` **hlsPlayable**: `ServerMessage_HlsPlayable` + +Defined in: fishjam-proto/dist/index.d.ts:116 + +#### Deprecated + +*** + +### ~~hlsUploadCrashed?~~ + +> `optional` **hlsUploadCrashed**: `ServerMessage_HlsUploadCrashed` + +Defined in: fishjam-proto/dist/index.d.ts:120 + +#### Deprecated + +*** + +### ~~hlsUploaded?~~ + +> `optional` **hlsUploaded**: `ServerMessage_HlsUploaded` + +Defined in: fishjam-proto/dist/index.d.ts:118 + +#### Deprecated + +*** + +### notificationBatch? + +> `optional` **notificationBatch**: `ServerMessage_NotificationBatch` + +Defined in: fishjam-proto/dist/index.d.ts:110 + +Batch + +*** + +### peerAdded? + +> `optional` **peerAdded**: `ServerMessage_PeerAdded` + +Defined in: fishjam-proto/dist/index.d.ts:97 + +*** + +### peerConnected? + +> `optional` **peerConnected**: `ServerMessage_PeerConnected` + +Defined in: fishjam-proto/dist/index.d.ts:90 + +*** + +### peerCrashed? + +> `optional` **peerCrashed**: `ServerMessage_PeerCrashed` + +Defined in: fishjam-proto/dist/index.d.ts:92 + +*** + +### peerDeleted? + +> `optional` **peerDeleted**: `ServerMessage_PeerDeleted` + +Defined in: fishjam-proto/dist/index.d.ts:98 + +*** + +### peerDisconnected? + +> `optional` **peerDisconnected**: `ServerMessage_PeerDisconnected` + +Defined in: fishjam-proto/dist/index.d.ts:91 + +*** + +### peerMetadataUpdated? + +> `optional` **peerMetadataUpdated**: `ServerMessage_PeerMetadataUpdated` + +Defined in: fishjam-proto/dist/index.d.ts:93 + +*** + +### recordingStatusChanged? + +> `optional` **recordingStatusChanged**: `ServerMessage_RecordingStatusChanged` + +Defined in: fishjam-proto/dist/index.d.ts:108 + +*** + +### roomCrashed? + +> `optional` **roomCrashed**: `ServerMessage_RoomCrashed` + +Defined in: fishjam-proto/dist/index.d.ts:89 + +*** + +### roomCreated? + +> `optional` **roomCreated**: `ServerMessage_RoomCreated` + +Defined in: fishjam-proto/dist/index.d.ts:87 + +*** + +### roomDeleted? + +> `optional` **roomDeleted**: `ServerMessage_RoomDeleted` + +Defined in: fishjam-proto/dist/index.d.ts:88 + +*** + +### ~~streamConnected?~~ + +> `optional` **streamConnected**: `ServerMessage_StreamConnected` + +Defined in: fishjam-proto/dist/index.d.ts:112 + +#### Deprecated + +*** + +### ~~streamDisconnected?~~ + +> `optional` **streamDisconnected**: `ServerMessage_StreamDisconnected` + +Defined in: fishjam-proto/dist/index.d.ts:114 + +#### Deprecated + +*** + +### streamerConnected? + +> `optional` **streamerConnected**: `ServerMessage_StreamerConnected` + +Defined in: fishjam-proto/dist/index.d.ts:106 + +*** + +### streamerDisconnected? + +> `optional` **streamerDisconnected**: `ServerMessage_StreamerDisconnected` + +Defined in: fishjam-proto/dist/index.d.ts:107 + +*** + +### subscribeRequest? + +> `optional` **subscribeRequest**: `ServerMessage_SubscribeRequest` + +Defined in: fishjam-proto/dist/index.d.ts:85 + +*** + +### subscribeResponse? + +> `optional` **subscribeResponse**: `ServerMessage_SubscribeResponse` + +Defined in: fishjam-proto/dist/index.d.ts:86 + +*** + +### trackAdded? + +> `optional` **trackAdded**: `ServerMessage_TrackAdded` + +Defined in: fishjam-proto/dist/index.d.ts:94 + +*** + +### trackForwarding? + +> `optional` **trackForwarding**: `ServerMessage_TrackForwarding` + +Defined in: fishjam-proto/dist/index.d.ts:101 + +*** + +### trackForwardingRemoved? + +> `optional` **trackForwardingRemoved**: `ServerMessage_TrackForwardingRemoved` + +Defined in: fishjam-proto/dist/index.d.ts:102 + +*** + +### trackMetadataUpdated? + +> `optional` **trackMetadataUpdated**: `ServerMessage_TrackMetadataUpdated` + +Defined in: fishjam-proto/dist/index.d.ts:96 + +*** + +### trackRemoved? + +> `optional` **trackRemoved**: `ServerMessage_TrackRemoved` + +Defined in: fishjam-proto/dist/index.d.ts:95 + +*** + +### vadNotification? + +> `optional` **vadNotification**: `ServerMessage_VadNotification` + +Defined in: fishjam-proto/dist/index.d.ts:103 + +*** + +### viewerConnected? + +> `optional` **viewerConnected**: `ServerMessage_ViewerConnected` + +Defined in: fishjam-proto/dist/index.d.ts:104 + +*** + +### viewerDisconnected? + +> `optional` **viewerDisconnected**: `ServerMessage_ViewerDisconnected` + +Defined in: fishjam-proto/dist/index.d.ts:105 diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/StreamerToken.md b/versioned_docs/version-0.30.0/api/server/interfaces/StreamerToken.md new file mode 100644 index 00000000..6c94c71f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/StreamerToken.md @@ -0,0 +1,23 @@ +# Interface: StreamerToken + +Defined in: fishjam-openapi/dist/index.d.ts:2180 + +Streamer authorization token + +## Export + +StreamerToken + +## Properties + +### token + +> **token**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:2186 + +Token streamer should authorize with + +#### Memberof + +StreamerToken diff --git a/versioned_docs/version-0.30.0/api/server/interfaces/ViewerToken.md b/versioned_docs/version-0.30.0/api/server/interfaces/ViewerToken.md new file mode 100644 index 00000000..d457fb8a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/interfaces/ViewerToken.md @@ -0,0 +1,23 @@ +# Interface: ViewerToken + +Defined in: fishjam-openapi/dist/index.d.ts:2692 + +Viewer authorization token + +## Export + +ViewerToken + +## Properties + +### token + +> **token**: `string` + +Defined in: fishjam-openapi/dist/index.d.ts:2698 + +Token viewer should authorize with + +#### Memberof + +ViewerToken diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/AgentCallbacks.md b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentCallbacks.md new file mode 100644 index 00000000..9a89ad39 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentCallbacks.md @@ -0,0 +1,21 @@ +# Type Alias: AgentCallbacks + +> **AgentCallbacks** = `object` + +Defined in: [js-server-sdk/src/types.ts:101](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L101) + +## Properties + +### onClose? + +> `optional` **onClose**: [`CloseEventHandler`](CloseEventHandler.md) + +Defined in: [js-server-sdk/src/types.ts:103](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L103) + +*** + +### onError? + +> `optional` **onError**: [`ErrorEventHandler`](ErrorEventHandler.md) + +Defined in: [js-server-sdk/src/types.ts:102](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L102) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/AgentEvents.md b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentEvents.md new file mode 100644 index 00000000..c2424c67 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentEvents.md @@ -0,0 +1,5 @@ +# Type Alias: AgentEvents + +> **AgentEvents** = `{ [K in ExpectedAgentEvents]: (message: Override, { peerId: PeerId }>) => void }` + +Defined in: [js-server-sdk/src/agent.ts:43](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L43) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/AgentTrack.md b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentTrack.md new file mode 100644 index 00000000..298d004a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/AgentTrack.md @@ -0,0 +1,5 @@ +# Type Alias: AgentTrack + +> **AgentTrack** = [`Override`](Override.md)\<`ProtoTrack`, \{ `id`: [`TrackId`](TrackId.md); \}\> + +Defined in: [js-server-sdk/src/agent.ts:28](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L28) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/AudioCodecParameters.md b/versioned_docs/version-0.30.0/api/server/type-aliases/AudioCodecParameters.md new file mode 100644 index 00000000..3918c919 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/AudioCodecParameters.md @@ -0,0 +1,29 @@ +# Type Alias: AudioCodecParameters + +> **AudioCodecParameters** = `object` + +Defined in: [js-server-sdk/src/agent.ts:30](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L30) + +## Properties + +### channels + +> **channels**: `1` + +Defined in: [js-server-sdk/src/agent.ts:33](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L33) + +*** + +### encoding + +> **encoding**: `"opus"` \| `"pcm16"` + +Defined in: [js-server-sdk/src/agent.ts:31](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L31) + +*** + +### sampleRate + +> **sampleRate**: `16000` \| `24000` \| `48000` + +Defined in: [js-server-sdk/src/agent.ts:32](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L32) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Brand.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Brand.md new file mode 100644 index 00000000..6b245e95 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Brand.md @@ -0,0 +1,20 @@ +# Type Alias: Brand\ + +> **Brand**\<`T`, `TBrand`\> = `T` & `object` + +Defined in: [js-server-sdk/src/types.ts:14](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L14) + +Branded type helper + +## Type declaration + +### \[brand\] + +> **\[brand\]**: `TBrand` + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` | +| `TBrand` *extends* `string` | diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelAdded.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelAdded.md new file mode 100644 index 00000000..fdd8f7af --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelAdded.md @@ -0,0 +1,5 @@ +# Type Alias: ChannelAdded + +> **ChannelAdded** = `object`\[`"channelAdded"`\] + +Defined in: [js-server-sdk/src/notifications.ts:198](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L198) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelRemoved.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelRemoved.md new file mode 100644 index 00000000..456654fc --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ChannelRemoved.md @@ -0,0 +1,5 @@ +# Type Alias: ChannelRemoved + +> **ChannelRemoved** = `object`\[`"channelRemoved"`\] + +Defined in: [js-server-sdk/src/notifications.ts:199](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L199) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/CloseEventHandler.md b/versioned_docs/version-0.30.0/api/server/type-aliases/CloseEventHandler.md new file mode 100644 index 00000000..be6fc728 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/CloseEventHandler.md @@ -0,0 +1,16 @@ +# Type Alias: CloseEventHandler() + +> **CloseEventHandler** = (`code`, `reason`) => `void` + +Defined in: [js-server-sdk/src/types.ts:99](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L99) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `code` | `number` | +| `reason` | `string` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ErrorEventHandler.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ErrorEventHandler.md new file mode 100644 index 00000000..bef5573e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ErrorEventHandler.md @@ -0,0 +1,15 @@ +# Type Alias: ErrorEventHandler() + +> **ErrorEventHandler** = (`msg`) => `void` + +Defined in: [js-server-sdk/src/types.ts:98](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L98) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `msg` | `Event` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedAgentEvents.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedAgentEvents.md new file mode 100644 index 00000000..76be1a88 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedAgentEvents.md @@ -0,0 +1,5 @@ +# Type Alias: ExpectedAgentEvents + +> **ExpectedAgentEvents** = `"trackData"` + +Defined in: [js-server-sdk/src/agent.ts:22](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L22) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedEvents.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedEvents.md new file mode 100644 index 00000000..3c55ca7d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ExpectedEvents.md @@ -0,0 +1,5 @@ +# Type Alias: ExpectedEvents + +> **ExpectedEvents** = *typeof* `expectedEventsList`\[`number`\] + +Defined in: [js-server-sdk/src/notifications.ts:88](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L88) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/FishjamConfig.md b/versioned_docs/version-0.30.0/api/server/type-aliases/FishjamConfig.md new file mode 100644 index 00000000..fafbcfa5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/FishjamConfig.md @@ -0,0 +1,21 @@ +# Type Alias: FishjamConfig + +> **FishjamConfig** = `object` + +Defined in: [js-server-sdk/src/types.ts:83](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L83) + +## Properties + +### fishjamId + +> **fishjamId**: `string` + +Defined in: [js-server-sdk/src/types.ts:88](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L88) + +*** + +### managementToken + +> **managementToken**: `string` + +Defined in: [js-server-sdk/src/types.ts:94](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L94) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/IgnoredEvents.md b/versioned_docs/version-0.30.0/api/server/type-aliases/IgnoredEvents.md new file mode 100644 index 00000000..7caa30a0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/IgnoredEvents.md @@ -0,0 +1,5 @@ +# Type Alias: IgnoredEvents + +> **IgnoredEvents** = *typeof* `ignoredEventsList`\[`number`\] + +Defined in: [js-server-sdk/src/notifications.ts:112](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L112) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackData.md b/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackData.md new file mode 100644 index 00000000..3e3486da --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackData.md @@ -0,0 +1,5 @@ +# Type Alias: IncomingTrackData + +> **IncomingTrackData** = [`Override`](Override.md)\<`NonNullable`\<`AgentResponse_TrackData`\>, \{ `peerId`: [`PeerId`](PeerId.md); \}\> + +Defined in: [js-server-sdk/src/agent.ts:24](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L24) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackImage.md b/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackImage.md new file mode 100644 index 00000000..9fb5eb3a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/IncomingTrackImage.md @@ -0,0 +1,5 @@ +# Type Alias: IncomingTrackImage + +> **IncomingTrackImage** = `NonNullable`\<`AgentResponse_TrackImage`\> + +Defined in: [js-server-sdk/src/agent.ts:25](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L25) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/NotificationEvents.md b/versioned_docs/version-0.30.0/api/server/type-aliases/NotificationEvents.md new file mode 100644 index 00000000..89ba89b9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/NotificationEvents.md @@ -0,0 +1,5 @@ +# Type Alias: NotificationEvents + +> **NotificationEvents** = `{ [K in ExpectedEvents]: (message: { channelAdded: Notification<"channelAdded">; channelRemoved: Notification<"channelRemoved">; peerAdded: Notification<"peerAdded">; peerConnected: Notification<"peerConnected">; peerCrashed: Notification<"peerCrashed">; peerDeleted: Notification<"peerDeleted">; peerDisconnected: Notification<"peerDisconnected">; peerMetadataUpdated: Notification<"peerMetadataUpdated">; recordingStatusChanged: Notification<"recordingStatusChanged", { recordingId: RecordingId; status: RecordingStatus }>; roomCrashed: Notification<"roomCrashed">; roomCreated: Notification<"roomCreated">; roomDeleted: Notification<"roomDeleted">; streamerConnected: Notification<"streamerConnected">; streamerDisconnected: Notification<"streamerDisconnected">; trackAdded: Notification<"trackAdded">; trackForwarding: Notification<"trackForwarding">; trackForwardingRemoved: Notification<"trackForwardingRemoved">; trackMetadataUpdated: Notification<"trackMetadataUpdated">; trackRemoved: Notification<"trackRemoved">; vadNotification: Notification<"vadNotification">; viewerConnected: Notification<"viewerConnected">; viewerDisconnected: Notification<"viewerDisconnected"> }[K]) => void }` + +Defined in: [js-server-sdk/src/notifications.ts:240](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L240) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/OutgoingTrackData.md b/versioned_docs/version-0.30.0/api/server/type-aliases/OutgoingTrackData.md new file mode 100644 index 00000000..850db353 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/OutgoingTrackData.md @@ -0,0 +1,5 @@ +# Type Alias: OutgoingTrackData + +> **OutgoingTrackData** = [`Override`](Override.md)\<`NonNullable`\<`AgentRequest_TrackData`\>, \{ `peerId`: [`PeerId`](PeerId.md); \}\> + +Defined in: [js-server-sdk/src/agent.ts:26](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L26) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Override.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Override.md new file mode 100644 index 00000000..fe3a3829 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Override.md @@ -0,0 +1,23 @@ +# Type Alias: Override\ + +> **Override**\<`T`, `M`\> = \{ \[K in keyof T\]: K extends keyof M ? undefined extends T\[K\] ? M\[K\] \| undefined : M\[K\] : T\[K\] \} + +Defined in: [js-server-sdk/src/types.ts:28](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L28) + +Replaces the types of fields in `T` whose names appear in `M`, leaving the rest untouched. +Produces a flat object type (single mapped type, no `Omit & {...}` chain) so editor hover +displays the resulting properties directly. + +Keys present in `M` but not in `T` are ignored — only fields that already exist on `T` +are overridden, so a shared override map can be reused across multiple source types. + +`undefined` is re-added to the override when the original field allowed it, so optional +fields on generated proto types (e.g. `peerId?: string | undefined`) remain assignable +from `undefined` under `exactOptionalPropertyTypes`. + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` | +| `M` | diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Peer.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Peer.md new file mode 100644 index 00000000..249ed54f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Peer.md @@ -0,0 +1,5 @@ +# Type Alias: Peer + +> **Peer** = [`Override`](Override.md)\<`OpenApiPeer`, \{ `id`: [`PeerId`](PeerId.md); \}\> + +Defined in: [js-server-sdk/src/types.ts:42](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L42) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerAdded.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerAdded.md new file mode 100644 index 00000000..7ed079ed --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerAdded.md @@ -0,0 +1,5 @@ +# Type Alias: PeerAdded + +> **PeerAdded** = `object`\[`"peerAdded"`\] + +Defined in: [js-server-sdk/src/notifications.ts:182](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L182) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerConnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerConnected.md new file mode 100644 index 00000000..31542fea --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerConnected.md @@ -0,0 +1,5 @@ +# Type Alias: PeerConnected + +> **PeerConnected** = `object`\[`"peerConnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:184](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L184) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerCrashed.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerCrashed.md new file mode 100644 index 00000000..aa152cc6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerCrashed.md @@ -0,0 +1,5 @@ +# Type Alias: PeerCrashed + +> **PeerCrashed** = `object`\[`"peerCrashed"`\] + +Defined in: [js-server-sdk/src/notifications.ts:187](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L187) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDeleted.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDeleted.md new file mode 100644 index 00000000..4aa9608f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDeleted.md @@ -0,0 +1,5 @@ +# Type Alias: PeerDeleted + +> **PeerDeleted** = `object`\[`"peerDeleted"`\] + +Defined in: [js-server-sdk/src/notifications.ts:183](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L183) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDisconnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDisconnected.md new file mode 100644 index 00000000..90cfbc18 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerDisconnected.md @@ -0,0 +1,5 @@ +# Type Alias: PeerDisconnected + +> **PeerDisconnected** = `object`\[`"peerDisconnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:185](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L185) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerId.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerId.md new file mode 100644 index 00000000..bde1e00e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerId.md @@ -0,0 +1,7 @@ +# Type Alias: PeerId + +> **PeerId** = [`Brand`](Brand.md)\<`string`, `"PeerId"`\> + +Defined in: [js-server-sdk/src/types.ts:40](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L40) + +ID of Peer. Peer is associated with Room and can be created with [FishjamClient.createPeer](../classes/FishjamClient.md#createpeer). diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerMetadataUpdated.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerMetadataUpdated.md new file mode 100644 index 00000000..8889ce15 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerMetadataUpdated.md @@ -0,0 +1,5 @@ +# Type Alias: PeerMetadataUpdated + +> **PeerMetadataUpdated** = `object`\[`"peerMetadataUpdated"`\] + +Defined in: [js-server-sdk/src/notifications.ts:186](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L186) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerOptions.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerOptions.md new file mode 100644 index 00000000..55ce0602 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerOptions.md @@ -0,0 +1,5 @@ +# Type Alias: PeerOptions + +> **PeerOptions** = [`PeerOptionsWebRTC`](../interfaces/PeerOptionsWebRTC.md) \| [`PeerOptionsAgent`](../interfaces/PeerOptionsAgent.md) \| [`PeerOptionsVapi`](../interfaces/PeerOptionsVapi.md) + +Defined in: [js-server-sdk/src/index.ts:8](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/index.ts#L8) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerStatus.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerStatus.md new file mode 100644 index 00000000..2a9a4b05 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerStatus.md @@ -0,0 +1,5 @@ +# Type Alias: PeerStatus + +> **PeerStatus** = *typeof* [`PeerStatus`](../variables/PeerStatus.md)\[keyof *typeof* [`PeerStatus`](../variables/PeerStatus.md)\] + +Defined in: fishjam-openapi/dist/index.d.ts:1142 diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/PeerType.md b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerType.md new file mode 100644 index 00000000..8ece7781 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/PeerType.md @@ -0,0 +1,8 @@ +# Type Alias: PeerType + +> **PeerType** = `OpenApiPeerType` \| `"unspecified"` + +Defined in: [js-server-sdk/src/types.ts:48](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L48) + +Peer type as emitted by [FishjamWSNotifier](../classes/FishjamWSNotifier.md). Matches the REST API's `PeerType`, +with the addition of `'unspecified'` for messages whose peer type is not set on the wire. diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Recording.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Recording.md new file mode 100644 index 00000000..eabe489f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Recording.md @@ -0,0 +1,7 @@ +# Type Alias: Recording + +> **Recording** = [`Override`](Override.md)\<`OpenApiRecording`, \{ `id`: [`RecordingId`](RecordingId.md); `status`: [`RecordingStatus`](RecordingStatus.md); \}\> + +Defined in: [js-server-sdk/src/types.ts:75](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L75) + +A recording and its current lifecycle status. diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingId.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingId.md new file mode 100644 index 00000000..07274ba1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingId.md @@ -0,0 +1,8 @@ +# Type Alias: RecordingId + +> **RecordingId** = [`Brand`](Brand.md)\<`string`, `"RecordingId"`\> + +Defined in: [js-server-sdk/src/types.ts:65](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L65) + +ID of a recording. +Recording can be started with [FishjamClient.createRecording](../classes/FishjamClient.md#createrecording). diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatus.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatus.md new file mode 100644 index 00000000..a2270e7b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatus.md @@ -0,0 +1,7 @@ +# Type Alias: RecordingStatus + +> **RecordingStatus** = `"active"` \| `"finished"` \| `"available"` \| `"failed"` + +Defined in: [js-server-sdk/src/types.ts:70](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L70) + +Lifecycle status of a recording, as returned by the REST API and emitted by [FishjamWSNotifier](../classes/FishjamWSNotifier.md). diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatusChanged.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatusChanged.md new file mode 100644 index 00000000..eabbcc23 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RecordingStatusChanged.md @@ -0,0 +1,5 @@ +# Type Alias: RecordingStatusChanged + +> **RecordingStatusChanged** = `object`\[`"recordingStatusChanged"`\] + +Defined in: [js-server-sdk/src/notifications.ts:200](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L200) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Room.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Room.md new file mode 100644 index 00000000..6d234ecb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Room.md @@ -0,0 +1,29 @@ +# Type Alias: Room + +> **Room** = `object` + +Defined in: [js-server-sdk/src/types.ts:77](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L77) + +## Properties + +### config + +> **config**: [`RoomConfig`](../interfaces/RoomConfig.md) + +Defined in: [js-server-sdk/src/types.ts:80](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L80) + +*** + +### id + +> **id**: [`RoomId`](RoomId.md) + +Defined in: [js-server-sdk/src/types.ts:78](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L78) + +*** + +### peers + +> **peers**: [`Peer`](Peer.md)[] + +Defined in: [js-server-sdk/src/types.ts:79](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L79) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCrashed.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCrashed.md new file mode 100644 index 00000000..01d69ad1 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCrashed.md @@ -0,0 +1,5 @@ +# Type Alias: RoomCrashed + +> **RoomCrashed** = `object`\[`"roomCrashed"`\] + +Defined in: [js-server-sdk/src/notifications.ts:181](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L181) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCreated.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCreated.md new file mode 100644 index 00000000..c759e509 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomCreated.md @@ -0,0 +1,5 @@ +# Type Alias: RoomCreated + +> **RoomCreated** = `object`\[`"roomCreated"`\] + +Defined in: [js-server-sdk/src/notifications.ts:179](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L179) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RoomDeleted.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomDeleted.md new file mode 100644 index 00000000..8771d499 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomDeleted.md @@ -0,0 +1,5 @@ +# Type Alias: RoomDeleted + +> **RoomDeleted** = `object`\[`"roomDeleted"`\] + +Defined in: [js-server-sdk/src/notifications.ts:180](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L180) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RoomId.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomId.md new file mode 100644 index 00000000..554bf0db --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomId.md @@ -0,0 +1,8 @@ +# Type Alias: RoomId + +> **RoomId** = [`Brand`](Brand.md)\<`string`, `"RoomId"`\> + +Defined in: [js-server-sdk/src/types.ts:36](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L36) + +ID of the Room. +Room can be created with [FishjamClient.createRoom](../classes/FishjamClient.md#createroom). diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/RoomType.md b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomType.md new file mode 100644 index 00000000..57eb20cb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/RoomType.md @@ -0,0 +1,5 @@ +# Type Alias: RoomType + +> **RoomType** = *typeof* [`RoomType`](../variables/RoomType.md)\[keyof *typeof* [`RoomType`](../variables/RoomType.md)\] + +Defined in: fishjam-openapi/dist/index.d.ts:1484 diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ServerNotification.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ServerNotification.md new file mode 100644 index 00000000..c2fadbff --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ServerNotification.md @@ -0,0 +1,9 @@ +# Type Alias: ServerNotification + +> **ServerNotification** = `{ [K in ExpectedEvents]: { notification: { channelAdded: Notification<"channelAdded">; channelRemoved: Notification<"channelRemoved">; peerAdded: Notification<"peerAdded">; peerConnected: Notification<"peerConnected">; peerCrashed: Notification<"peerCrashed">; peerDeleted: Notification<"peerDeleted">; peerDisconnected: Notification<"peerDisconnected">; peerMetadataUpdated: Notification<"peerMetadataUpdated">; recordingStatusChanged: Notification<"recordingStatusChanged", { recordingId: RecordingId; status: RecordingStatus }>; roomCrashed: Notification<"roomCrashed">; roomCreated: Notification<"roomCreated">; roomDeleted: Notification<"roomDeleted">; streamerConnected: Notification<"streamerConnected">; streamerDisconnected: Notification<"streamerDisconnected">; trackAdded: Notification<"trackAdded">; trackForwarding: Notification<"trackForwarding">; trackForwardingRemoved: Notification<"trackForwardingRemoved">; trackMetadataUpdated: Notification<"trackMetadataUpdated">; trackRemoved: Notification<"trackRemoved">; vadNotification: Notification<"vadNotification">; viewerConnected: Notification<"viewerConnected">; viewerDisconnected: Notification<"viewerDisconnected"> }[K]; type: K } }`\[[`ExpectedEvents`](ExpectedEvents.md)\] + +Defined in: [js-server-sdk/src/notifications.ts:247](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L247) + +A single decoded, mapped server notification tagged with its event type. +The discriminated `type` lets consumers narrow `notification` to the matching +payload (e.g. `if (n.type === 'peerConnected') n.notification.peerType`). diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerConnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerConnected.md new file mode 100644 index 00000000..04f78bed --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerConnected.md @@ -0,0 +1,5 @@ +# Type Alias: StreamerConnected + +> **StreamerConnected** = `object`\[`"streamerConnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:188](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L188) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerDisconnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerDisconnected.md new file mode 100644 index 00000000..b07bb12c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/StreamerDisconnected.md @@ -0,0 +1,5 @@ +# Type Alias: StreamerDisconnected + +> **StreamerDisconnected** = `object`\[`"streamerDisconnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:189](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L189) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/Track.md b/versioned_docs/version-0.30.0/api/server/type-aliases/Track.md new file mode 100644 index 00000000..6a2e0d6d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/Track.md @@ -0,0 +1,31 @@ +# Type Alias: Track + +> **Track** = `object` + +Defined in: [js-server-sdk/src/notifications.ts:18](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L18) + +Track payload embedded in [TrackAdded](TrackAdded.md), [TrackRemoved](TrackRemoved.md), [TrackMetadataUpdated](TrackMetadataUpdated.md). + +## Properties + +### id + +> **id**: `string` + +Defined in: [js-server-sdk/src/notifications.ts:19](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L19) + +*** + +### metadata + +> **metadata**: `string` + +Defined in: [js-server-sdk/src/notifications.ts:21](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L21) + +*** + +### type + +> **type**: [`TrackType`](TrackType.md) + +Defined in: [js-server-sdk/src/notifications.ts:20](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L20) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackAdded.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackAdded.md new file mode 100644 index 00000000..bef1d8a3 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackAdded.md @@ -0,0 +1,5 @@ +# Type Alias: TrackAdded + +> **TrackAdded** = `object`\[`"trackAdded"`\] + +Defined in: [js-server-sdk/src/notifications.ts:192](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L192) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwarding.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwarding.md new file mode 100644 index 00000000..ddb8587c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwarding.md @@ -0,0 +1,5 @@ +# Type Alias: TrackForwarding + +> **TrackForwarding** = `object`\[`"trackForwarding"`\] + +Defined in: [js-server-sdk/src/notifications.ts:195](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L195) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwardingRemoved.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwardingRemoved.md new file mode 100644 index 00000000..cd2824bb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackForwardingRemoved.md @@ -0,0 +1,5 @@ +# Type Alias: TrackForwardingRemoved + +> **TrackForwardingRemoved** = `object`\[`"trackForwardingRemoved"`\] + +Defined in: [js-server-sdk/src/notifications.ts:196](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L196) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackId.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackId.md new file mode 100644 index 00000000..1912315e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackId.md @@ -0,0 +1,5 @@ +# Type Alias: TrackId + +> **TrackId** = [`Brand`](Brand.md)\<`string`, `"TrackId"`\> + +Defined in: [js-server-sdk/src/agent.ts:35](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/agent.ts#L35) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackMetadataUpdated.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackMetadataUpdated.md new file mode 100644 index 00000000..b37e3311 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackMetadataUpdated.md @@ -0,0 +1,5 @@ +# Type Alias: TrackMetadataUpdated + +> **TrackMetadataUpdated** = `object`\[`"trackMetadataUpdated"`\] + +Defined in: [js-server-sdk/src/notifications.ts:194](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L194) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackRemoved.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackRemoved.md new file mode 100644 index 00000000..b5048308 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackRemoved.md @@ -0,0 +1,5 @@ +# Type Alias: TrackRemoved + +> **TrackRemoved** = `object`\[`"trackRemoved"`\] + +Defined in: [js-server-sdk/src/notifications.ts:193](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L193) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/TrackType.md b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackType.md new file mode 100644 index 00000000..342b4d82 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/TrackType.md @@ -0,0 +1,8 @@ +# Type Alias: TrackType + +> **TrackType** = `OpenApiTrackType` \| `"unspecified"` + +Defined in: [js-server-sdk/src/types.ts:54](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L54) + +Track type as emitted by [FishjamWSNotifier](../classes/FishjamWSNotifier.md). Matches the REST API's `TrackType`, +with the addition of `'unspecified'` for messages whose track type is not set on the wire. diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/VadNotification.md b/versioned_docs/version-0.30.0/api/server/type-aliases/VadNotification.md new file mode 100644 index 00000000..db029c33 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/VadNotification.md @@ -0,0 +1,5 @@ +# Type Alias: VadNotification + +> **VadNotification** = `object`\[`"vadNotification"`\] + +Defined in: [js-server-sdk/src/notifications.ts:197](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L197) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/VadStatus.md b/versioned_docs/version-0.30.0/api/server/type-aliases/VadStatus.md new file mode 100644 index 00000000..2b362f3f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/VadStatus.md @@ -0,0 +1,7 @@ +# Type Alias: VadStatus + +> **VadStatus** = `"speech"` \| `"silence"` + +Defined in: [js-server-sdk/src/types.ts:59](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/types.ts#L59) + +Voice activity status of a track. diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/VideoCodec.md b/versioned_docs/version-0.30.0/api/server/type-aliases/VideoCodec.md new file mode 100644 index 00000000..97b5f627 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/VideoCodec.md @@ -0,0 +1,5 @@ +# Type Alias: VideoCodec + +> **VideoCodec** = *typeof* [`VideoCodec`](../variables/VideoCodec.md)\[keyof *typeof* [`VideoCodec`](../variables/VideoCodec.md)\] + +Defined in: fishjam-openapi/dist/index.d.ts:1514 diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerConnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerConnected.md new file mode 100644 index 00000000..6af43a90 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerConnected.md @@ -0,0 +1,5 @@ +# Type Alias: ViewerConnected + +> **ViewerConnected** = `object`\[`"viewerConnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:190](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L190) diff --git a/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerDisconnected.md b/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerDisconnected.md new file mode 100644 index 00000000..f2f6731c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/type-aliases/ViewerDisconnected.md @@ -0,0 +1,5 @@ +# Type Alias: ViewerDisconnected + +> **ViewerDisconnected** = `object`\[`"viewerDisconnected"`\] + +Defined in: [js-server-sdk/src/notifications.ts:191](https://github.com/fishjam-cloud/js-server-sdk/blob/c83334b9d16d3a595427a53d5ddd6043d52a3841/packages/js-server-sdk/src/notifications.ts#L191) diff --git a/versioned_docs/version-0.30.0/api/server/typedoc-sidebar.cjs b/versioned_docs/version-0.30.0/api/server/typedoc-sidebar.cjs new file mode 100644 index 00000000..e1b3295f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */ +const typedocSidebar = {items:[{type:"category",label:"Client",items:[{type:"doc",id:"api/server/classes/FishjamClient",label:"FishjamClient"},{type:"doc",id:"api/server/classes/FishjamWSNotifier",label:"FishjamWSNotifier"}]},{type:"category",label:"Notifications",items:[{type:"doc",id:"api/server/functions/decodeServerNotifications",label:"decodeServerNotifications"},{type:"doc",id:"api/server/functions/verifyWebhookSignature",label:"verifyWebhookSignature"}]},{type:"category",label:"Other",items:[{type:"doc",id:"api/server/classes/BadRequestException",label:"BadRequestException"},{type:"doc",id:"api/server/classes/FishjamAgent",label:"FishjamAgent"},{type:"doc",id:"api/server/classes/FishjamBaseException",label:"FishjamBaseException"},{type:"doc",id:"api/server/classes/FishjamNotFoundException",label:"FishjamNotFoundException"},{type:"doc",id:"api/server/classes/ForbiddenException",label:"ForbiddenException"},{type:"doc",id:"api/server/classes/InvalidFishjamCredentialsException",label:"InvalidFishjamCredentialsException"},{type:"doc",id:"api/server/classes/MissingFishjamIdException",label:"MissingFishjamIdException"},{type:"doc",id:"api/server/classes/PeerNotFoundException",label:"PeerNotFoundException"},{type:"doc",id:"api/server/classes/QuotaExceededException",label:"QuotaExceededException"},{type:"doc",id:"api/server/classes/RecordingNotFoundException",label:"RecordingNotFoundException"},{type:"doc",id:"api/server/classes/RoomNotFoundException",label:"RoomNotFoundException"},{type:"doc",id:"api/server/classes/ServiceUnavailableException",label:"ServiceUnavailableException"},{type:"doc",id:"api/server/classes/StaleSdkException",label:"StaleSdkException"},{type:"doc",id:"api/server/classes/UnauthorizedException",label:"UnauthorizedException"},{type:"doc",id:"api/server/classes/UnknownException",label:"UnknownException"},{type:"doc",id:"api/server/interfaces/FishjamExceptionInfo",label:"FishjamExceptionInfo"},{type:"doc",id:"api/server/interfaces/MoqAccess",label:"MoqAccess"},{type:"doc",id:"api/server/interfaces/MoqAccessConfig",label:"MoqAccessConfig"},{type:"doc",id:"api/server/interfaces/PeerOptionsAgent",label:"PeerOptionsAgent"},{type:"doc",id:"api/server/interfaces/PeerOptionsVapi",label:"PeerOptionsVapi"},{type:"doc",id:"api/server/interfaces/PeerOptionsWebRTC",label:"PeerOptionsWebRTC"},{type:"doc",id:"api/server/interfaces/RecordingConfig",label:"RecordingConfig"},{type:"doc",id:"api/server/interfaces/RecordingSource",label:"RecordingSource"},{type:"doc",id:"api/server/interfaces/RoomConfig",label:"RoomConfig"},{type:"doc",id:"api/server/interfaces/ServerMessage",label:"ServerMessage"},{type:"doc",id:"api/server/interfaces/StreamerToken",label:"StreamerToken"},{type:"doc",id:"api/server/interfaces/ViewerToken",label:"ViewerToken"},{type:"doc",id:"api/server/type-aliases/AgentCallbacks",label:"AgentCallbacks"},{type:"doc",id:"api/server/type-aliases/AgentEvents",label:"AgentEvents"},{type:"doc",id:"api/server/type-aliases/AgentTrack",label:"AgentTrack"},{type:"doc",id:"api/server/type-aliases/AudioCodecParameters",label:"AudioCodecParameters"},{type:"doc",id:"api/server/type-aliases/Brand",label:"Brand"},{type:"doc",id:"api/server/type-aliases/ChannelAdded",label:"ChannelAdded"},{type:"doc",id:"api/server/type-aliases/ChannelRemoved",label:"ChannelRemoved"},{type:"doc",id:"api/server/type-aliases/CloseEventHandler",label:"CloseEventHandler"},{type:"doc",id:"api/server/type-aliases/ErrorEventHandler",label:"ErrorEventHandler"},{type:"doc",id:"api/server/type-aliases/ExpectedAgentEvents",label:"ExpectedAgentEvents"},{type:"doc",id:"api/server/type-aliases/ExpectedEvents",label:"ExpectedEvents"},{type:"doc",id:"api/server/type-aliases/FishjamConfig",label:"FishjamConfig"},{type:"doc",id:"api/server/type-aliases/IgnoredEvents",label:"IgnoredEvents"},{type:"doc",id:"api/server/type-aliases/IncomingTrackData",label:"IncomingTrackData"},{type:"doc",id:"api/server/type-aliases/IncomingTrackImage",label:"IncomingTrackImage"},{type:"doc",id:"api/server/type-aliases/NotificationEvents",label:"NotificationEvents"},{type:"doc",id:"api/server/type-aliases/OutgoingTrackData",label:"OutgoingTrackData"},{type:"doc",id:"api/server/type-aliases/Override",label:"Override"},{type:"doc",id:"api/server/type-aliases/Peer",label:"Peer"},{type:"doc",id:"api/server/type-aliases/PeerAdded",label:"PeerAdded"},{type:"doc",id:"api/server/type-aliases/PeerConnected",label:"PeerConnected"},{type:"doc",id:"api/server/type-aliases/PeerCrashed",label:"PeerCrashed"},{type:"doc",id:"api/server/type-aliases/PeerDeleted",label:"PeerDeleted"},{type:"doc",id:"api/server/type-aliases/PeerDisconnected",label:"PeerDisconnected"},{type:"doc",id:"api/server/type-aliases/PeerId",label:"PeerId"},{type:"doc",id:"api/server/type-aliases/PeerMetadataUpdated",label:"PeerMetadataUpdated"},{type:"doc",id:"api/server/type-aliases/PeerOptions",label:"PeerOptions"},{type:"doc",id:"api/server/type-aliases/PeerStatus",label:"PeerStatus"},{type:"doc",id:"api/server/type-aliases/PeerType",label:"PeerType"},{type:"doc",id:"api/server/type-aliases/Recording",label:"Recording"},{type:"doc",id:"api/server/type-aliases/RecordingId",label:"RecordingId"},{type:"doc",id:"api/server/type-aliases/RecordingStatus",label:"RecordingStatus"},{type:"doc",id:"api/server/type-aliases/RecordingStatusChanged",label:"RecordingStatusChanged"},{type:"doc",id:"api/server/type-aliases/Room",label:"Room"},{type:"doc",id:"api/server/type-aliases/RoomCrashed",label:"RoomCrashed"},{type:"doc",id:"api/server/type-aliases/RoomCreated",label:"RoomCreated"},{type:"doc",id:"api/server/type-aliases/RoomDeleted",label:"RoomDeleted"},{type:"doc",id:"api/server/type-aliases/RoomId",label:"RoomId"},{type:"doc",id:"api/server/type-aliases/RoomType",label:"RoomType"},{type:"doc",id:"api/server/type-aliases/ServerNotification",label:"ServerNotification"},{type:"doc",id:"api/server/type-aliases/StreamerConnected",label:"StreamerConnected"},{type:"doc",id:"api/server/type-aliases/StreamerDisconnected",label:"StreamerDisconnected"},{type:"doc",id:"api/server/type-aliases/Track",label:"Track"},{type:"doc",id:"api/server/type-aliases/TrackAdded",label:"TrackAdded"},{type:"doc",id:"api/server/type-aliases/TrackForwarding",label:"TrackForwarding"},{type:"doc",id:"api/server/type-aliases/TrackForwardingRemoved",label:"TrackForwardingRemoved"},{type:"doc",id:"api/server/type-aliases/TrackId",label:"TrackId"},{type:"doc",id:"api/server/type-aliases/TrackMetadataUpdated",label:"TrackMetadataUpdated"},{type:"doc",id:"api/server/type-aliases/TrackRemoved",label:"TrackRemoved"},{type:"doc",id:"api/server/type-aliases/TrackType",label:"TrackType"},{type:"doc",id:"api/server/type-aliases/VadNotification",label:"VadNotification"},{type:"doc",id:"api/server/type-aliases/VadStatus",label:"VadStatus"},{type:"doc",id:"api/server/type-aliases/VideoCodec",label:"VideoCodec"},{type:"doc",id:"api/server/type-aliases/ViewerConnected",label:"ViewerConnected"},{type:"doc",id:"api/server/type-aliases/ViewerDisconnected",label:"ViewerDisconnected"},{type:"doc",id:"api/server/variables/PeerStatus",label:"PeerStatus"},{type:"doc",id:"api/server/variables/RoomType",label:"RoomType"},{type:"doc",id:"api/server/variables/ServerMessage",label:"ServerMessage"},{type:"doc",id:"api/server/variables/VideoCodec",label:"VideoCodec"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/versioned_docs/version-0.30.0/api/server/variables/PeerStatus.md b/versioned_docs/version-0.30.0/api/server/variables/PeerStatus.md new file mode 100644 index 00000000..5c9b6fb7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/variables/PeerStatus.md @@ -0,0 +1,19 @@ +# Variable: PeerStatus + +> `const` **PeerStatus**: `object` + +Defined in: fishjam-openapi/dist/index.d.ts:1142 + +Informs about the peer status + +## Type declaration + +### Connected + +> `readonly` **Connected**: `"connected"` + +### Disconnected + +> `readonly` **Disconnected**: `"disconnected"` + +## Export diff --git a/versioned_docs/version-0.30.0/api/server/variables/RoomType.md b/versioned_docs/version-0.30.0/api/server/variables/RoomType.md new file mode 100644 index 00000000..f03fed60 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/variables/RoomType.md @@ -0,0 +1,35 @@ +# Variable: RoomType + +> `const` **RoomType**: `object` + +Defined in: fishjam-openapi/dist/index.d.ts:1484 + +The use-case of the room. If not provided, this defaults to conference. + +## Type declaration + +### AudioOnly + +> `readonly` **AudioOnly**: `"audio_only"` + +### AudioOnlyLivestream + +> `readonly` **AudioOnlyLivestream**: `"audio_only_livestream"` + +### Broadcaster + +> `readonly` **Broadcaster**: `"broadcaster"` + +### Conference + +> `readonly` **Conference**: `"conference"` + +### FullFeature + +> `readonly` **FullFeature**: `"full_feature"` + +### Livestream + +> `readonly` **Livestream**: `"livestream"` + +## Export diff --git a/versioned_docs/version-0.30.0/api/server/variables/ServerMessage.md b/versioned_docs/version-0.30.0/api/server/variables/ServerMessage.md new file mode 100644 index 00000000..2786c83f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/variables/ServerMessage.md @@ -0,0 +1,5 @@ +# Variable: ServerMessage + +> **ServerMessage**: `MessageFns$1`\<[`ServerMessage`](../interfaces/ServerMessage.md)\> + +Defined in: fishjam-proto/dist/index.d.ts:82 diff --git a/versioned_docs/version-0.30.0/api/server/variables/VideoCodec.md b/versioned_docs/version-0.30.0/api/server/variables/VideoCodec.md new file mode 100644 index 00000000..35fda4da --- /dev/null +++ b/versioned_docs/version-0.30.0/api/server/variables/VideoCodec.md @@ -0,0 +1,19 @@ +# Variable: VideoCodec + +> `const` **VideoCodec**: `object` + +Defined in: fishjam-openapi/dist/index.d.ts:1514 + +Enforces video codec for each peer in the room + +## Type declaration + +### H264 + +> `readonly` **H264**: `"h264"` + +### Vp8 + +> `readonly` **Vp8**: `"vp8"` + +## Export diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index.md new file mode 100644 index 00000000..f2d212fb --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index.md @@ -0,0 +1,6 @@ +# @fishjam-cloud/react-native-vision-camera-source + +## Modules + +- [index](index/index.md) +- [webgpu](webgpu/index.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/rotationDegreesFromOrientation.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/rotationDegreesFromOrientation.md new file mode 100644 index 00000000..dbff7cf6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/rotationDegreesFromOrientation.md @@ -0,0 +1,23 @@ +# Function: rotationDegreesFromOrientation() + +> **rotationDegreesFromOrientation**(`orientation`): `0` \| `90` \| `180` \| `270` + +Defined in: [react-native-vision-camera-source/src/orientation.ts:15](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/orientation.ts#L15) + +Maps a VisionCamera frame orientation to the clockwise rotation, in degrees, needed to bring the +frame's pixel data upright: `'up'` → 0, `'right'` → 90, `'down'` → 180, `'left'` → 270. + +The source hooks apply this automatically. It is exported for advanced consumers who wire the +low-level frame APIs from `@fishjam-cloud/react-native-webrtc` themselves. + +Worklet-safe: call it from a frame callback or from the JS thread. + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `orientation` | `CameraOrientation` | A VisionCamera `Frame.orientation` value. | + +## Returns + +`0` \| `90` \| `180` \| `270` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/useVisionCameraSource.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/useVisionCameraSource.md new file mode 100644 index 00000000..1aa116a9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index/functions/useVisionCameraSource.md @@ -0,0 +1,41 @@ +# Function: useVisionCameraSource() + +> **useVisionCameraSource**\<`SourceId`\>(`sourceId`, `options`): [`UseVisionCameraSourceResult`](../interfaces/UseVisionCameraSourceResult.md) + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:89](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L89) + +Publishes your VisionCamera feed to Fishjam. + +A sibling of `useCustomSource`: the hook creates the video track, publishes it under +`sourceId`, and cleans everything up on unmount. Each camera frame is handed to Fishjam +without copying its pixels. Must be used under `FishjamProvider`. + +```tsx +const { frameOutput, stream } = useVisionCameraSource('my-camera'); + +useVisionCamera({ device: cameraDevice, isActive: true, outputs: [frameOutput] }); + +return stream ? : null; +``` + +To also run inference on the same frames, pass an [onFrame](../interfaces/UseVisionCameraSourceOptions.md#onframe) +worklet. To render your own content into the published video with WebGPU, use +`useVisionCameraWebGpuSource` from `@fishjam-cloud/react-native-vision-camera-source/webgpu` +instead. + +## Type Parameters + +| Type Parameter | +| ------ | +| `SourceId` *extends* `string` | + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sourceId` | `SourceId` | Identifies this source among the peer's tracks, like in `useCustomSource`. | +| `options` | [`UseVisionCameraSourceOptions`](../interfaces/UseVisionCameraSourceOptions.md) | See [UseVisionCameraSourceOptions](../interfaces/UseVisionCameraSourceOptions.md). | + +## Returns + +[`UseVisionCameraSourceResult`](../interfaces/UseVisionCameraSourceResult.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index/index.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index/index.md new file mode 100644 index 00000000..bffa9c18 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index/index.md @@ -0,0 +1,27 @@ +# index + +VisionCamera → Fishjam adapter. + +Source hooks that publish a VisionCamera feed to Fishjam, in the same family as +`useCustomSource`: the hook owns the track, the publishing, and the cleanup, and hands you a +VisionCamera frame output to plug into your own camera session. + +- [useVisionCameraSource](functions/useVisionCameraSource.md) — publish the camera feed as-is (copy-free), optionally running + inference worklets on the same frames. +- `useVisionCameraWebGpuSource` (from `@fishjam-cloud/react-native-vision-camera-source/webgpu`) + — render your own WebGPU content into the published video. + +Requires VisionCamera 5 and `FishjamProvider` from `@fishjam-cloud/react-native-client`. + +## Interfaces + +- [UseVisionCameraSourceOptions](interfaces/UseVisionCameraSourceOptions.md) +- [UseVisionCameraSourceResult](interfaces/UseVisionCameraSourceResult.md) + +## Hooks + +- [useVisionCameraSource](functions/useVisionCameraSource.md) + +## Utilities + +- [rotationDegreesFromOrientation](functions/rotationDegreesFromOrientation.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceOptions.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceOptions.md new file mode 100644 index 00000000..72f8a239 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceOptions.md @@ -0,0 +1,78 @@ +# Interface: UseVisionCameraSourceOptions + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L24) + +Options for [useVisionCameraSource](../functions/useVisionCameraSource.md). Also accepts every VisionCamera frame-output option +(`targetResolution`, `pixelFormat`, `dropFramesWhileBusy`, and so on) and passes it through. + +## Extends + +- `Partial`\<`FrameOutputOptions`\> + +## Properties + +### enabled? + +> `optional` **enabled**: `boolean` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L29) + +Whether the source is live. While `false`, no track exists and nothing is published — the +declarative sibling of VisionCamera's `isActive`. Defaults to `true`. + +*** + +### frameIntervalNanoseconds? + +> `optional` **frameIntervalNanoseconds**: `number` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:46](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L46) + +Fallback spacing between published frames, in nanoseconds, used only when a camera frame +carries no usable timestamp. Defaults to 33,333,333 (30 fps). + +*** + +### onFrame()? + +> `optional` **onFrame**: (`frame`) => `void` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:39](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L39) + +Optional worklet called with every camera frame, after the frame has been sent to Fishjam — +run your frame-processor plugins (pose detection, OCR, …) here. + +The frame is valid only for the duration of this synchronous callback; the hook releases it +when the callback returns, so do not retain it. Keep the function's identity stable +(`useCallback` or module scope) — a new function every render forces VisionCamera to +re-register the frame callback. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `frame` | `Frame` | + +#### Returns + +`void` + +*** + +### onFrameDropped()? + +> `optional` **onFrameDropped**: (`reason`) => `void` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L41) + +Called whenever the camera pipeline drops a frame; forwarded to VisionCamera. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason` | `FrameDroppedReason` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceResult.md b/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceResult.md new file mode 100644 index 00000000..06d5d588 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/index/interfaces/UseVisionCameraSourceResult.md @@ -0,0 +1,37 @@ +# Interface: UseVisionCameraSourceResult + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:50](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L50) + +Result of [useVisionCameraSource](../functions/useVisionCameraSource.md). + +## Properties + +### error + +> **error**: `null` \| `Error` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:62](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L62) + +Failure while creating the underlying track, if any. + +*** + +### frameOutput + +> **frameOutput**: `CameraFrameOutput` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:55](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L55) + +The VisionCamera frame output driving this source. Plug it into your camera session: +`useCamera({ device, isActive, outputs: [frameOutput] })`. + +*** + +### stream + +> **stream**: `null` \| `MediaStream` + +Defined in: [react-native-vision-camera-source/src/useVisionCameraSource.ts:60](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/useVisionCameraSource.ts#L60) + +The published stream — render it with `RTCView` for a self-view. `null` until the +underlying track is ready (creation is asynchronous). diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/typedoc-sidebar.cjs b/versioned_docs/version-0.30.0/api/vision-camera-source/typedoc-sidebar.cjs new file mode 100644 index 00000000..b0aede8f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */ +const typedocSidebar = {items:[{type:"category",label:"index",items:[{type:"category",label:"Interfaces",items:[{type:"doc",id:"api/vision-camera-source/index/interfaces/UseVisionCameraSourceOptions",label:"UseVisionCameraSourceOptions"},{type:"doc",id:"api/vision-camera-source/index/interfaces/UseVisionCameraSourceResult",label:"UseVisionCameraSourceResult"}]},{type:"category",label:"Hooks",items:[{type:"doc",id:"api/vision-camera-source/index/functions/useVisionCameraSource",label:"useVisionCameraSource"}]},{type:"category",label:"Utilities",items:[{type:"doc",id:"api/vision-camera-source/index/functions/rotationDegreesFromOrientation",label:"rotationDegreesFromOrientation"}]}],link:{type:"doc",id:"api/vision-camera-source/index/index"}},{type:"category",label:"webgpu",items:[{type:"category",label:"Interfaces",items:[{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipelineOptions",label:"CameraPassthroughPipelineOptions"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/CreateCameraShaderBindingsOptions",label:"CreateCameraShaderBindingsOptions"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/UseCameraWebGpuDeviceResult",label:"UseCameraWebGpuDeviceResult"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceOptions",label:"UseVisionCameraWebGpuSourceOptions"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceResult",label:"UseVisionCameraWebGpuSourceResult"}]},{type:"category",label:"Type Aliases",items:[{type:"doc",id:"api/vision-camera-source/webgpu/type-aliases/WebGpuRuntime",label:"WebGpuRuntime"}]},{type:"category",label:"Functions",items:[{type:"doc",id:"api/vision-camera-source/webgpu/functions/getWebGpuRuntime",label:"getWebGpuRuntime"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/useCameraWebGpuDeviceWithOverride",label:"useCameraWebGpuDeviceWithOverride"}]},{type:"category",label:"Hooks",items:[{type:"doc",id:"api/vision-camera-source/webgpu/functions/useVisionCameraWebGpuSource",label:"useVisionCameraWebGpuSource"}]},{type:"category",label:"WebGPU",items:[{type:"doc",id:"api/vision-camera-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport",label:"assertWebGpuDeviceSupportsCameraImport"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/computeAspectFillCrop",label:"computeAspectFillCrop"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/computeSquareCrop",label:"computeSquareCrop"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/createCameraBindGroup",label:"createCameraBindGroup"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/createCameraPassthroughPipeline",label:"createCameraPassthroughPipeline"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/createCameraShaderBindings",label:"createCameraShaderBindings"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/createCameraTextureResolver",label:"createCameraTextureResolver"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/encodeCameraPassthrough",label:"encodeCameraPassthrough"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/getOutputSurfaceFormat",label:"getOutputSurfaceFormat"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/getRequiredWebGpuCameraFeatures",label:"getRequiredWebGpuCameraFeatures"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/packFrameCropParams",label:"packFrameCropParams"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/resolveCameraTexture",label:"resolveCameraTexture"},{type:"doc",id:"api/vision-camera-source/webgpu/functions/useCameraWebGpuDevice",label:"useCameraWebGpuDevice"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipeline",label:"CameraPassthroughPipeline"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/CameraShaderBindings",label:"CameraShaderBindings"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/CameraTextureResolver",label:"CameraTextureResolver"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/FrameCrop",label:"FrameCrop"},{type:"doc",id:"api/vision-camera-source/webgpu/interfaces/WebGpuFrameRenderContext",label:"WebGpuFrameRenderContext"},{type:"doc",id:"api/vision-camera-source/webgpu/type-aliases/WebGpuFrameRenderFunction",label:"WebGpuFrameRenderFunction"},{type:"doc",id:"api/vision-camera-source/webgpu/variables/FrameCropParams",label:"FrameCropParams"},{type:"doc",id:"api/vision-camera-source/webgpu/variables/sampleCamera",label:"sampleCamera"}]}],link:{type:"doc",id:"api/vision-camera-source/webgpu/index"}}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md new file mode 100644 index 00000000..26b87e7c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/assertWebGpuDeviceSupportsCameraImport.md @@ -0,0 +1,19 @@ +# Function: assertWebGpuDeviceSupportsCameraImport() + +> **assertWebGpuDeviceSupportsCameraImport**(`device`): `void` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/requiredFeatures.d.ts:16 + +Throws a descriptive error when `device` is missing any feature required to import camera +frames or Fishjam output surfaces on this platform. Called automatically on devices passed as +an override; call it yourself to validate a device early. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeAspectFillCrop.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeAspectFillCrop.md new file mode 100644 index 00000000..637a7abc --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeAspectFillCrop.md @@ -0,0 +1,30 @@ +# Function: computeAspectFillCrop() + +> **computeAspectFillCrop**(`sourceWidth`, `sourceHeight`, `targetAspect`, `uv00?`, `uv01?`, `uv10?`, `uv11?`): [`FrameCrop`](../interfaces/FrameCrop.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:59 + +Center-crop of a (sourceWidth × sourceHeight) frame to the target aspect ratio (width/height). +A no-op full-frame crop when the source already has the target aspect. Worklet-safe. + +Feed it the upright camera size from the render context: +`computeAspectFillCrop(context.cameraWidth, context.cameraHeight, context.outputWidth / context.outputHeight)`. + +The optional `uv00..uv11` scalars form a UV-space transform applied around the frame center +(identity by default). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `sourceWidth` | `number` | +| `sourceHeight` | `number` | +| `targetAspect` | `number` | +| `uv00?` | `number` | +| `uv01?` | `number` | +| `uv10?` | `number` | +| `uv11?` | `number` | + +## Returns + +[`FrameCrop`](../interfaces/FrameCrop.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeSquareCrop.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeSquareCrop.md new file mode 100644 index 00000000..d7f8f594 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/computeSquareCrop.md @@ -0,0 +1,23 @@ +# Function: computeSquareCrop() + +> **computeSquareCrop**(`sourceWidth`, `sourceHeight`, `uv00?`, `uv01?`, `uv10?`, `uv11?`): [`FrameCrop`](../interfaces/FrameCrop.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:66 + +Square center-crop of a (sourceWidth × sourceHeight) frame — the usual shape for square model +inputs. Worklet-safe. The optional `uv00..uv11` scalars are as in [computeAspectFillCrop](computeAspectFillCrop.md). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `sourceWidth` | `number` | +| `sourceHeight` | `number` | +| `uv00?` | `number` | +| `uv01?` | `number` | +| `uv10?` | `number` | +| `uv11?` | `number` | + +## Returns + +[`FrameCrop`](../interfaces/FrameCrop.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraBindGroup.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraBindGroup.md new file mode 100644 index 00000000..0426dae8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraBindGroup.md @@ -0,0 +1,24 @@ +# Function: createCameraBindGroup() + +> **createCameraBindGroup**(`device`, `cameraShaderBindings`, `cameraTexture`): `GPUBindGroup` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:68 + +Builds the per-frame bind group for the live camera texture. The source hook already does this +for you when you pass `cameraShaderBindings` in its options (see the render context's +`cameraBindGroup`); call it yourself only for advanced multi-layout setups. Worklet-safe. + +A camera texture expires when the frame ends, so a bind group referencing it must be rebuilt +every frame — never cache the result. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `cameraShaderBindings` | [`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) | +| `cameraTexture` | `GPUExternalTexture` | + +## Returns + +`GPUBindGroup` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraPassthroughPipeline.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraPassthroughPipeline.md new file mode 100644 index 00000000..cb4beb48 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraPassthroughPipeline.md @@ -0,0 +1,20 @@ +# Function: createCameraPassthroughPipeline() + +> **createCameraPassthroughPipeline**(`device`, `options?`): [`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:32 + +Builds the full-screen camera passthrough pipeline: crop/orientation via [FrameCrop](../interfaces/FrameCrop.md), +platform-correct camera sampling, one triangle. Use it to publish the camera through the WebGPU +tier with zero WGSL of your own, or as the base pass under your overlay passes. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `options?` | [`CameraPassthroughPipelineOptions`](../interfaces/CameraPassthroughPipelineOptions.md) | + +## Returns + +[`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraShaderBindings.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraShaderBindings.md new file mode 100644 index 00000000..823d92a0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraShaderBindings.md @@ -0,0 +1,29 @@ +# Function: createCameraShaderBindings() + +> **createCameraShaderBindings**(`device`, `options?`): [`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:57 + +Builds the camera-sampling bindings against the device your pipelines use. Pass the result to +the source hook's `cameraShaderBindings` option and the render context delivers a ready-made +`cameraBindGroup` every frame — set it at [CameraShaderBindings.bindGroupIndex](../interfaces/CameraShaderBindings.md#bindgroupindex) and call +`sampleCamera(uv)` in your fragment shader. + +```ts +const cam = createCameraShaderBindings(device); +const fragment = tgpu.fragmentFn({ in: { uv: d.location(0, d.vec2f) }, out: d.vec4f })((input) => { + return cam.sampleCamera(input.uv); +}); +const wgsl = cam.bindingDeclarations + tgpu.resolve({ externals: { fragment } }); +``` + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `options?` | [`CreateCameraShaderBindingsOptions`](../interfaces/CreateCameraShaderBindingsOptions.md) | + +## Returns + +[`CameraShaderBindings`](../interfaces/CameraShaderBindings.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraTextureResolver.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraTextureResolver.md new file mode 100644 index 00000000..c7e4fc04 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/createCameraTextureResolver.md @@ -0,0 +1,20 @@ +# Function: createCameraTextureResolver() + +> **createCameraTextureResolver**(`device`, `size`): [`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:27 + +Creates a [CameraTextureResolver](../interfaces/CameraTextureResolver.md) with an owned `rgba8unorm` texture of the given size. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `size` | \{ `height`: `number`; `width`: `number`; \} | +| `size.height` | `number` | +| `size.width` | `number` | + +## Returns + +[`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/encodeCameraPassthrough.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/encodeCameraPassthrough.md new file mode 100644 index 00000000..12f12a7e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/encodeCameraPassthrough.md @@ -0,0 +1,29 @@ +# Function: encodeCameraPassthrough() + +> **encodeCameraPassthrough**(`device`, `passthrough`, `cameraTexture`, `outputView`, `commandEncoder`, `crop`): `void` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:45 + +Encodes one full-screen pass drawing the camera into `outputView`, cropped per `crop`. +Worklet-safe; call it inside your render callback, and encode any overlay passes after it on +the same command encoder (with `loadOp: 'load'` so they draw on top). + +At most one call per pipeline instance per frame: the crop lives in a single uniform buffer +written via `queue.writeBuffer`, which lands before the submitted command buffer executes — a +second call in the same frame makes both draws use the second crop. Encode to multiple targets +with different crops by building one pipeline per target. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `passthrough` | [`CameraPassthroughPipeline`](../interfaces/CameraPassthroughPipeline.md) | +| `cameraTexture` | `GPUExternalTexture` | +| `outputView` | `GPUTextureView` | +| `commandEncoder` | `GPUCommandEncoder` | +| `crop` | [`FrameCrop`](../interfaces/FrameCrop.md) | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getOutputSurfaceFormat.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getOutputSurfaceFormat.md new file mode 100644 index 00000000..95c2ddd2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getOutputSurfaceFormat.md @@ -0,0 +1,13 @@ +# Function: getOutputSurfaceFormat() + +> **getOutputSurfaceFormat**(): `GPUTextureFormat` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/requiredFeatures.d.ts:24 + +The pixel format of Fishjam output surfaces on this platform: `'rgba8unorm'` on Android +(AHardwareBuffer), `'bgra8unorm'` on iOS (IOSurface). Use it as the render-target format of any +pipeline that draws into the output texture — a mismatched format renders wrong or black. + +## Returns + +`GPUTextureFormat` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md new file mode 100644 index 00000000..bd167a06 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getRequiredWebGpuCameraFeatures.md @@ -0,0 +1,13 @@ +# Function: getRequiredWebGpuCameraFeatures() + +> **getRequiredWebGpuCameraFeatures**(): `GPUFeatureName`[] + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/requiredFeatures.d.ts:8 + +The GPU features a device must have to import camera frames and Fishjam output surfaces on this +platform. [useCameraWebGpuDevice](useCameraWebGpuDevice.md) requests them for you; pass them yourself as +`requiredFeatures` in `GPUDeviceDescriptor` when you bring your own device. + +## Returns + +`GPUFeatureName`[] diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getWebGpuRuntime.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getWebGpuRuntime.md new file mode 100644 index 00000000..4d5bd175 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/getWebGpuRuntime.md @@ -0,0 +1,20 @@ +# Function: getWebGpuRuntime() + +> **getWebGpuRuntime**(): `object` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/webGpuRuntime.d.ts:13 + +Returns the react-native-webgpu runtime singleton, self-healing when the `RNWebGPU` global is +missing on the calling runtime. The library binds the global once at module load, but that +binding can be absent after a crash-recovery runtime reload or an install-ordering flake; +`WebGPUModule.install()` binds it to the calling runtime and is safe to repeat. + +## Returns + +`object` + +## Throws + +When the runtime cannot be installed (react-native-webgpu missing or its native module +not linked) — returning the still-undefined global would only defer the failure to an opaque +per-frame TypeError. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/packFrameCropParams.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/packFrameCropParams.md new file mode 100644 index 00000000..ce9cdedd --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/packFrameCropParams.md @@ -0,0 +1,18 @@ +# Function: packFrameCropParams() + +> **packFrameCropParams**(`crop`): `ArrayBuffer` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:46 + +Packs a [FrameCrop](../interfaces/FrameCrop.md) into the [FrameCropParams](../variables/FrameCropParams.md) uniform byte layout. +Worklet-safe; upload the result with `device.queue.writeBuffer(buffer, 0, bytes)`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `crop` | [`FrameCrop`](../interfaces/FrameCrop.md) | + +## Returns + +`ArrayBuffer` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/resolveCameraTexture.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/resolveCameraTexture.md new file mode 100644 index 00000000..77ddfcf7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/resolveCameraTexture.md @@ -0,0 +1,24 @@ +# Function: resolveCameraTexture() + +> **resolveCameraTexture**(`device`, `resolver`, `cameraTexture`, `cameraWidth`, `cameraHeight`, `commandEncoder`): `void` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:38 + +Encodes one pass resolving the live camera texture into `resolver.texture`, aspect-filled to +the resolver's size (platform YUV decode included). Worklet-safe; call it inside your render +callback before the passes that sample `resolver.texture`. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `device` | `GPUDevice` | +| `resolver` | [`CameraTextureResolver`](../interfaces/CameraTextureResolver.md) | +| `cameraTexture` | `GPUExternalTexture` | +| `cameraWidth` | `number` | +| `cameraHeight` | `number` | +| `commandEncoder` | `GPUCommandEncoder` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDevice.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDevice.md new file mode 100644 index 00000000..26928d68 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDevice.md @@ -0,0 +1,19 @@ +# Function: useCameraWebGpuDevice() + +> **useCameraWebGpuDevice**(): [`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/useCameraWebGpuDevice.d.ts:21 + +The app-wide GPUDevice used for camera work, configured with +[getRequiredWebGpuCameraFeatures](getRequiredWebGpuCameraFeatures.md). All callers share one device, so pipelines you build +against it work with the textures the source hook hands your render callback. + +Build your pipelines once the device arrives: +```tsx +const { device } = useCameraWebGpuDevice(); +const effect = useMemo(() => (device ? buildMyEffect(device) : null), [device]); +``` + +## Returns + +[`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md new file mode 100644 index 00000000..887bc4b4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useCameraWebGpuDeviceWithOverride.md @@ -0,0 +1,18 @@ +# Function: useCameraWebGpuDeviceWithOverride() + +> **useCameraWebGpuDeviceWithOverride**(`override`): [`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/useCameraWebGpuDevice.d.ts:26 + +Device resolution for the source hook: the user-provided override (validated) when present, +otherwise the shared device. Always called, so hook order stays stable either way. + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `override` | `undefined` \| `GPUDevice` | + +## Returns + +[`UseCameraWebGpuDeviceResult`](../interfaces/UseCameraWebGpuDeviceResult.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useVisionCameraWebGpuSource.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useVisionCameraWebGpuSource.md new file mode 100644 index 00000000..1f254633 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/functions/useVisionCameraWebGpuSource.md @@ -0,0 +1,45 @@ +# Function: useVisionCameraWebGpuSource() + +> **useVisionCameraWebGpuSource**\<`SourceId`\>(`sourceId`, `options`): [`UseVisionCameraWebGpuSourceResult`](../interfaces/UseVisionCameraWebGpuSourceResult.md) + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:126](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L126) + +Publishes WebGPU-rendered video to Fishjam, fed by your VisionCamera feed. + +A sibling of `useCustomSource`: the hook creates the video track (and its pool of output +surfaces), publishes it under `sourceId`, and cleans everything up on unmount. Every camera +frame reaches your `onFrame` worklet, where calling `render(...)` hands you the live camera as +a GPU texture plus an output texture to draw into — what you draw is what peers receive. +Everything else is handled for you: output-surface management, GPU synchronization with the +video encoder, timestamps, rotation, and frame lifetimes. Must be used under `FishjamProvider`. + +```tsx +const { frameOutput, stream, device } = useVisionCameraWebGpuSource('my-camera', { + width: 720, + height: 1280, + cameraShaderBindings: effect?.cameraBindings, + onFrame, +}); +useVisionCamera({ device: cameraDevice, isActive: true, outputs: [frameOutput] }); +``` + +To publish the camera unmodified (no rendering), use `useVisionCameraSource` from the package +root instead. For a ready-made camera→output pass to build on, see +`createCameraPassthroughPipeline`. + +## Type Parameters + +| Type Parameter | +| ------ | +| `SourceId` *extends* `string` | + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sourceId` | `SourceId` | Identifies this source among the peer's tracks, like in `useCustomSource`. | +| `options` | [`UseVisionCameraWebGpuSourceOptions`](../interfaces/UseVisionCameraWebGpuSourceOptions.md) | See [UseVisionCameraWebGpuSourceOptions](../interfaces/UseVisionCameraWebGpuSourceOptions.md). | + +## Returns + +[`UseVisionCameraWebGpuSourceResult`](../interfaces/UseVisionCameraWebGpuSourceResult.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/index.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/index.md new file mode 100644 index 00000000..629db7a7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/index.md @@ -0,0 +1,57 @@ +# webgpu + +WebGPU tier of the VisionCamera → Fishjam adapter — render your own content into the published +video. Requires `react-native-webgpu` (an optional peer of this package; only this entry point +loads it). + +- [useVisionCameraWebGpuSource](functions/useVisionCameraWebGpuSource.md) — the source hook: camera in, your WebGPU passes, + published video out. +- Re-exports the WebGPU camera toolkit from + `@fishjam-cloud/react-native-custom-video-source/webgpu` — `createCameraShaderBindings` / + `sampleCamera`, `createCameraPassthroughPipeline`, the cropping helpers, the shared + camera-import device, and so on — so you can build your shaders alongside the hook. + +## Interfaces + +- [CameraPassthroughPipelineOptions](interfaces/CameraPassthroughPipelineOptions.md) +- [CreateCameraShaderBindingsOptions](interfaces/CreateCameraShaderBindingsOptions.md) +- [UseCameraWebGpuDeviceResult](interfaces/UseCameraWebGpuDeviceResult.md) +- [UseVisionCameraWebGpuSourceOptions](interfaces/UseVisionCameraWebGpuSourceOptions.md) +- [UseVisionCameraWebGpuSourceResult](interfaces/UseVisionCameraWebGpuSourceResult.md) + +## Type Aliases + +- [WebGpuRuntime](type-aliases/WebGpuRuntime.md) + +## Functions + +- [getWebGpuRuntime](functions/getWebGpuRuntime.md) +- [useCameraWebGpuDeviceWithOverride](functions/useCameraWebGpuDeviceWithOverride.md) + +## Hooks + +- [useVisionCameraWebGpuSource](functions/useVisionCameraWebGpuSource.md) + +## WebGPU + +- [assertWebGpuDeviceSupportsCameraImport](functions/assertWebGpuDeviceSupportsCameraImport.md) +- [computeAspectFillCrop](functions/computeAspectFillCrop.md) +- [computeSquareCrop](functions/computeSquareCrop.md) +- [createCameraBindGroup](functions/createCameraBindGroup.md) +- [createCameraPassthroughPipeline](functions/createCameraPassthroughPipeline.md) +- [createCameraShaderBindings](functions/createCameraShaderBindings.md) +- [createCameraTextureResolver](functions/createCameraTextureResolver.md) +- [encodeCameraPassthrough](functions/encodeCameraPassthrough.md) +- [getOutputSurfaceFormat](functions/getOutputSurfaceFormat.md) +- [getRequiredWebGpuCameraFeatures](functions/getRequiredWebGpuCameraFeatures.md) +- [packFrameCropParams](functions/packFrameCropParams.md) +- [resolveCameraTexture](functions/resolveCameraTexture.md) +- [useCameraWebGpuDevice](functions/useCameraWebGpuDevice.md) +- [CameraPassthroughPipeline](interfaces/CameraPassthroughPipeline.md) +- [CameraShaderBindings](interfaces/CameraShaderBindings.md) +- [CameraTextureResolver](interfaces/CameraTextureResolver.md) +- [FrameCrop](interfaces/FrameCrop.md) +- [WebGpuFrameRenderContext](interfaces/WebGpuFrameRenderContext.md) +- [WebGpuFrameRenderFunction](type-aliases/WebGpuFrameRenderFunction.md) +- [FrameCropParams](variables/FrameCropParams.md) +- [sampleCamera](variables/sampleCamera.md) diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipeline.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipeline.md new file mode 100644 index 00000000..2b3bfc03 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipeline.md @@ -0,0 +1,44 @@ +# Interface: CameraPassthroughPipeline + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:16 + +A ready-made full-screen camera→target render pipeline. Build once at setup with +[createCameraPassthroughPipeline](../functions/createCameraPassthroughPipeline.md); every field is safe to capture into the frame worklet. + +## Properties + +### cameraShaderBindings + +> `readonly` **cameraShaderBindings**: [`CameraShaderBindings`](CameraShaderBindings.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:19 + +The camera shader bindings the pipeline samples through. + +*** + +### cropBindGroup + +> `readonly` **cropBindGroup**: `GPUBindGroup` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:23 + +Static bind group with the crop uniform. + +*** + +### cropParamsBuffer + +> `readonly` **cropParamsBuffer**: `GPUBuffer` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:21 + +Uniform buffer holding the packed FrameCropParams; written by [encodeCameraPassthrough](../functions/encodeCameraPassthrough.md). + +*** + +### pipeline + +> `readonly` **pipeline**: `GPURenderPipeline` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:17 diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md new file mode 100644 index 00000000..b45cbde9 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraPassthroughPipelineOptions.md @@ -0,0 +1,25 @@ +# Interface: CameraPassthroughPipelineOptions + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:4 + +Options for [createCameraPassthroughPipeline](../functions/createCameraPassthroughPipeline.md). + +## Properties + +### mirror? + +> `optional` **mirror**: `boolean` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:8 + +Mirror the camera horizontally (the usual selfie self-view convention). Defaults to `false`. + +*** + +### outputFormat? + +> `optional` **outputFormat**: `GPUTextureFormat` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraPassthroughPipeline.d.ts:6 + +Render-target format. Defaults to [getOutputSurfaceFormat](../functions/getOutputSurfaceFormat.md) (the Fishjam output surface). diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraShaderBindings.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraShaderBindings.md new file mode 100644 index 00000000..e5ddd6a8 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraShaderBindings.md @@ -0,0 +1,58 @@ +# Interface: CameraShaderBindings + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:23 + +Everything a fragment shader needs to sample the live camera. Build once at setup with +[createCameraShaderBindings](../functions/createCameraShaderBindings.md); the fields are safe to capture into the frame worklet. + +## Properties + +### bindGroupIndex + +> `readonly` **bindGroupIndex**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:39 + +The group index the bindings are declared at. + +*** + +### bindGroupLayout + +> `readonly` **bindGroupLayout**: `GPUBindGroupLayout` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:35 + +Layout of the camera bind group; place it at [bindGroupIndex](#bindgroupindex) in your pipeline layout. + +*** + +### bindingDeclarations + +> `readonly` **bindingDeclarations**: `string` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:33 + +WGSL declaring the camera `texture_external` and `sampler` at [bindGroupIndex](#bindgroupindex). TypeGPU +cannot emit an external-texture binding, so prepend this to the WGSL your shader resolves to. + +*** + +### sampleCamera + +> `readonly` **sampleCamera**: `TgpuFn`\<(`uv`) => `Vec4f`\> + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:28 + +The camera sampler as a TypeGPU function — call `sampleCamera(uv)` from your TGSL fragment +shader. Same value as the exported [sampleCamera](../variables/sampleCamera.md). + +*** + +### sampler + +> `readonly` **sampler**: `GPUSampler` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:37 + +The linear-filtering sampler bound at binding 1. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraTextureResolver.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraTextureResolver.md new file mode 100644 index 00000000..8b640d00 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CameraTextureResolver.md @@ -0,0 +1,58 @@ +# Interface: CameraTextureResolver + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:12 + +An owned `rgba8unorm` texture the camera frame is resolved into each frame — for pipelines that +want a plain `texture_2d` camera instead of `texture_external`. Build once at setup with +[createCameraTextureResolver](../functions/createCameraTextureResolver.md); every field is safe to capture into the frame worklet. + +Prefer sampling the camera directly via [createCameraShaderBindings](../functions/createCameraShaderBindings.md) when you can: the +resolver costs one extra render pass per frame. + +## Properties + +### height + +> `readonly` **height**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:18 + +*** + +### resolvePass + +> `readonly` **resolvePass**: [`CameraPassthroughPipeline`](CameraPassthroughPipeline.md) + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:20 + +**`Internal`** + +The pass used to resolve into [texture](#texture). + +*** + +### texture + +> `readonly` **texture**: `GPUTexture` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:14 + +The resolved camera texture (`rgba8unorm`, sampled + render-attachment usage). + +*** + +### view + +> `readonly` **view**: `GPUTextureView` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:16 + +A reusable default view of [texture](#texture). + +*** + +### width + +> `readonly` **width**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraTextureResolver.d.ts:17 diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md new file mode 100644 index 00000000..99800412 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/CreateCameraShaderBindingsOptions.md @@ -0,0 +1,15 @@ +# Interface: CreateCameraShaderBindingsOptions + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:13 + +Options for [createCameraShaderBindings](../functions/createCameraShaderBindings.md). + +## Properties + +### bindGroupIndex? + +> `optional` **bindGroupIndex**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:15 + +Bind group index the camera texture + sampler are declared at. Defaults to `0`. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/FrameCrop.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/FrameCrop.md new file mode 100644 index 00000000..a5db0012 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/FrameCrop.md @@ -0,0 +1,88 @@ +# Interface: FrameCrop + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:27 + +A center-crop of a source frame plus a UV-space orientation transform, in source pixels. +Produce one with [computeAspectFillCrop](../functions/computeAspectFillCrop.md) or [computeSquareCrop](../functions/computeSquareCrop.md). + +## Properties + +### cropOriginX + +> **cropOriginX**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:30 + +*** + +### cropOriginY + +> **cropOriginY**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:31 + +*** + +### cropSizeX + +> **cropSizeX**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:32 + +*** + +### cropSizeY + +> **cropSizeY**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:33 + +*** + +### sourceHeight + +> **sourceHeight**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:29 + +*** + +### sourceWidth + +> **sourceWidth**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:28 + +*** + +### uv00 + +> **uv00**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:35 + +uvTransform matrix scalars in (m00, m01, m10, m11) order; identity when omitted at compute time. + +*** + +### uv01 + +> **uv01**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:36 + +*** + +### uv10 + +> **uv10**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:37 + +*** + +### uv11 + +> **uv11**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:38 diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md new file mode 100644 index 00000000..c7aead6b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseCameraWebGpuDeviceResult.md @@ -0,0 +1,25 @@ +# Interface: UseCameraWebGpuDeviceResult + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/useCameraWebGpuDevice.d.ts:2 + +Result of [useCameraWebGpuDevice](../functions/useCameraWebGpuDevice.md). + +## Properties + +### device + +> **device**: `null` \| `GPUDevice` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/useCameraWebGpuDevice.d.ts:4 + +The shared GPUDevice; `null` until acquisition resolves. + +*** + +### error + +> **error**: `null` \| `Error` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/useCameraWebGpuDevice.d.ts:6 + +Acquisition failure (no adapter, missing platform features), if any. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceOptions.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceOptions.md new file mode 100644 index 00000000..2641f961 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceOptions.md @@ -0,0 +1,132 @@ +# Interface: UseVisionCameraWebGpuSourceOptions + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:37](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L37) + +Options for [useVisionCameraWebGpuSource](../functions/useVisionCameraWebGpuSource.md). Also accepts every VisionCamera frame-output +option except `pixelFormat`, which the hook forces to `'native'` (the zero-copy camera-import +path requires it). + +## Extends + +- `Partial`\<`Omit`\<`FrameOutputOptions`, `"pixelFormat"`\>\> + +## Properties + +### cameraShaderBindings? + +> `optional` **cameraShaderBindings**: [`CameraShaderBindings`](CameraShaderBindings.md) + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:62](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L62) + +Camera shader bindings built with `createCameraShaderBindings`. When set, the render context +carries a ready-made `cameraBindGroup` for the live camera texture every frame. + +*** + +### device? + +> `optional` **device**: `GPUDevice` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:57](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L57) + +Bring your own GPUDevice instead of the shared one from `useCameraWebGpuDevice`. It is +validated against the required camera-import features; a device missing any of them surfaces +a descriptive `error` instead of failing per frame. + +*** + +### enabled? + +> `optional` **enabled**: `boolean` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:42](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L42) + +Whether the source is live. While `false`, no track or surface pool exists and nothing is +published — the declarative sibling of VisionCamera's `isActive`. Defaults to `true`. + +*** + +### frameIntervalNanoseconds? + +> `optional` **frameIntervalNanoseconds**: `number` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:77](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L77) + +Fallback spacing between published frames, in nanoseconds, used only when a camera frame +carries no usable timestamp. Defaults to 33,333,333 (30 fps). + +*** + +### height + +> **height**: `number` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:46](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L46) + +Height of the published video, in pixels. + +*** + +### onFrame() + +> **onFrame**: (`frame`, `render`) => `void` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:70](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L70) + +Worklet called for every camera frame. Call `render(...)` at most once to draw this frame's +output; skipping it drops the frame (nothing is published for it). After `render(...)` +returns you may keep using `frame` (for example run inference) — but only until this +callback returns, when the hook releases the frame. Do not retain it. Keep the function's +identity stable (`useCallback` or module scope). + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `frame` | `Frame` | +| `render` | [`WebGpuFrameRenderFunction`](../type-aliases/WebGpuFrameRenderFunction.md) | + +#### Returns + +`void` + +*** + +### onFrameDropped()? + +> `optional` **onFrameDropped**: (`reason`) => `void` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:72](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L72) + +Called whenever the camera pipeline drops a frame; forwarded to VisionCamera. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `reason` | `FrameDroppedReason` | + +#### Returns + +`void` + +*** + +### poolSize? + +> `optional` **poolSize**: `number` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:51](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L51) + +Number of in-flight output surfaces (a pushed frame may still be encoding while the next one +is drawn). Defaults to `3`. + +*** + +### width + +> **width**: `number` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:44](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L44) + +Width of the published video, in pixels. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceResult.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceResult.md new file mode 100644 index 00000000..c893f98d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/UseVisionCameraWebGpuSourceResult.md @@ -0,0 +1,47 @@ +# Interface: UseVisionCameraWebGpuSourceResult + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:81](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L81) + +Result of [useVisionCameraWebGpuSource](../functions/useVisionCameraWebGpuSource.md). + +## Properties + +### device + +> **device**: `null` \| `GPUDevice` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:93](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L93) + +The GPUDevice in use — build your pipelines against it. `null` until acquired. + +*** + +### error + +> **error**: `null` \| `Error` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:95](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L95) + +WebGPU runtime, device acquisition, track creation, or publishing failure, if any. + +*** + +### frameOutput + +> **frameOutput**: `CameraFrameOutput` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:86](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L86) + +The VisionCamera frame output driving this source. Plug it into your camera session: +`useCamera({ device, isActive, outputs: [frameOutput] })`. + +*** + +### stream + +> **stream**: `null` \| `MediaStream` + +Defined in: [react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts:91](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-native-vision-camera-source/src/webgpu/useVisionCameraWebGpuSource.ts#L91) + +The published stream — render it with `RTCView` for a self-view. `null` until the underlying +track is ready (creation is asynchronous). diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/WebGpuFrameRenderContext.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/WebGpuFrameRenderContext.md new file mode 100644 index 00000000..e438e914 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/interfaces/WebGpuFrameRenderContext.md @@ -0,0 +1,135 @@ +# Interface: WebGpuFrameRenderContext + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:8 + +Everything your render callback needs for one frame. Handed to the function you pass to +`render(...)` inside the source hook's `onFrame` worklet; every field is valid only until that +function returns. + +## Properties + +### cameraBindGroup? + +> `optional` **cameraBindGroup**: `GPUBindGroup` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:31 + +Ready-made bind group for [cameraTexture](#cameratexture), present when the hook's +`cameraShaderBindings` option was provided: set it at the bindings' group index and +`sampleCamera(uv)` works. + +*** + +### cameraHeight + +> **cameraHeight**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:50 + +*** + +### cameraIsMirrored + +> **cameraIsMirrored**: `boolean` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:52 + +Whether the camera feed is mirrored (front cameras usually are). + +*** + +### cameraTexture + +> **cameraTexture**: `GPUExternalTexture` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:25 + +The live camera frame as a `texture_external`, already rotated upright (and mirrored per the +camera's mirroring). On Android it samples as raw YCbCr — sample it through +`createCameraShaderBindings` (or the ready-made [cameraBindGroup](#camerabindgroup)) for +platform-correct RGB. + +*** + +### cameraWidth + +> **cameraWidth**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:49 + +Upright (post-rotation) camera frame size, in pixels — feed it to `computeAspectFillCrop` +together with the output aspect. + +*** + +### commandEncoder + +> **commandEncoder**: `GPUCommandEncoder` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:18 + +The command encoder for this frame. Encode your render/compute passes into it — the hook +submits it (a single submit) and delivers the frame after your callback returns. Do not call +`queue.submit` yourself for work targeting [outputTexture](#outputtexture). + +*** + +### device + +> **device**: `GPUDevice` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:10 + +The device in use (the shared device, or your override). + +*** + +### outputHeight + +> **outputHeight**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:44 + +*** + +### outputTexture + +> **outputTexture**: `GPUTexture` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:33 + +The output texture your passes draw into; its content becomes the published video frame. + +*** + +### outputView + +> **outputView**: `GPUTextureView` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:41 + +A cached, reusable default `createView()` of [outputTexture](#outputtexture). Prefer this over calling +`outputTexture.createView()` yourself every frame: `GPUTextureView` has no `destroy()`/`release()` +in react-native-webgpu, so a per-frame view accumulates native (malloc) wrappers on the frame +runtime until GC — a steady leak in a render loop. The output textures are a small fixed pool, so +the hook builds one view per slot and reuses it. + +*** + +### outputWidth + +> **outputWidth**: `number` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:43 + +Size of [outputTexture](#outputtexture), in pixels. + +*** + +### queue + +> **queue**: `GPUQueue` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:12 + +Shortcut for `device.queue`. diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md new file mode 100644 index 00000000..cb3b6058 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuFrameRenderFunction.md @@ -0,0 +1,18 @@ +# Type Alias: WebGpuFrameRenderFunction() + +> **WebGpuFrameRenderFunction** = (`encode`) => `void` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/frameRenderContext.d.ts:60 + +The `render` function handed to the source hook's `onFrame` worklet. Call it at most once per +frame with your encode function; skipping it drops the frame (nothing is published for it). + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `encode` | (`context`) => `void` | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuRuntime.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuRuntime.md new file mode 100644 index 00000000..3b1ade5b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/type-aliases/WebGpuRuntime.md @@ -0,0 +1,7 @@ +# Type Alias: WebGpuRuntime + +> **WebGpuRuntime** = *typeof* `RNWebGPU` + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/webGpuRuntime.d.ts:2 + +The react-native-webgpu runtime singleton (the `RNWebGPU` JSI global). diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/FrameCropParams.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/FrameCropParams.md new file mode 100644 index 00000000..369a9a5c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/FrameCropParams.md @@ -0,0 +1,11 @@ +# Variable: FrameCropParams + +> `const` **FrameCropParams**: `d.WgslStruct`\<\{ `cropOrigin`: `d.Vec2f`; `cropSize`: `d.Vec2f`; `sourceSize`: `d.Vec2u`; `uvTransform`: `d.Mat2x2f`; \}\> + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cropUtilities.d.ts:15 + +The TypeGPU schema for the crop uniform. This is the single source of truth for both the WGSL +`struct FrameCropParams` (emitted when the passthrough shader is resolved) and the byte layout +[packFrameCropParams](../functions/packFrameCropParams.md) writes. Its std140 layout is 40 bytes: + + sourceSize: vec2u @0 cropOrigin: vec2f @8 cropSize: vec2f @16 uvTransform: mat2x2f @24 diff --git a/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/sampleCamera.md b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/sampleCamera.md new file mode 100644 index 00000000..2ddcfe67 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/vision-camera-source/webgpu/variables/sampleCamera.md @@ -0,0 +1,10 @@ +# Variable: sampleCamera + +> `const` **sampleCamera**: `TgpuFn`\<(`uv`) => `d.Vec4f`\> + +Defined in: react-native-custom-video-source/dist/typescript/webgpu/cameraShaderBindings.d.ts:11 + +Samples the live camera and returns upright RGB on both platforms (the Android in-shader BT.709 +YUV decode is included automatically). A TypeGPU function you can call from your own TGSL +fragment shaders. It reads the camera texture + sampler declared by +[CameraShaderBindings.bindingDeclarations](../interfaces/CameraShaderBindings.md#bindingdeclarations), which you must prepend to the resolved shader. diff --git a/versioned_docs/version-0.30.0/api/web/enumerations/Variant.md b/versioned_docs/version-0.30.0/api/web/enumerations/Variant.md new file mode 100644 index 00000000..fc4e6cfa --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/enumerations/Variant.md @@ -0,0 +1,43 @@ +# Enumeration: Variant + +Defined in: ts-client/dist/index.d.mts:51 + +## Enumeration Members + +### UNRECOGNIZED + +> **UNRECOGNIZED**: `-1` + +Defined in: ts-client/dist/index.d.mts:56 + +*** + +### VARIANT\_HIGH + +> **VARIANT\_HIGH**: `3` + +Defined in: ts-client/dist/index.d.mts:55 + +*** + +### VARIANT\_LOW + +> **VARIANT\_LOW**: `1` + +Defined in: ts-client/dist/index.d.mts:53 + +*** + +### VARIANT\_MEDIUM + +> **VARIANT\_MEDIUM**: `2` + +Defined in: ts-client/dist/index.d.mts:54 + +*** + +### VARIANT\_UNSPECIFIED + +> **VARIANT\_UNSPECIFIED**: `0` + +Defined in: ts-client/dist/index.d.mts:52 diff --git a/versioned_docs/version-0.30.0/api/web/functions/FishjamProvider.md b/versioned_docs/version-0.30.0/api/web/functions/FishjamProvider.md new file mode 100644 index 00000000..9718342b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/FishjamProvider.md @@ -0,0 +1,17 @@ +# Function: FishjamProvider() + +> **FishjamProvider**(`props`): `Element` + +Defined in: [react-client/src/FishjamProvider.tsx:74](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L74) + +Provides the Fishjam Context + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | [`FishjamProviderProps`](../interfaces/FishjamProviderProps.md) | + +## Returns + +`Element` diff --git a/versioned_docs/version-0.30.0/api/web/functions/useCamera.md b/versioned_docs/version-0.30.0/api/web/functions/useCamera.md new file mode 100644 index 00000000..9312499c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useCamera.md @@ -0,0 +1,122 @@ +# Function: useCamera() + +> **useCamera**(): `object` + +Defined in: [react-client/src/hooks/devices/useCamera.ts:9](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useCamera.ts#L9) + +This hook can toggle camera on/off, change camera, provides current camera and other. + +## Returns + +### ~~activeCamera~~ + +> **activeCamera**: `null` \| [`DeviceItem`](../type-aliases/DeviceItem.md) = `cameraManager.activeDevice` + +#### Deprecated + +Use `currentCamera` and `isCameraOn` instead +Indicates which camera is now turned on and streaming + +### cameraDeviceError + +> **cameraDeviceError**: `null` \| [`DeviceError`](../type-aliases/DeviceError.md) = `cameraManager.deviceError` + +Possible error thrown while setting up the camera + +### cameraDevices + +> **cameraDevices**: [`DeviceItem`](../type-aliases/DeviceItem.md)[] = `cameraManager.deviceList` + +List of available camera devices + +### cameraStream + +> **cameraStream**: `null` \| `MediaStream` + +The MediaStream object containing the current stream + +### currentCamera + +> **currentCamera**: `null` \| `MediaDeviceInfo` = `cameraManager.selectedDevice` + +Indicates which camera is now selected + +### currentCameraMiddleware + +> **currentCameraMiddleware**: [`TrackMiddleware`](../type-aliases/TrackMiddleware.md) = `videoTrackManager.currentMiddleware` + +The currently set camera middleware function + +### isCameraOn + +> **isCameraOn**: `boolean` = `!!cameraStream` + +Indicates whether the camera is streaming video + +### selectCamera() + +> **selectCamera**: (`deviceId`) => `Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> = `videoTrackManager.selectDevice` + +Selects the camera device + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceId` | `string` | + +#### Returns + +`Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> + +### setCameraTrackMiddleware() + +> **setCameraTrackMiddleware**: (`middleware`) => `Promise`\<`void`\> = `videoTrackManager.setTrackMiddleware` + +Sets the camera middleware + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `middleware` | [`TrackMiddleware`](../type-aliases/TrackMiddleware.md) | + +#### Returns + +`Promise`\<`void`\> + +### startCamera() + +> **startCamera**: (`deviceId?`) => `Promise`\<\[`MediaStreamTrack`, `null`\] \| \[`null`, [`DeviceError`](../type-aliases/DeviceError.md)\]\> = `videoTrackManager.startDevice` + +Starts the camera + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceId?` | `null` \| `string` | + +#### Returns + +`Promise`\<\[`MediaStreamTrack`, `null`\] \| \[`null`, [`DeviceError`](../type-aliases/DeviceError.md)\]\> + +### stopCamera() + +> **stopCamera**: () => `void` = `videoTrackManager.stopDevice` + +Stops the camera + +#### Returns + +`void` + +### toggleCamera() + +> **toggleCamera**: () => `Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> = `videoTrackManager.toggleDevice` + +Toggles current camera on/off + +#### Returns + +`Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> diff --git a/versioned_docs/version-0.30.0/api/web/functions/useConnection.md b/versioned_docs/version-0.30.0/api/web/functions/useConnection.md new file mode 100644 index 00000000..066595f2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useConnection.md @@ -0,0 +1,53 @@ +# Function: useConnection() + +> **useConnection**(): `object` + +Defined in: [react-client/src/hooks/useConnection.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useConnection.ts#L26) + +Hook allows to join or leave a room and check the current connection status. + +## Returns + +### joinRoom() + +> **joinRoom**: \<`PeerMetadata`\>(`__namedParameters`) => `Promise`\<`void`\> + +Join room and start streaming camera and microphone + +#### Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `__namedParameters` | [`JoinRoomConfig`](../interfaces/JoinRoomConfig.md)\<`PeerMetadata`\> | + +#### Returns + +`Promise`\<`void`\> + +### leaveRoom() + +> **leaveRoom**: () => `void` + +Leave room and stop streaming + +#### Returns + +`void` + +### peerStatus + +> **peerStatus**: [`PeerStatus`](../type-aliases/PeerStatus.md) + +Current peer connection status + +### reconnectionStatus + +> **reconnectionStatus**: [`ReconnectionStatus`](../type-aliases/ReconnectionStatus.md) + +Current reconnection status diff --git a/versioned_docs/version-0.30.0/api/web/functions/useCustomSource.md b/versioned_docs/version-0.30.0/api/web/functions/useCustomSource.md new file mode 100644 index 00000000..f3ac1369 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useCustomSource.md @@ -0,0 +1,44 @@ +# Function: useCustomSource() + +> **useCustomSource**\<`T`\>(`sourceId`): `object` + +Defined in: [react-client/src/hooks/useCustomSource.ts:11](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useCustomSource.ts#L11) + +This hook can register/deregister a custom MediaStream with Fishjam. + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* `string` | + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `sourceId` | `T` | Stable id identifying this custom source. | + +## Returns + +### setStream() + +> **setStream**: (`newStream`) => `Promise`\<`void`\> + +Associates the given stream with the custom source. +This stream will be sent to Fishjam after startStreaming has been called. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `newStream` | `null` \| `MediaStream` | + +#### Returns + +`Promise`\<`void`\> + +### stream + +> **stream**: `undefined` \| `MediaStream` + +The MediaStream currently associated with the custom source diff --git a/versioned_docs/version-0.30.0/api/web/functions/useDataChannel.md b/versioned_docs/version-0.30.0/api/web/functions/useDataChannel.md new file mode 100644 index 00000000..3b211fcd --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useDataChannel.md @@ -0,0 +1,11 @@ +# Function: useDataChannel() + +> **useDataChannel**(): [`UseDataChannelResult`](../type-aliases/UseDataChannelResult.md) + +Defined in: [react-client/src/hooks/useDataChannel.ts:15](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useDataChannel.ts#L15) + +Hook for data channel operations - publish and subscribe to data. + +## Returns + +[`UseDataChannelResult`](../type-aliases/UseDataChannelResult.md) diff --git a/versioned_docs/version-0.30.0/api/web/functions/useInitializeDevices.md b/versioned_docs/version-0.30.0/api/web/functions/useInitializeDevices.md new file mode 100644 index 00000000..f42ec0ae --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useInitializeDevices.md @@ -0,0 +1,25 @@ +# Function: useInitializeDevices() + +> **useInitializeDevices**(): `object` + +Defined in: [react-client/src/hooks/devices/useInitializeDevices.ts:14](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useInitializeDevices.ts#L14) + +Hook allows you to initialize access to the devices before joining the room. + +## Returns + +### initializeDevices() + +> **initializeDevices**: (`settings?`) => `Promise`\<[`InitializeDevicesResult`](../type-aliases/InitializeDevicesResult.md)\> + +Initialize access to the devices before joining the room + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `settings?` | [`InitializeDevicesSettings`](../type-aliases/InitializeDevicesSettings.md) | + +#### Returns + +`Promise`\<[`InitializeDevicesResult`](../type-aliases/InitializeDevicesResult.md)\> diff --git a/versioned_docs/version-0.30.0/api/web/functions/useLivestreamStreamer.md b/versioned_docs/version-0.30.0/api/web/functions/useLivestreamStreamer.md new file mode 100644 index 00000000..a7f69db4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useLivestreamStreamer.md @@ -0,0 +1,11 @@ +# Function: useLivestreamStreamer() + +> **useLivestreamStreamer**(): [`UseLivestreamStreamerResult`](../interfaces/UseLivestreamStreamerResult.md) + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:52](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L52) + +Hook for publishing a livestream, which can be then received with [useLivestreamViewer](useLivestreamViewer.md) + +## Returns + +[`UseLivestreamStreamerResult`](../interfaces/UseLivestreamStreamerResult.md) diff --git a/versioned_docs/version-0.30.0/api/web/functions/useLivestreamViewer.md b/versioned_docs/version-0.30.0/api/web/functions/useLivestreamViewer.md new file mode 100644 index 00000000..b2d81360 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useLivestreamViewer.md @@ -0,0 +1,11 @@ +# Function: useLivestreamViewer() + +> **useLivestreamViewer**(): [`UseLivestreamViewerResult`](../interfaces/UseLivestreamViewerResult.md) + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L43) + +Hook for receiving a published livestream. + +## Returns + +[`UseLivestreamViewerResult`](../interfaces/UseLivestreamViewerResult.md) diff --git a/versioned_docs/version-0.30.0/api/web/functions/useMicrophone.md b/versioned_docs/version-0.30.0/api/web/functions/useMicrophone.md new file mode 100644 index 00000000..3ce33436 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useMicrophone.md @@ -0,0 +1,138 @@ +# Function: useMicrophone() + +> **useMicrophone**(): `object` + +Defined in: [react-client/src/hooks/devices/useMicrophone.ts:9](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useMicrophone.ts#L9) + +Manage microphone + +## Returns + +### ~~activeMicrophone~~ + +> **activeMicrophone**: `null` \| [`DeviceItem`](../type-aliases/DeviceItem.md) = `microphoneManager.activeDevice` + +#### Deprecated + +Use `currentMicrophone` and `isMicrophoneOn` instead +Indicates which microphone is now turned on and streaming audio + +### currentMicrophone + +> **currentMicrophone**: `null` \| `MediaDeviceInfo` = `microphoneManager.selectedDevice` + +Indicates which microphone is now selected + +### currentMicrophoneMiddleware + +> **currentMicrophoneMiddleware**: [`TrackMiddleware`](../type-aliases/TrackMiddleware.md) = `audioTrackManager.currentMiddleware` + +The currently set microphone middleware function + +### isMicrophoneMuted + +> **isMicrophoneMuted**: `boolean` = `!microphoneManager.deviceEnabled` + +Indicates whether the microphone is muted + +### isMicrophoneOn + +> **isMicrophoneOn**: `boolean` = `!!microphoneStream` + +Indicates whether the microphone is streaming audio + +### microphoneDeviceError + +> **microphoneDeviceError**: `null` \| [`DeviceError`](../type-aliases/DeviceError.md) = `microphoneManager.deviceError` + +Possible error thrown while setting up the microphone + +### microphoneDevices + +> **microphoneDevices**: [`DeviceItem`](../type-aliases/DeviceItem.md)[] = `microphoneManager.deviceList` + +List of available microphone devices + +### microphoneStream + +> **microphoneStream**: `null` \| `MediaStream` + +The MediaStream object containing the current audio stream + +### selectMicrophone() + +> **selectMicrophone**: (`deviceId`) => `Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> = `audioTrackManager.selectDevice` + +Selects the microphone device + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceId` | `string` | + +#### Returns + +`Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> + +### setMicrophoneTrackMiddleware() + +> **setMicrophoneTrackMiddleware**: (`middleware`) => `Promise`\<`void`\> = `audioTrackManager.setTrackMiddleware` + +Sets the microphone middleware + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `middleware` | [`TrackMiddleware`](../type-aliases/TrackMiddleware.md) | + +#### Returns + +`Promise`\<`void`\> + +### startMicrophone() + +> **startMicrophone**: (`deviceId?`) => `Promise`\<\[`MediaStreamTrack`, `null`\] \| \[`null`, [`DeviceError`](../type-aliases/DeviceError.md)\]\> = `audioTrackManager.startDevice` + +Starts the microphone + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceId?` | `null` \| `string` | + +#### Returns + +`Promise`\<\[`MediaStreamTrack`, `null`\] \| \[`null`, [`DeviceError`](../type-aliases/DeviceError.md)\]\> + +### stopMicrophone() + +> **stopMicrophone**: () => `void` = `audioTrackManager.stopDevice` + +Stops the microphone + +#### Returns + +`void` + +### toggleMicrophone() + +> **toggleMicrophone**: () => `Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> = `audioTrackManager.toggleDevice` + +Toggles current microphone on/off + +#### Returns + +`Promise`\<`undefined` \| [`DeviceError`](../type-aliases/DeviceError.md)\> + +### toggleMicrophoneMute() + +> **toggleMicrophoneMute**: () => `Promise`\<`void`\> = `audioTrackManager.toggleMute` + +Mutes/unmutes the microphone + +#### Returns + +`Promise`\<`void`\> diff --git a/versioned_docs/version-0.30.0/api/web/functions/usePeers.md b/versioned_docs/version-0.30.0/api/web/functions/usePeers.md new file mode 100644 index 00000000..6935216f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/usePeers.md @@ -0,0 +1,56 @@ +# Function: usePeers() + +> **usePeers**\<`PeerMetadata`, `ServerMetadata`\>(): `object` + +Defined in: [react-client/src/hooks/usePeers.ts:115](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L115) + +Hook allows to access id, tracks and metadata of the local and remote peers. + +## Type Parameters + +| Type Parameter | Default type | Description | +| ------ | ------ | ------ | +| `PeerMetadata` | `Record`\<`string`, `unknown`\> | Type of metadata set by peer while connecting to a room. | +| `ServerMetadata` | `Record`\<`string`, `unknown`\> | Type of metadata set by the server while creating a peer. | + +## Returns + +### localPeer + +> **localPeer**: `null` \| [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`PeerMetadata`, `ServerMetadata`, [`Track`](../type-aliases/Track.md)\> + +The local peer with distinguished tracks (camera, microphone, screen share). +Will be null if the local peer is not found. + +### ~~peers~~ + +> **peers**: [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`PeerMetadata`, `ServerMetadata`, [`RemoteTrack`](../type-aliases/RemoteTrack.md)\>[] = `remotePeers` + +#### Deprecated + +Use remotePeers instead +Legacy array containing remote peers. +This property will be removed in future versions. + +### remotePeers + +> **remotePeers**: [`PeerWithTracks`](../type-aliases/PeerWithTracks.md)\<`PeerMetadata`, `ServerMetadata`, [`RemoteTrack`](../type-aliases/RemoteTrack.md)\>[] + +Array of remote peers with distinguished tracks (camera, microphone, screen share). + +### setReceivedTracksQuality() + +> **setReceivedTracksQuality**: (`trackIds`, `quality`) => `void` + +This function allows to set the quality of tracks received from remote peers. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `trackIds` | `string`[] | The array of the track ids to set the quality for. | +| `quality` | [`Variant`](../enumerations/Variant.md) | The quality to set for the track. | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/functions/useSandbox.md b/versioned_docs/version-0.30.0/api/web/functions/useSandbox.md new file mode 100644 index 00000000..1264802e --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useSandbox.md @@ -0,0 +1,88 @@ +# Function: useSandbox() + +> **useSandbox**(`props`): `object` + +Defined in: [react-client/src/hooks/useSandbox.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L29) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `props` | [`UseSandboxProps`](../type-aliases/UseSandboxProps.md) | + +## Returns + +`object` + +### getSandboxLivestream() + +> **getSandboxLivestream**: (`roomName`, `isPublic`) => `Promise`\<\{ `room`: \{ `id`: `string`; `name`: `string`; \}; `streamerToken`: `string`; \}\> + +#### Parameters + +| Parameter | Type | Default value | +| ------ | ------ | ------ | +| `roomName` | `string` | `undefined` | +| `isPublic` | `boolean` | `false` | + +#### Returns + +`Promise`\<\{ `room`: \{ `id`: `string`; `name`: `string`; \}; `streamerToken`: `string`; \}\> + +### getSandboxMoqPublisherAccess() + +> **getSandboxMoqPublisherAccess**: (`streamName`) => `Promise`\<[`MoqAccess`](../type-aliases/MoqAccess.md)\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `streamName` | `string` | + +#### Returns + +`Promise`\<[`MoqAccess`](../type-aliases/MoqAccess.md)\> + +### getSandboxMoqSubscriberAccess() + +> **getSandboxMoqSubscriberAccess**: (`streamName`) => `Promise`\<[`MoqAccess`](../type-aliases/MoqAccess.md)\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `streamName` | `string` | + +#### Returns + +`Promise`\<[`MoqAccess`](../type-aliases/MoqAccess.md)\> + +### getSandboxPeerToken() + +> **getSandboxPeerToken**: (`roomName`, `peerName`, `roomType`) => `Promise`\<`string`\> + +#### Parameters + +| Parameter | Type | Default value | +| ------ | ------ | ------ | +| `roomName` | `string` | `undefined` | +| `peerName` | `string` | `undefined` | +| `roomType` | [`RoomType`](../type-aliases/RoomType.md) | `"conference"` | + +#### Returns + +`Promise`\<`string`\> + +### getSandboxViewerToken() + +> **getSandboxViewerToken**: (`roomName`) => `Promise`\<`string`\> + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `roomName` | `string` | + +#### Returns + +`Promise`\<`string`\> diff --git a/versioned_docs/version-0.30.0/api/web/functions/useScreenShare.md b/versioned_docs/version-0.30.0/api/web/functions/useScreenShare.md new file mode 100644 index 00000000..cace8d8f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useScreenShare.md @@ -0,0 +1,81 @@ +# Function: useScreenShare() + +> **useScreenShare**(): `object` + +Defined in: [react-client/src/hooks/useScreenShare.ts:10](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useScreenShare.ts#L10) + +Hook to enable screen sharing within a room and manage the existing stream. + +## Returns + +### audioTrack + +> **audioTrack**: `null` \| `MediaStreamTrack` = `screenShareManager.audioTrack` + +The separate audio MediaStreamTrack. + +### currentTracksMiddleware + +> **currentTracksMiddleware**: `null` \| [`TracksMiddleware`](../type-aliases/TracksMiddleware.md) = `screenShareManager.currentTracksMiddleware` + +The middleware currently assigned to process the tracks. +A screenshare may include both audio and video tracks, and this middleware is capable of processing +each track type. + +### setTracksMiddleware() + +> **setTracksMiddleware**: (`middleware`) => `Promise`\<`void`\> = `screenShareManager.setTracksMiddleware` + +Sets the middleware responsible for processing the tracks. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `middleware` | `null` \| [`TracksMiddleware`](../type-aliases/TracksMiddleware.md) | The middleware to set, which can be a TracksMiddleware instance or null to remove the middleware. | + +#### Returns + +`Promise`\<`void`\> + +A Promise that resolves once the middleware is successfully set. + +### startStreaming() + +> **startStreaming**: (`props?`) => `Promise`\<`void`\> = `screenShareManager.startStreaming` + +Invokes the screen sharing prompt in the user's browser and starts streaming upon approval. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `props?` | \{ `audioConstraints?`: `boolean` \| `MediaTrackConstraints`; `videoConstraints?`: `boolean` \| `MediaTrackConstraints`; \} | +| `props.audioConstraints?` | `boolean` \| `MediaTrackConstraints` | +| `props.videoConstraints?` | `boolean` \| `MediaTrackConstraints` | + +#### Returns + +`Promise`\<`void`\> + +### stopStreaming() + +> **stopStreaming**: () => `Promise`\<`void`\> = `screenShareManager.stopStreaming` + +Stops the stream and cancels browser screen sharing. + +#### Returns + +`Promise`\<`void`\> + +### stream + +> **stream**: `null` \| `MediaStream` = `screenShareManager.stream` + +The MediaStream object containing both tracks. + +### videoTrack + +> **videoTrack**: `null` \| `MediaStreamTrack` = `screenShareManager.videoTrack` + +The separate video MediaStreamTrack. diff --git a/versioned_docs/version-0.30.0/api/web/functions/useUpdatePeerMetadata.md b/versioned_docs/version-0.30.0/api/web/functions/useUpdatePeerMetadata.md new file mode 100644 index 00000000..ab2e1000 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useUpdatePeerMetadata.md @@ -0,0 +1,31 @@ +# Function: useUpdatePeerMetadata() + +> **useUpdatePeerMetadata**\<`PeerMetadata`\>(): `object` + +Defined in: [react-client/src/hooks/useUpdatePeerMetadata.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useUpdatePeerMetadata.ts#L12) + +Hook provides a method to update the metadata of the local peer. + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +## Returns + +### updatePeerMetadata() + +> **updatePeerMetadata**: (`peerMetadata`) => `void` + +Updates metadata visible to other peers + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `peerMetadata` | `PeerMetadata` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/functions/useVAD.md b/versioned_docs/version-0.30.0/api/web/functions/useVAD.md new file mode 100644 index 00000000..fb04a73f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/functions/useVAD.md @@ -0,0 +1,25 @@ +# Function: useVAD() + +> **useVAD**(`options`): `Record`\<[`PeerId`](../type-aliases/PeerId.md), `boolean`\> + +Defined in: [react-client/src/hooks/useVAD.ts:34](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useVAD.ts#L34) + +Voice activity detection. Use this hook to check if voice is detected in the audio track for given peer(s). + +Remote peer VAD is driven by `vadNotification` messages from the backend. +If the local peer's id is included in `peerIds`, local VAD is determined client-side +by polling the microphone's audio level (see `useLocalVAD`). + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `options` | \{ `peerIds`: readonly [`PeerId`](../type-aliases/PeerId.md)[]; \} | Options object. | +| `options.peerIds` | readonly [`PeerId`](../type-aliases/PeerId.md)[] | List of peer ids to subscribe to for VAD notifications. Include the local peer's id to also track whether the local user is speaking. Example usage: `import { useVAD, type PeerId } from "@fishjam-cloud/react-client"; function WhoIsTalkingComponent({ peerIds }: { peerIds: PeerId[] }) { const peersInfo = useVAD({ peerIds }); const activePeers = (Object.keys(peersInfo) as PeerId[]).filter((peerId) => peersInfo[peerId]); return "Now talking: " + activePeers.join(", "); }` | + +## Returns + +`Record`\<[`PeerId`](../type-aliases/PeerId.md), `boolean`\> + +A record where each key is a peer id and the boolean value indicates +whether voice activity is currently detected for that peer. diff --git a/versioned_docs/version-0.30.0/api/web/index.md b/versioned_docs/version-0.30.0/api/web/index.md new file mode 100644 index 00000000..8134ba27 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/index.md @@ -0,0 +1,77 @@ +# @fishjam-cloud/react-client + +React client SDK for building web video and audio apps with Fishjam. + +## Connection + +- [useConnection](functions/useConnection.md) +- [useDataChannel](functions/useDataChannel.md) +- [usePeers](functions/usePeers.md) +- [useUpdatePeerMetadata](functions/useUpdatePeerMetadata.md) +- [useVAD](functions/useVAD.md) +- [Metadata](type-aliases/Metadata.md) + +## Devices + +- [useCamera](functions/useCamera.md) +- [useInitializeDevices](functions/useInitializeDevices.md) +- [useMicrophone](functions/useMicrophone.md) +- [useScreenShare](functions/useScreenShare.md) + +## Components + +- [FishjamProvider](functions/FishjamProvider.md) +- [FishjamProviderProps](interfaces/FishjamProviderProps.md) + +## Livestream + +- [useLivestreamStreamer](functions/useLivestreamStreamer.md) +- [useLivestreamViewer](functions/useLivestreamViewer.md) +- [UseLivestreamStreamerResult](interfaces/UseLivestreamStreamerResult.md) +- [UseLivestreamViewerResult](interfaces/UseLivestreamViewerResult.md) +- [ConnectStreamerConfig](type-aliases/ConnectStreamerConfig.md) +- [StreamerInputs](type-aliases/StreamerInputs.md) + +## Other + +- [useCustomSource](functions/useCustomSource.md) +- [useSandbox](functions/useSandbox.md) +- [Variant](enumerations/Variant.md) +- [DataChannelOptions](interfaces/DataChannelOptions.md) +- [JoinRoomConfig](interfaces/JoinRoomConfig.md) +- [SimulcastConfig](interfaces/SimulcastConfig.md) +- [AuthErrorReason](type-aliases/AuthErrorReason.md) +- [BandwidthLimits](type-aliases/BandwidthLimits.md) +- [Brand](type-aliases/Brand.md) +- [ConnectViewerConfig](type-aliases/ConnectViewerConfig.md) +- [CustomSource](type-aliases/CustomSource.md) +- [DataCallback](type-aliases/DataCallback.md) +- [DeviceError](type-aliases/DeviceError.md) +- [DeviceItem](type-aliases/DeviceItem.md) +- [InitializeDevicesResult](type-aliases/InitializeDevicesResult.md) +- [InitializeDevicesSettings](type-aliases/InitializeDevicesSettings.md) +- [InitializeDevicesStatus](type-aliases/InitializeDevicesStatus.md) +- [JoinErrorReason](type-aliases/JoinErrorReason.md) +- [MiddlewareResult](type-aliases/MiddlewareResult.md) +- [MoqAccess](type-aliases/MoqAccess.md) +- [PeerId](type-aliases/PeerId.md) +- [PeerStatus](type-aliases/PeerStatus.md) +- [PeerWithTracks](type-aliases/PeerWithTracks.md) +- [PersistLastDeviceHandlers](type-aliases/PersistLastDeviceHandlers.md) +- [ReconnectConfig](type-aliases/ReconnectConfig.md) +- [ReconnectionStatus](type-aliases/ReconnectionStatus.md) +- [RemoteTrack](type-aliases/RemoteTrack.md) +- [RoomType](type-aliases/RoomType.md) +- [SimulcastBandwidthLimit](type-aliases/SimulcastBandwidthLimit.md) +- [SimulcastBandwidthLimits](type-aliases/SimulcastBandwidthLimits.md) +- [StreamConfig](type-aliases/StreamConfig.md) +- [Track](type-aliases/Track.md) +- [TrackBandwidthLimit](type-aliases/TrackBandwidthLimit.md) +- [TrackId](type-aliases/TrackId.md) +- [TrackMiddleware](type-aliases/TrackMiddleware.md) +- [TracksMiddleware](type-aliases/TracksMiddleware.md) +- [TracksMiddlewareResult](type-aliases/TracksMiddlewareResult.md) +- [UseDataChannelResult](type-aliases/UseDataChannelResult.md) +- [UseInitializeDevicesParams](type-aliases/UseInitializeDevicesParams.md) +- [UseSandboxProps](type-aliases/UseSandboxProps.md) +- [SimulcastConfig](variables/SimulcastConfig.md) diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/DataChannelOptions.md b/versioned_docs/version-0.30.0/api/web/interfaces/DataChannelOptions.md new file mode 100644 index 00000000..3ac150b4 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/DataChannelOptions.md @@ -0,0 +1,16 @@ +# Interface: DataChannelOptions + +Defined in: ts-client/dist/index.d.mts:501 + +Options for publishing or subscribing to data. + +## Properties + +### reliable + +> **reliable**: `boolean` + +Defined in: ts-client/dist/index.d.mts:506 + +If true, uses the reliable data channel (ordered, guaranteed delivery). +If false, uses the lossy data channel (unordered, low latency). diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/FishjamProviderProps.md b/versioned_docs/version-0.30.0/api/web/interfaces/FishjamProviderProps.md new file mode 100644 index 00000000..41c1c31f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/FishjamProviderProps.md @@ -0,0 +1,107 @@ +# Interface: FishjamProviderProps + +Defined in: [react-client/src/FishjamProvider.tsx:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L27) + +## Extends + +- `PropsWithChildren` + +## Properties + +### audioConfig? + +> `optional` **audioConfig**: [`StreamConfig`](../type-aliases/StreamConfig.md) + +Defined in: [react-client/src/FishjamProvider.tsx:55](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L55) + +Configure whether to use audio simulcast and which quality layers to send if so. + +*** + +### bandwidthLimits? + +> `optional` **bandwidthLimits**: `Partial`\<[`BandwidthLimits`](../type-aliases/BandwidthLimits.md)\> + +Defined in: [react-client/src/FishjamProvider.tsx:47](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L47) + +Adjust max bandwidth limit for a single stream and simulcast. + +*** + +### constraints? + +> `optional` **constraints**: `Pick`\<`MediaStreamConstraints`, `"audio"` \| `"video"`\> + +Defined in: [react-client/src/FishjamProvider.tsx:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L38) + +Set preferred constraints. + +#### Param + +The media stream constraints as defined by the Web API. + +#### See + +[MediaStreamConstraints](https://udn.realityripple.com/docs/Web/API/MediaStreamConstraints) + +*** + +### debug? + +> `optional` **debug**: `boolean` + +Defined in: [react-client/src/FishjamProvider.tsx:63](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L63) + +Enables Fishjam SDK's debug logs in the console. + +*** + +### fishjamClient? + +> `optional` **fishjamClient**: `FishjamClient`\<`GenericMetadata`, `GenericMetadata`\> + +Defined in: [react-client/src/FishjamProvider.tsx:67](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L67) + +Allows to provide your own FishjamClient instance from ts-client. + +*** + +### fishjamId + +> **fishjamId**: `string` + +Defined in: [react-client/src/FishjamProvider.tsx:59](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L59) + +You can get you Fishjam ID at https://fishjam.io/app + +*** + +### persistLastDevice? + +> `optional` **persistLastDevice**: `boolean` \| [`PersistLastDeviceHandlers`](../type-aliases/PersistLastDeviceHandlers.md) + +Defined in: [react-client/src/FishjamProvider.tsx:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L43) + +Decide if you want Fishjam SDK to persist last used device in the local storage. +You can also provide your getter and setter by using the [PersistLastDeviceHandlers](../type-aliases/PersistLastDeviceHandlers.md) interface. + +*** + +### reconnect? + +> `optional` **reconnect**: `boolean` \| [`ReconnectConfig`](../type-aliases/ReconnectConfig.md) + +Defined in: [react-client/src/FishjamProvider.tsx:32](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L32) + +Use [ReconnectConfig](../type-aliases/ReconnectConfig.md) to adjust reconnection policy to your needs or set false it. +Set to true by default. + +*** + +### videoConfig? + +> `optional` **videoConfig**: [`StreamConfig`](../type-aliases/StreamConfig.md) + +Defined in: [react-client/src/FishjamProvider.tsx:51](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/FishjamProvider.tsx#L51) + +Configure whether to use video simulcast and which quality layers to send if so. diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/JoinRoomConfig.md b/versioned_docs/version-0.30.0/api/web/interfaces/JoinRoomConfig.md new file mode 100644 index 00000000..3c859b40 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/JoinRoomConfig.md @@ -0,0 +1,29 @@ +# Interface: JoinRoomConfig\ + +Defined in: [react-client/src/hooks/useConnection.ts:10](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useConnection.ts#L10) + +## Type Parameters + +| Type Parameter | Default type | +| ------ | ------ | +| `PeerMetadata` *extends* `GenericMetadata` | `GenericMetadata` | + +## Properties + +### peerMetadata? + +> `optional` **peerMetadata**: `PeerMetadata` + +Defined in: [react-client/src/hooks/useConnection.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useConnection.ts#L18) + +String indexed record with metadata, that will be available to all other peers + +*** + +### peerToken + +> **peerToken**: `string` + +Defined in: [react-client/src/hooks/useConnection.ts:14](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useConnection.ts#L14) + +Token received from server (or Room Manager) diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/SimulcastConfig.md b/versioned_docs/version-0.30.0/api/web/interfaces/SimulcastConfig.md new file mode 100644 index 00000000..953fa22c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/SimulcastConfig.md @@ -0,0 +1,27 @@ +# Interface: SimulcastConfig + +Defined in: ts-client/dist/index.d.mts:197 + +## Properties + +### disabledVariants + +> **disabledVariants**: [`Variant`](../enumerations/Variant.md)[] + +Defined in: ts-client/dist/index.d.mts:200 + +*** + +### enabled + +> **enabled**: `boolean` + +Defined in: ts-client/dist/index.d.mts:198 + +*** + +### enabledVariants + +> **enabledVariants**: [`Variant`](../enumerations/Variant.md)[] + +Defined in: ts-client/dist/index.d.mts:199 diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamStreamerResult.md b/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamStreamerResult.md new file mode 100644 index 00000000..802d3bc2 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamStreamerResult.md @@ -0,0 +1,62 @@ +# Interface: UseLivestreamStreamerResult + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:28](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L28) + +## Properties + +### connect() + +> **connect**: (`inputs`, `urlOverride?`) => `Promise`\<`void`\> + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L35) + +Callback used to start publishing the selected audio and video media streams. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `inputs` | [`ConnectStreamerConfig`](../type-aliases/ConnectStreamerConfig.md) | +| `urlOverride?` | `string` | + +#### Returns + +`Promise`\<`void`\> + +#### Remarks + +Calling [connect](#connect) multiple times will have the effect of only publishing the **last** specified inputs. + +*** + +### disconnect() + +> **disconnect**: () => `void` + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:37](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L37) + +Callback to stop publishing anything previously published with [connect](#connect) + +#### Returns + +`void` + +*** + +### error + +> **error**: `null` \| `LivestreamError` + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:39](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L39) + +Any errors encountered in [connect](#connect) will populate this field + +*** + +### isConnected + +> **isConnected**: `boolean` + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L41) + +Utility flag which indicates the current connection status diff --git a/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamViewerResult.md b/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamViewerResult.md new file mode 100644 index 00000000..9ac01f1f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/interfaces/UseLivestreamViewerResult.md @@ -0,0 +1,82 @@ +# Interface: UseLivestreamViewerResult + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L12) + +## Properties + +### connect() + +> **connect**: (`config`, `url?`) => `Promise`\<`void`\> + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L20) + +Callback to start receiving a livestream. +If the livestream is private, provide `token`. +If the livestream is public, provide `streamId`. + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `config` | [`ConnectViewerConfig`](../type-aliases/ConnectViewerConfig.md) | +| `url?` | `string` | + +#### Returns + +`Promise`\<`void`\> + +*** + +### disconnect() + +> **disconnect**: () => `void` + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L22) + +Callback used to disconnect from a stream previously connected to with [connect](#connect) + +#### Returns + +`void` + +*** + +### error + +> **error**: `null` \| `LivestreamError` + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L24) + +Any errors encountered in [connect](#connect) will be present in this field. + +*** + +### getStatistics() + +> **getStatistics**: () => `Promise`\<`undefined` \| `RTCStatsReport`\> + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L27) + +#### Returns + +`Promise`\<`undefined` \| `RTCStatsReport`\> + +*** + +### isConnected + +> **isConnected**: `boolean` + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L26) + +Utility flag which indicates the current connection status + +*** + +### stream + +> **stream**: `null` \| `MediaStream` + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:14](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L14) + +The received livestream media diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/AuthErrorReason.md b/versioned_docs/version-0.30.0/api/web/type-aliases/AuthErrorReason.md new file mode 100644 index 00000000..5ce791b0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/AuthErrorReason.md @@ -0,0 +1,5 @@ +# Type Alias: AuthErrorReason + +> **AuthErrorReason** = *typeof* `AUTH_ERROR_REASONS`\[`number`\] + +Defined in: ts-client/dist/index.d.mts:5 diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/BandwidthLimits.md b/versioned_docs/version-0.30.0/api/web/type-aliases/BandwidthLimits.md new file mode 100644 index 00000000..e7f3b060 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/BandwidthLimits.md @@ -0,0 +1,21 @@ +# Type Alias: BandwidthLimits + +> **BandwidthLimits** = `object` + +Defined in: [react-client/src/types/public.ts:73](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L73) + +## Properties + +### simulcast + +> **simulcast**: [`SimulcastBandwidthLimits`](SimulcastBandwidthLimits.md) + +Defined in: [react-client/src/types/public.ts:73](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L73) + +*** + +### singleStream + +> **singleStream**: `number` + +Defined in: [react-client/src/types/public.ts:73](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L73) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/Brand.md b/versioned_docs/version-0.30.0/api/web/type-aliases/Brand.md new file mode 100644 index 00000000..bc629d16 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/Brand.md @@ -0,0 +1,18 @@ +# Type Alias: Brand\ + +> **Brand**\<`T`, `TBrand`\> = `T` & `object` + +Defined in: [react-client/src/types/public.ts:84](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L84) + +## Type declaration + +### \[brand\] + +> **\[brand\]**: `TBrand` + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` | +| `TBrand` *extends* `string` | diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectStreamerConfig.md b/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectStreamerConfig.md new file mode 100644 index 00000000..d57a5605 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectStreamerConfig.md @@ -0,0 +1,23 @@ +# Type Alias: ConnectStreamerConfig + +> **ConnectStreamerConfig** = `object` + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:21](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L21) + +## Properties + +### inputs + +> **inputs**: [`StreamerInputs`](StreamerInputs.md) + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L22) + +*** + +### token + +> **token**: `string` + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L24) + +Streamer token used to authenticate with Fishjam diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectViewerConfig.md b/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectViewerConfig.md new file mode 100644 index 00000000..2dcf20ce --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/ConnectViewerConfig.md @@ -0,0 +1,5 @@ +# Type Alias: ConnectViewerConfig + +> **ConnectViewerConfig** = \{ `streamId?`: `never`; `token`: `string`; \} \| \{ `streamId`: `string`; `token?`: `never`; \} + +Defined in: [react-client/src/hooks/useLivestreamViewer.ts:7](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamViewer.ts#L7) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/CustomSource.md b/versioned_docs/version-0.30.0/api/web/type-aliases/CustomSource.md new file mode 100644 index 00000000..53e62fda --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/CustomSource.md @@ -0,0 +1,40 @@ +# Type Alias: CustomSource\ + +> **CustomSource**\<`T`\> = `object` + +Defined in: [react-client/src/types/public.ts:86](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L86) + +## Type Parameters + +| Type Parameter | +| ------ | +| `T` *extends* `string` | + +## Properties + +### id + +> **id**: `T` + +Defined in: [react-client/src/types/public.ts:87](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L87) + +*** + +### stream? + +> `optional` **stream**: `MediaStream` + +Defined in: [react-client/src/types/public.ts:89](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L89) + +*** + +### trackIds? + +> `optional` **trackIds**: `object` + +Defined in: [react-client/src/types/public.ts:88](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L88) + +| Name | Type | +| ------ | ------ | +| `audioId?` | `string` | +| `videoId?` | `string` | diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/DataCallback.md b/versioned_docs/version-0.30.0/api/web/type-aliases/DataCallback.md new file mode 100644 index 00000000..2625caca --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/DataCallback.md @@ -0,0 +1,17 @@ +# Type Alias: DataCallback() + +> **DataCallback** = (`data`) => `void` + +Defined in: ts-client/dist/index.d.mts:512 + +Callback type for receiving data from a data channel. + +## Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `data` | `Uint8Array` | The received data as a Uint8Array | + +## Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceError.md b/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceError.md new file mode 100644 index 00000000..ac622e81 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceError.md @@ -0,0 +1,5 @@ +# Type Alias: DeviceError + +> **DeviceError** = \{ `name`: `"OverconstrainedError"`; \} \| \{ `name`: `"NotAllowedError"`; \} \| \{ `name`: `"NotFoundError"`; \} \| \{ `name`: `"UNHANDLED_ERROR"`; \} + +Defined in: [react-client/src/types/public.ts:77](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L77) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceItem.md b/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceItem.md new file mode 100644 index 00000000..a717c145 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/DeviceItem.md @@ -0,0 +1,21 @@ +# Type Alias: DeviceItem + +> **DeviceItem** = `object` + +Defined in: [react-client/src/types/public.ts:58](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L58) + +## Properties + +### deviceId + +> **deviceId**: `string` + +Defined in: [react-client/src/types/public.ts:58](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L58) + +*** + +### label + +> **label**: `string` + +Defined in: [react-client/src/types/public.ts:58](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L58) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesResult.md b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesResult.md new file mode 100644 index 00000000..2a120147 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesResult.md @@ -0,0 +1,29 @@ +# Type Alias: InitializeDevicesResult + +> **InitializeDevicesResult** = `object` + +Defined in: [react-client/src/types/public.ts:12](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L12) + +## Properties + +### errors + +> **errors**: \{ `audio`: [`DeviceError`](DeviceError.md) \| `null`; `video`: [`DeviceError`](DeviceError.md) \| `null`; \} \| `null` + +Defined in: [react-client/src/types/public.ts:15](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L15) + +*** + +### status + +> **status**: [`InitializeDevicesStatus`](InitializeDevicesStatus.md) + +Defined in: [react-client/src/types/public.ts:13](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L13) + +*** + +### stream + +> **stream**: `MediaStream` \| `null` + +Defined in: [react-client/src/types/public.ts:14](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L14) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesSettings.md b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesSettings.md new file mode 100644 index 00000000..2013aca0 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesSettings.md @@ -0,0 +1,21 @@ +# Type Alias: InitializeDevicesSettings + +> **InitializeDevicesSettings** = `object` + +Defined in: [react-client/src/hooks/internal/devices/useMediaDevices.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/internal/devices/useMediaDevices.ts#L16) + +## Properties + +### enableAudio? + +> `optional` **enableAudio**: `boolean` + +Defined in: [react-client/src/hooks/internal/devices/useMediaDevices.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/internal/devices/useMediaDevices.ts#L16) + +*** + +### enableVideo? + +> `optional` **enableVideo**: `boolean` + +Defined in: [react-client/src/hooks/internal/devices/useMediaDevices.ts:16](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/internal/devices/useMediaDevices.ts#L16) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesStatus.md b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesStatus.md new file mode 100644 index 00000000..4e03d6f5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/InitializeDevicesStatus.md @@ -0,0 +1,5 @@ +# Type Alias: InitializeDevicesStatus + +> **InitializeDevicesStatus** = `"initialized"` \| `"failed"` \| `"initialized_with_errors"` \| `"already_initialized"` + +Defined in: [react-client/src/types/public.ts:10](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L10) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/JoinErrorReason.md b/versioned_docs/version-0.30.0/api/web/type-aliases/JoinErrorReason.md new file mode 100644 index 00000000..16f20741 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/JoinErrorReason.md @@ -0,0 +1,5 @@ +# Type Alias: JoinErrorReason + +> **JoinErrorReason** = *typeof* `JOIN_ERRORS`\[`number`\] + +Defined in: ts-client/dist/index.d.mts:941 diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/Metadata.md b/versioned_docs/version-0.30.0/api/web/type-aliases/Metadata.md new file mode 100644 index 00000000..956ea26c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/Metadata.md @@ -0,0 +1,28 @@ +# Type Alias: Metadata\ + +> **Metadata**\<`PeerMetadata`, `ServerMetadata`\> = `object` + +Defined in: ts-client/dist/index.d.mts:972 + +## Type Parameters + +| Type Parameter | Default type | Description | +| ------ | ------ | ------ | +| `PeerMetadata` | `GenericMetadata` | Type of metadata set by peer while connecting to a room. | +| `ServerMetadata` | `GenericMetadata` | Type of metadata set by the server while creating a peer. | + +## Properties + +### peer + +> **peer**: `PeerMetadata` + +Defined in: ts-client/dist/index.d.mts:973 + +*** + +### server + +> **server**: `ServerMetadata` + +Defined in: ts-client/dist/index.d.mts:974 diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/MiddlewareResult.md b/versioned_docs/version-0.30.0/api/web/type-aliases/MiddlewareResult.md new file mode 100644 index 00000000..416df1b7 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/MiddlewareResult.md @@ -0,0 +1,25 @@ +# Type Alias: MiddlewareResult + +> **MiddlewareResult** = `object` + +Defined in: [react-client/src/types/public.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L35) + +## Properties + +### onClear()? + +> `optional` **onClear**: () => `void` + +Defined in: [react-client/src/types/public.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L35) + +#### Returns + +`void` + +*** + +### track + +> **track**: `MediaStreamTrack` + +Defined in: [react-client/src/types/public.ts:35](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L35) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/MoqAccess.md b/versioned_docs/version-0.30.0/api/web/type-aliases/MoqAccess.md new file mode 100644 index 00000000..868fe588 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/MoqAccess.md @@ -0,0 +1,21 @@ +# Type Alias: MoqAccess + +> **MoqAccess** = `object` + +Defined in: [react-client/src/hooks/useSandbox.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L18) + +## Properties + +### connectionUrl + +> **connectionUrl**: `string` + +Defined in: [react-client/src/hooks/useSandbox.ts:19](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L19) + +*** + +### token + +> **token**: `string` + +Defined in: [react-client/src/hooks/useSandbox.ts:20](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L20) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/PeerId.md b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerId.md new file mode 100644 index 00000000..53b70bfe --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerId.md @@ -0,0 +1,5 @@ +# Type Alias: PeerId + +> **PeerId** = [`Brand`](Brand.md)\<`string`, `"PeerId"`\> + +Defined in: [react-client/src/types/public.ts:19](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L19) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/PeerStatus.md b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerStatus.md new file mode 100644 index 00000000..8309e94c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerStatus.md @@ -0,0 +1,12 @@ +# Type Alias: PeerStatus + +> **PeerStatus** = `"connecting"` \| `"connected"` \| `"error"` \| `"idle"` + +Defined in: [react-client/src/types/public.ts:56](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L56) + +Represents the possible statuses of a peer connection. + +- `idle` - Peer is not connected, either never connected or successfully disconnected. +- `connecting` - Peer is in the process of connecting. +- `connected` - Peer has successfully connected. +- `error` - There was an error in the connection process. diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/PeerWithTracks.md b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerWithTracks.md new file mode 100644 index 00000000..1b8e131d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/PeerWithTracks.md @@ -0,0 +1,85 @@ +# Type Alias: PeerWithTracks\ + +> **PeerWithTracks**\<`PeerMetadata`, `ServerMetadata`, `T`\> = `object` + +Defined in: [react-client/src/hooks/usePeers.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L22) + +## Type Parameters + +| Type Parameter | Default type | Description | +| ------ | ------ | ------ | +| `PeerMetadata` | - | Type of metadata set by peer while connecting to a room. | +| `ServerMetadata` | - | Type of metadata set by the server while creating a peer. | +| `T` *extends* [`Track`](Track.md) | [`Track`](Track.md) | - | + +## Properties + +### cameraTrack? + +> `optional` **cameraTrack**: `T` + +Defined in: [react-client/src/hooks/usePeers.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L26) + +*** + +### customAudioTracks + +> **customAudioTracks**: `T`[] + +Defined in: [react-client/src/hooks/usePeers.ts:31](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L31) + +*** + +### customVideoTracks + +> **customVideoTracks**: `T`[] + +Defined in: [react-client/src/hooks/usePeers.ts:30](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L30) + +*** + +### id + +> **id**: [`PeerId`](PeerId.md) + +Defined in: [react-client/src/hooks/usePeers.ts:23](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L23) + +*** + +### metadata? + +> `optional` **metadata**: [`Metadata`](Metadata.md)\<`PeerMetadata`, `ServerMetadata`\> + +Defined in: [react-client/src/hooks/usePeers.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L24) + +*** + +### microphoneTrack? + +> `optional` **microphoneTrack**: `T` + +Defined in: [react-client/src/hooks/usePeers.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L27) + +*** + +### screenShareAudioTrack? + +> `optional` **screenShareAudioTrack**: `T` + +Defined in: [react-client/src/hooks/usePeers.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L29) + +*** + +### screenShareVideoTrack? + +> `optional` **screenShareVideoTrack**: `T` + +Defined in: [react-client/src/hooks/usePeers.ts:28](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L28) + +*** + +### tracks + +> **tracks**: `T`[] + +Defined in: [react-client/src/hooks/usePeers.ts:25](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/usePeers.ts#L25) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/PersistLastDeviceHandlers.md b/versioned_docs/version-0.30.0/api/web/type-aliases/PersistLastDeviceHandlers.md new file mode 100644 index 00000000..28520c9b --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/PersistLastDeviceHandlers.md @@ -0,0 +1,42 @@ +# Type Alias: PersistLastDeviceHandlers + +> **PersistLastDeviceHandlers** = `object` + +Defined in: [react-client/src/types/public.ts:60](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L60) + +## Properties + +### getLastDevice() + +> **getLastDevice**: (`deviceType`) => `MediaDeviceInfo` \| `null` + +Defined in: [react-client/src/types/public.ts:61](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L61) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `deviceType` | `"audio"` \| `"video"` | + +#### Returns + +`MediaDeviceInfo` \| `null` + +*** + +### saveLastDevice() + +> **saveLastDevice**: (`info`, `deviceType`) => `void` + +Defined in: [react-client/src/types/public.ts:62](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L62) + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `info` | `MediaDeviceInfo` | +| `deviceType` | `"audio"` \| `"video"` | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectConfig.md b/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectConfig.md new file mode 100644 index 00000000..ef54d500 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectConfig.md @@ -0,0 +1,37 @@ +# Type Alias: ReconnectConfig + +> **ReconnectConfig** = `object` + +Defined in: ts-client/dist/index.d.mts:945 + +## Properties + +### addTracksOnReconnect? + +> `optional` **addTracksOnReconnect**: `boolean` + +Defined in: ts-client/dist/index.d.mts:949 + +*** + +### delay? + +> `optional` **delay**: `number` + +Defined in: ts-client/dist/index.d.mts:948 + +*** + +### initialDelay? + +> `optional` **initialDelay**: `number` + +Defined in: ts-client/dist/index.d.mts:947 + +*** + +### maxAttempts? + +> `optional` **maxAttempts**: `number` + +Defined in: ts-client/dist/index.d.mts:946 diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectionStatus.md b/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectionStatus.md new file mode 100644 index 00000000..344a388a --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/ReconnectionStatus.md @@ -0,0 +1,5 @@ +# Type Alias: ReconnectionStatus + +> **ReconnectionStatus** = `"reconnecting"` \| `"idle"` \| `"error"` + +Defined in: ts-client/dist/index.d.mts:944 diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/RemoteTrack.md b/versioned_docs/version-0.30.0/api/web/type-aliases/RemoteTrack.md new file mode 100644 index 00000000..ab8d6a43 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/RemoteTrack.md @@ -0,0 +1,29 @@ +# Type Alias: RemoteTrack + +> **RemoteTrack** = [`Track`](Track.md) & `object` + +Defined in: [react-client/src/types/public.ts:29](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L29) + +## Type declaration + +### encoding? + +> `optional` **encoding**: [`Variant`](../enumerations/Variant.md) + +### encodingReason? + +> `optional` **encodingReason**: `EncodingReason` + +### setReceivedQuality() + +> **setReceivedQuality**: (`quality`) => `void` + +#### Parameters + +| Parameter | Type | +| ------ | ------ | +| `quality` | [`Variant`](../enumerations/Variant.md) | + +#### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/RoomType.md b/versioned_docs/version-0.30.0/api/web/type-aliases/RoomType.md new file mode 100644 index 00000000..0576d4f5 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/RoomType.md @@ -0,0 +1,5 @@ +# Type Alias: RoomType + +> **RoomType** = `"conference"` \| `"livestream"` \| `"audio_only"` + +Defined in: [react-client/src/hooks/useSandbox.ts:27](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L27) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimit.md b/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimit.md new file mode 100644 index 00000000..91b20381 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimit.md @@ -0,0 +1,9 @@ +# Type Alias: SimulcastBandwidthLimit + +> **SimulcastBandwidthLimit** = `Map`\<[`Variant`](../enumerations/Variant.md), `BandwidthLimit`\> + +Defined in: ts-client/dist/index.d.mts:252 + +Type describing bandwidth limit for simulcast track. +It is a mapping (encoding => BandwidthLimit). +If encoding isn't present in this mapping, it will be assumed that this particular encoding shouldn't have any bandwidth limit diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimits.md b/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimits.md new file mode 100644 index 00000000..6b448215 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/SimulcastBandwidthLimits.md @@ -0,0 +1,29 @@ +# Type Alias: SimulcastBandwidthLimits + +> **SimulcastBandwidthLimits** = `object` + +Defined in: [react-client/src/types/public.ts:65](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L65) + +## Properties + +### 1 + +> **1**: `number` + +Defined in: [react-client/src/types/public.ts:66](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L66) + +*** + +### 2 + +> **2**: `number` + +Defined in: [react-client/src/types/public.ts:67](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L67) + +*** + +### 3 + +> **3**: `number` + +Defined in: [react-client/src/types/public.ts:68](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L68) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/StreamConfig.md b/versioned_docs/version-0.30.0/api/web/type-aliases/StreamConfig.md new file mode 100644 index 00000000..5a029a00 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/StreamConfig.md @@ -0,0 +1,13 @@ +# Type Alias: StreamConfig + +> **StreamConfig** = `object` + +Defined in: [react-client/src/types/public.ts:71](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L71) + +## Properties + +### sentQualities? + +> `optional` **sentQualities**: [`Variant`](../enumerations/Variant.md)[] \| `false` + +Defined in: [react-client/src/types/public.ts:71](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L71) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/StreamerInputs.md b/versioned_docs/version-0.30.0/api/web/type-aliases/StreamerInputs.md new file mode 100644 index 00000000..6fbb2934 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/StreamerInputs.md @@ -0,0 +1,31 @@ +# Type Alias: StreamerInputs + +> **StreamerInputs** = \{ `audio?`: `MediaStream` \| `null`; `video`: `MediaStream`; \} \| \{ `audio`: `MediaStream`; `video?`: `null`; \} + +Defined in: [react-client/src/hooks/useLivestreamStreamer.ts:8](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useLivestreamStreamer.ts#L8) + +## Type declaration + +\{ `audio?`: `MediaStream` \| `null`; `video`: `MediaStream`; \} + +### audio? + +> `optional` **audio**: `MediaStream` \| `null` + +The audio source to publish. e.g. `microphoneStream` from [useMicrophone](../functions/useMicrophone.md) or `stream` from [useScreenShare](../functions/useScreenShare.md) + +### video + +> **video**: `MediaStream` + +The video source to publish. e.g. `cameraStream` from [useCamera](../functions/useCamera.md) or `stream` from [useScreenShare](../functions/useScreenShare.md) + +\{ `audio`: `MediaStream`; `video?`: `null`; \} + +### audio + +> **audio**: `MediaStream` + +### video? + +> `optional` **video**: `null` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/Track.md b/versioned_docs/version-0.30.0/api/web/type-aliases/Track.md new file mode 100644 index 00000000..1bf78496 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/Track.md @@ -0,0 +1,45 @@ +# Type Alias: Track + +> **Track** = `object` + +Defined in: [react-client/src/types/public.ts:21](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L21) + +## Properties + +### metadata? + +> `optional` **metadata**: `TrackMetadata` + +Defined in: [react-client/src/types/public.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L24) + +*** + +### simulcastConfig + +> **simulcastConfig**: [`SimulcastConfig`](../interfaces/SimulcastConfig.md) \| `null` + +Defined in: [react-client/src/types/public.ts:25](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L25) + +*** + +### stream + +> **stream**: `MediaStream` \| `null` + +Defined in: [react-client/src/types/public.ts:22](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L22) + +*** + +### track + +> **track**: `MediaStreamTrack` \| `null` + +Defined in: [react-client/src/types/public.ts:26](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L26) + +*** + +### trackId + +> **trackId**: [`TrackId`](TrackId.md) + +Defined in: [react-client/src/types/public.ts:23](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L23) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/TrackBandwidthLimit.md b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackBandwidthLimit.md new file mode 100644 index 00000000..8ae1c104 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackBandwidthLimit.md @@ -0,0 +1,8 @@ +# Type Alias: TrackBandwidthLimit + +> **TrackBandwidthLimit** = `BandwidthLimit` \| [`SimulcastBandwidthLimit`](SimulcastBandwidthLimit.md) + +Defined in: ts-client/dist/index.d.mts:257 + +Type describing bandwidth limitation of a Track, including simulcast and non-simulcast tracks. +A sum type of `BandwidthLimit` and `SimulcastBandwidthLimit` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/TrackId.md b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackId.md new file mode 100644 index 00000000..c8931c28 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackId.md @@ -0,0 +1,5 @@ +# Type Alias: TrackId + +> **TrackId** = [`Brand`](Brand.md)\<`string`, `"TrackId"`\> + +Defined in: [react-client/src/types/public.ts:18](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L18) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/TrackMiddleware.md b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackMiddleware.md new file mode 100644 index 00000000..e1b84546 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/TrackMiddleware.md @@ -0,0 +1,5 @@ +# Type Alias: TrackMiddleware + +> **TrackMiddleware** = (`track`) => [`MiddlewareResult`](MiddlewareResult.md) \| `Promise`\<[`MiddlewareResult`](MiddlewareResult.md)\> \| `null` + +Defined in: [react-client/src/types/public.ts:36](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L36) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddleware.md b/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddleware.md new file mode 100644 index 00000000..0c4dd143 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddleware.md @@ -0,0 +1,16 @@ +# Type Alias: TracksMiddleware() + +> **TracksMiddleware** = (`videoTrack`, `audioTrack`) => [`TracksMiddlewareResult`](TracksMiddlewareResult.md) \| `Promise`\<[`TracksMiddlewareResult`](TracksMiddlewareResult.md)\> + +Defined in: [react-client/src/types/public.ts:43](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L43) + +## Parameters + +| Parameter | Type | +| ------ | ------ | +| `videoTrack` | `MediaStreamTrack` | +| `audioTrack` | `MediaStreamTrack` \| `null` | + +## Returns + +[`TracksMiddlewareResult`](TracksMiddlewareResult.md) \| `Promise`\<[`TracksMiddlewareResult`](TracksMiddlewareResult.md)\> diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddlewareResult.md b/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddlewareResult.md new file mode 100644 index 00000000..e544a6a6 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/TracksMiddlewareResult.md @@ -0,0 +1,33 @@ +# Type Alias: TracksMiddlewareResult + +> **TracksMiddlewareResult** = `object` + +Defined in: [react-client/src/types/public.ts:38](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L38) + +## Properties + +### audioTrack + +> **audioTrack**: `MediaStreamTrack` \| `null` + +Defined in: [react-client/src/types/public.ts:40](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L40) + +*** + +### onClear() + +> **onClear**: () => `void` + +Defined in: [react-client/src/types/public.ts:41](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L41) + +#### Returns + +`void` + +*** + +### videoTrack + +> **videoTrack**: `MediaStreamTrack` + +Defined in: [react-client/src/types/public.ts:39](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L39) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/UseDataChannelResult.md b/versioned_docs/version-0.30.0/api/web/type-aliases/UseDataChannelResult.md new file mode 100644 index 00000000..7659a86f --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/UseDataChannelResult.md @@ -0,0 +1,101 @@ +# Type Alias: UseDataChannelResult + +> **UseDataChannelResult** = `object` + +Defined in: [react-client/src/types/public.ts:92](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L92) + +## Properties + +### dataChannelError + +> **dataChannelError**: `Error` \| `null` + +Defined in: [react-client/src/types/public.ts:125](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L125) + +Error that occurred during data publisher operations, or null if no error. + +*** + +### dataChannelLoading + +> **dataChannelLoading**: `boolean` + +Defined in: [react-client/src/types/public.ts:121](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L121) + +Whether data channels are being initialized. + +*** + +### dataChannelReady + +> **dataChannelReady**: `boolean` + +Defined in: [react-client/src/types/public.ts:117](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L117) + +Whether data channels are connected and ready to send data. +Resets to false on disconnect. + +*** + +### initializeDataChannel() + +> **initializeDataChannel**: () => `void` + +Defined in: [react-client/src/types/public.ts:98](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L98) + +Initializes the data channel. + +Requires that the fishjam client is already connected. + +#### Returns + +`void` + +*** + +### publishData() + +> **publishData**: (`payload`, `options`) => `void` + +Defined in: [react-client/src/types/public.ts:104](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L104) + +Sends binary data through a data channel. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `payload` | `Uint8Array` | The Uint8Array payload to send (first positional argument) | +| `options` | [`DataChannelOptions`](../interfaces/DataChannelOptions.md) | Data channel options; specify `reliable: true` for guaranteed delivery or `reliable: false` for low latency | + +#### Returns + +`void` + +*** + +### subscribeData() + +> **subscribeData**: (`callback`, `options`) => () => `void` + +Defined in: [react-client/src/types/public.ts:112](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/types/public.ts#L112) + +Subscribe to incoming data on a data channel. +Can be called before or after channel creation. + +#### Parameters + +| Parameter | Type | Description | +| ------ | ------ | ------ | +| `callback` | [`DataCallback`](DataCallback.md) | Function called when data is received | +| `options` | [`DataChannelOptions`](../interfaces/DataChannelOptions.md) | Specify `reliable: true` or `reliable: false` to choose channel | + +#### Returns + +Unsubscribe function - call to cancel the subscription + +> (): `void` + +##### Returns + +`void` diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/UseInitializeDevicesParams.md b/versioned_docs/version-0.30.0/api/web/type-aliases/UseInitializeDevicesParams.md new file mode 100644 index 00000000..c710e013 --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/UseInitializeDevicesParams.md @@ -0,0 +1,21 @@ +# Type Alias: UseInitializeDevicesParams + +> **UseInitializeDevicesParams** = `object` + +Defined in: [react-client/src/hooks/devices/useInitializeDevices.ts:5](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useInitializeDevices.ts#L5) + +## Properties + +### enableAudio? + +> `optional` **enableAudio**: `boolean` + +Defined in: [react-client/src/hooks/devices/useInitializeDevices.ts:7](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useInitializeDevices.ts#L7) + +*** + +### enableVideo? + +> `optional` **enableVideo**: `boolean` + +Defined in: [react-client/src/hooks/devices/useInitializeDevices.ts:6](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/devices/useInitializeDevices.ts#L6) diff --git a/versioned_docs/version-0.30.0/api/web/type-aliases/UseSandboxProps.md b/versioned_docs/version-0.30.0/api/web/type-aliases/UseSandboxProps.md new file mode 100644 index 00000000..162b035c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/type-aliases/UseSandboxProps.md @@ -0,0 +1,13 @@ +# Type Alias: UseSandboxProps + +> **UseSandboxProps** = `object` + +Defined in: [react-client/src/hooks/useSandbox.ts:23](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L23) + +## Properties + +### sandboxApiUrl + +> **sandboxApiUrl**: `string` + +Defined in: [react-client/src/hooks/useSandbox.ts:24](https://github.com/fishjam-cloud/web-client-sdk/blob/be6bc1b673827e28bf8df7bed88de7c874f96db7/packages/react-client/src/hooks/useSandbox.ts#L24) diff --git a/versioned_docs/version-0.30.0/api/web/typedoc-sidebar.cjs b/versioned_docs/version-0.30.0/api/web/typedoc-sidebar.cjs new file mode 100644 index 00000000..196f2f8c --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import("@docusaurus/plugin-content-docs").SidebarsConfig} */ +const typedocSidebar = {items:[{type:"category",label:"Connection",items:[{type:"doc",id:"api/web/functions/useConnection",label:"useConnection"},{type:"doc",id:"api/web/functions/useDataChannel",label:"useDataChannel"},{type:"doc",id:"api/web/functions/usePeers",label:"usePeers"},{type:"doc",id:"api/web/functions/useUpdatePeerMetadata",label:"useUpdatePeerMetadata"},{type:"doc",id:"api/web/functions/useVAD",label:"useVAD"},{type:"doc",id:"api/web/type-aliases/Metadata",label:"Metadata"}]},{type:"category",label:"Devices",items:[{type:"doc",id:"api/web/functions/useCamera",label:"useCamera"},{type:"doc",id:"api/web/functions/useInitializeDevices",label:"useInitializeDevices"},{type:"doc",id:"api/web/functions/useMicrophone",label:"useMicrophone"},{type:"doc",id:"api/web/functions/useScreenShare",label:"useScreenShare"}]},{type:"category",label:"Components",items:[{type:"doc",id:"api/web/functions/FishjamProvider",label:"FishjamProvider"},{type:"doc",id:"api/web/interfaces/FishjamProviderProps",label:"FishjamProviderProps"}]},{type:"category",label:"Livestream",items:[{type:"doc",id:"api/web/functions/useLivestreamStreamer",label:"useLivestreamStreamer"},{type:"doc",id:"api/web/functions/useLivestreamViewer",label:"useLivestreamViewer"},{type:"doc",id:"api/web/interfaces/UseLivestreamStreamerResult",label:"UseLivestreamStreamerResult"},{type:"doc",id:"api/web/interfaces/UseLivestreamViewerResult",label:"UseLivestreamViewerResult"},{type:"doc",id:"api/web/type-aliases/ConnectStreamerConfig",label:"ConnectStreamerConfig"},{type:"doc",id:"api/web/type-aliases/StreamerInputs",label:"StreamerInputs"}]},{type:"category",label:"Other",items:[{type:"doc",id:"api/web/functions/useCustomSource",label:"useCustomSource"},{type:"doc",id:"api/web/functions/useSandbox",label:"useSandbox"},{type:"doc",id:"api/web/enumerations/Variant",label:"Variant"},{type:"doc",id:"api/web/interfaces/DataChannelOptions",label:"DataChannelOptions"},{type:"doc",id:"api/web/interfaces/JoinRoomConfig",label:"JoinRoomConfig"},{type:"doc",id:"api/web/interfaces/SimulcastConfig",label:"SimulcastConfig"},{type:"doc",id:"api/web/type-aliases/AuthErrorReason",label:"AuthErrorReason"},{type:"doc",id:"api/web/type-aliases/BandwidthLimits",label:"BandwidthLimits"},{type:"doc",id:"api/web/type-aliases/Brand",label:"Brand"},{type:"doc",id:"api/web/type-aliases/ConnectViewerConfig",label:"ConnectViewerConfig"},{type:"doc",id:"api/web/type-aliases/CustomSource",label:"CustomSource"},{type:"doc",id:"api/web/type-aliases/DataCallback",label:"DataCallback"},{type:"doc",id:"api/web/type-aliases/DeviceError",label:"DeviceError"},{type:"doc",id:"api/web/type-aliases/DeviceItem",label:"DeviceItem"},{type:"doc",id:"api/web/type-aliases/InitializeDevicesResult",label:"InitializeDevicesResult"},{type:"doc",id:"api/web/type-aliases/InitializeDevicesSettings",label:"InitializeDevicesSettings"},{type:"doc",id:"api/web/type-aliases/InitializeDevicesStatus",label:"InitializeDevicesStatus"},{type:"doc",id:"api/web/type-aliases/JoinErrorReason",label:"JoinErrorReason"},{type:"doc",id:"api/web/type-aliases/MiddlewareResult",label:"MiddlewareResult"},{type:"doc",id:"api/web/type-aliases/MoqAccess",label:"MoqAccess"},{type:"doc",id:"api/web/type-aliases/PeerId",label:"PeerId"},{type:"doc",id:"api/web/type-aliases/PeerStatus",label:"PeerStatus"},{type:"doc",id:"api/web/type-aliases/PeerWithTracks",label:"PeerWithTracks"},{type:"doc",id:"api/web/type-aliases/PersistLastDeviceHandlers",label:"PersistLastDeviceHandlers"},{type:"doc",id:"api/web/type-aliases/ReconnectConfig",label:"ReconnectConfig"},{type:"doc",id:"api/web/type-aliases/ReconnectionStatus",label:"ReconnectionStatus"},{type:"doc",id:"api/web/type-aliases/RemoteTrack",label:"RemoteTrack"},{type:"doc",id:"api/web/type-aliases/RoomType",label:"RoomType"},{type:"doc",id:"api/web/type-aliases/SimulcastBandwidthLimit",label:"SimulcastBandwidthLimit"},{type:"doc",id:"api/web/type-aliases/SimulcastBandwidthLimits",label:"SimulcastBandwidthLimits"},{type:"doc",id:"api/web/type-aliases/StreamConfig",label:"StreamConfig"},{type:"doc",id:"api/web/type-aliases/Track",label:"Track"},{type:"doc",id:"api/web/type-aliases/TrackBandwidthLimit",label:"TrackBandwidthLimit"},{type:"doc",id:"api/web/type-aliases/TrackId",label:"TrackId"},{type:"doc",id:"api/web/type-aliases/TrackMiddleware",label:"TrackMiddleware"},{type:"doc",id:"api/web/type-aliases/TracksMiddleware",label:"TracksMiddleware"},{type:"doc",id:"api/web/type-aliases/TracksMiddlewareResult",label:"TracksMiddlewareResult"},{type:"doc",id:"api/web/type-aliases/UseDataChannelResult",label:"UseDataChannelResult"},{type:"doc",id:"api/web/type-aliases/UseInitializeDevicesParams",label:"UseInitializeDevicesParams"},{type:"doc",id:"api/web/type-aliases/UseSandboxProps",label:"UseSandboxProps"},{type:"doc",id:"api/web/variables/SimulcastConfig",label:"SimulcastConfig"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/versioned_docs/version-0.30.0/api/web/variables/SimulcastConfig.md b/versioned_docs/version-0.30.0/api/web/variables/SimulcastConfig.md new file mode 100644 index 00000000..e8dbd27d --- /dev/null +++ b/versioned_docs/version-0.30.0/api/web/variables/SimulcastConfig.md @@ -0,0 +1,5 @@ +# Variable: SimulcastConfig + +> **SimulcastConfig**: `MessageFns`\<[`SimulcastConfig`](../interfaces/SimulcastConfig.md)\> + +Defined in: ts-client/dist/index.d.mts:197 diff --git a/versioned_docs/version-0.30.0/examples/_category_.json b/versioned_docs/version-0.30.0/examples/_category_.json new file mode 100644 index 00000000..085a6d37 --- /dev/null +++ b/versioned_docs/version-0.30.0/examples/_category_.json @@ -0,0 +1,10 @@ +{ + "label": "Examples", + "position": 6, + "link": { + "type": "generated-index", + "title": "Examples", + "description": "Real-world code examples and use cases.", + "slug": "/examples" + } +} diff --git a/versioned_docs/version-0.30.0/examples/react-native.mdx b/versioned_docs/version-0.30.0/examples/react-native.mdx new file mode 100644 index 00000000..762dc616 --- /dev/null +++ b/versioned_docs/version-0.30.0/examples/react-native.mdx @@ -0,0 +1,181 @@ +--- +type: explanation +sidebar_position: 0 +--- + +# React Native Examples + +_Runnable reference apps demonstrating common Fishjam use cases in React Native_ + +Each example is a standalone Expo application you can run locally and use as a starting point for your own project. +All examples use `@fishjam-cloud/react-native-client`. You need a Fishjam ID to connect to the media server, and a Sandbox API URL to create rooms and get peer tokens. Get your Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app), and your Sandbox API URL from the [Sandbox tab](https://fishjam.io/app/sandbox). See [What is the Sandbox API?](../explanation/sandbox-api-concept) for an in-depth explanation. + +| Example | What it demonstrates | +| ----------------------------------------- | --------------------------------------------------------------------- | +| [Minimal Video Room](#minimal-video-room) | Simplest possible video call — the baseline for all other examples | +| [Fishjam Chat](#fishjam-chat) | Full-featured video conferencing and livestreaming app with simulcast | +| [Background Blur](#background-blur) | Applying real-time video effects via camera track middleware | +| [Text Chat](#text-chat) | Peer-to-peer text messaging with WebRTC data channels | +| [Video Player](#video-player) | Livestream broadcaster and viewer with separate UI modes | + +--- + +## Minimal Video Room + +The simplest way to get video calling working — joining a room, displaying your own camera feed, and showing remote participants. Start here if you're new to Fishjam. + +**Demonstrates:** + +- Wrapping your app in `FishjamProvider` +- Connecting to a room with `useConnection` +- Accessing local and remote peers with `usePeers` +- Rendering video streams with `RTCView` + +### Running the example + +```bash +cd minimal-react-native +yarn install +npx expo prebuild +npx expo run:android # or run:ios +``` + +:::important +This won't work on the iOS Simulator — the Simulator can't access the camera. Test on a real device. +::: + +The room screen uses `usePeers` to retrieve all participants and renders their camera streams in a two-column grid with `RTCView`. + +Browse the full source: [minimal-react-native on GitHub](https://github.com/fishjam-cloud/examples/tree/main/mobile-react-native/minimal-react-native) + +--- + +## Fishjam Chat + +A full-featured application covering two distinct room types: a video conferencing room (conference call with multiple participants) and a livestream room (one broadcaster, many viewers). It is the most complete example and the best reference for production-like architecture. + +**Demonstrates:** + +- Tab-based navigation between VideoRoom and Livestream features +- Pre-call room preview before joining +- Environment switching between staging and production +- Screen sharing from a livestream broadcaster +- Permission handling with a reusable `useMediaPermissions` hook +- Selecting received video quality with simulcast (`setReceivedQuality`) + +### Running the example + +```bash +cd fishjam-chat +yarn install +npx expo prebuild +npx expo run:android # or run:ios +``` + +:::important +Before prebuilding, replace the bundle identifier `io.fishjam.example.fishjamchat` with your own in `app.json` (both the Android package name and iOS bundle identifier fields). +::: + +The app uses Expo Router with a bottom tab navigator. Each tab handles its own connection flow independently using `useConnection`. + +Browse the full source: [fishjam-chat on GitHub](https://github.com/fishjam-cloud/examples/tree/main/mobile-react-native/fishjam-chat) + +--- + +## Background Blur + +Demonstrates how to apply real-time background blur to a local camera feed using camera track middleware. Blur can be toggled on and off during an active call without reconnecting. + +**Demonstrates:** + +- Installing and using `@fishjam-cloud/react-native-webrtc-background-blur` +- Applying a video effect with `setCameraTrackMiddleware` +- Removing an effect by passing `null` to `setCameraTrackMiddleware` + +### Running the example + +Install the additional blur package first: + +```bash npm2yarn +npm install @fishjam-cloud/react-native-webrtc-background-blur +``` + +```bash +cd blur-example +yarn install +npx expo prebuild +npx expo run:android # or run:ios +``` + +:::info +Blur applies only to the local camera feed sent to other participants. Remote participants' video is unaffected. +::: + +The blur hook from `useBackgroundBlur` provides a `middleware` function that is passed directly to `setCameraTrackMiddleware`. Passing `null` disables the effect. + +Browse the full source: [blur-example on GitHub](https://github.com/fishjam-cloud/examples/tree/main/mobile-react-native/blur-example) + +--- + +## Text Chat + +Demonstrates peer-to-peer text messaging over WebRTC data channels — no separate messaging server required. Messages are sent directly between peers inside the Fishjam room. + +**Demonstrates:** + +- Initializing a data channel with `useDataChannel` +- Publishing messages with `publishData` +- Receiving incoming messages via the `onDataReceived` callback +- Encoding and decoding message payloads with JSON + +### Running the example + +```bash +cd text-chat +yarn install +npx expo prebuild +npx expo run:android # or run:ios +``` + +:::info +Data channels use `reliable` mode by default, which guarantees message delivery and ordering — similar to TCP. +::: + +Messages are `Uint8Array` payloads encoded and decoded with JSON and `TextEncoder`/`TextDecoder`. The `useDataChannel` hook wires together `publishData` for sending and `onDataReceived` for receiving. + +Browse the full source: [text-chat on GitHub](https://github.com/fishjam-cloud/examples/tree/main/mobile-react-native/text-chat) + +--- + +## Video Player + +A focused livestreaming example with two separate modes: a streamer who broadcasts video and audio, and a viewer who watches the stream. Unlike Fishjam Chat, this example uses a single `App.tsx` entry point with a simple role selector screen. + +**Demonstrates:** + +- Broadcasting with `useLivestreamStreamer` +- Watching a stream with `useLivestreamViewer` +- Initializing camera and microphone with `useInitializeDevices` +- Toggling camera and microphone tracks during an active stream + +### Running the example + +```bash +cd video-player +yarn install +npx expo prebuild +npx expo run:android # or run:ios +``` + +The streamer side uses `useLivestreamStreamer` and `useInitializeDevices` to start broadcasting, while the viewer side uses `useLivestreamViewer` to connect and render the incoming stream with `RTCView`. + +Browse the full source: [video-player on GitHub](https://github.com/fishjam-cloud/examples/tree/main/mobile-react-native/video-player) + +--- + +## Next steps + +- Follow the [React Native Quick Start](../tutorials/react-native-quick-start) if you haven't set up a project yet +- Learn how to [handle screen sharing](../how-to/client/screensharing) +- Learn how to [implement background streaming](../how-to/client/background-streaming) +- Learn how to [work with data channels](../how-to/client/text-chat) diff --git a/versioned_docs/version-0.30.0/examples/react.mdx b/versioned_docs/version-0.30.0/examples/react.mdx new file mode 100644 index 00000000..1666097a --- /dev/null +++ b/versioned_docs/version-0.30.0/examples/react.mdx @@ -0,0 +1,193 @@ +--- +type: explanation +sidebar_position: 1 +--- + +# React Examples + +_Runnable reference apps demonstrating common Fishjam use cases in React_ + +Each example is a standalone React application you can run locally and use as a starting point for your own project. +All examples use `@fishjam-cloud/react-client`. You need a Fishjam ID to connect to the media server, and a Sandbox API URL to create rooms and get peer tokens. Get your Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app), and your Sandbox API URL from the [Sandbox tab](https://fishjam.io/app/sandbox). See [What is the Sandbox API?](../explanation/sandbox-api-concept) for an in-depth explanation. + +| Example | What it demonstrates | +| ----------------------------------- | ----------------------------------------------------------------------- | +| [Minimal React](#minimal-react) | Simplest video call — join a room, camera, mic, screen share, simulcast | +| [Audio Only](#audio-only) | Voice chat with no video and microphone device selection | +| [Text Chat](#text-chat) | Peer-to-peer messaging over WebRTC data channels | +| [Livestreaming](#livestreaming) | One broadcaster, many viewers with separate streamer/viewer UIs | +| [Minimal Smelter](#minimal-smelter) | Custom video overlays using the Smelter rendering engine | +| [Fishjam Chat](#fishjam-chat) | Full-featured conferencing app with background blur and screen sharing | + +--- + +## Minimal React + +The simplest way to get a video call working in the browser — joining a room, displaying your own camera feed, and showing remote participants. Start here if you're new to Fishjam on the web. + +**Demonstrates:** + +- Wrapping your app in `FishjamProvider` +- Connecting to a room with `useConnection` +- Accessing local and remote peers with `usePeers` +- Enabling camera and microphone with `useCamera` and `useMicrophone` +- Starting screen sharing with `useScreenShare` +- Rendering streams with `VideoPlayer` and `AudioPlayer` components +- Selecting received video quality with simulcast (`setReceivedQuality`) + +### Running the example + +```bash +cd minimal-react +yarn install +yarn dev +``` + +The room component uses `usePeers` to retrieve all participants and renders their video streams using `VideoPlayer` and audio with `AudioPlayer`. + +:::note +This example requires a **peer token** to connect. You need to obtain one yourself — either via the [Sandbox API](../how-to/backend/sandbox-api-testing#step-2-create-a-room-and-get-peer-tokens) for quick testing, or by setting up your own backend with the [Fishjam Server SDK](../tutorials/backend-quick-start). +::: + +Browse the full source: [minimal-react on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/minimal-react) + +--- + +## Audio Only + +A voice-only room with no video — demonstrates how to initialize Fishjam with audio exclusively and let users pick their microphone device before joining. + +**Demonstrates:** + +- Audio-only initialization with `useInitializeDevices` (`enableVideo: false`) +- Microphone device selection from available inputs +- Rendering a peer list with audio playback via `AudioPlayer` + +### Running the example + +```bash +cd audio-only +yarn install +yarn dev +``` + +Setting `enableVideo: false` in `useInitializeDevices` skips camera initialization entirely, keeping the session lightweight for voice-only use cases. + +Browse the full source: [audio-only on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/audio-only) + +--- + +## Text Chat + +Demonstrates peer-to-peer text messaging over WebRTC data channels — no separate messaging server required. Messages are sent directly between peers inside the Fishjam room. + +**Demonstrates:** + +- Initializing a data channel with `useDataChannel` +- Publishing messages with `publishData` +- Receiving incoming messages with `subscribeData` +- Encoding and decoding message payloads with `TextEncoder` and `TextDecoder` + +### Running the example + +```bash +cd text-chat +yarn install +yarn dev +``` + +Messages are `Uint8Array` payloads encoded and decoded with JSON and `TextEncoder`/`TextDecoder`. The `useDataChannel` hook wires together `publishData` for sending and `subscribeData` for receiving. + +Browse the full source: [text-chat on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/text-chat) + +--- + +## Livestreaming + +A focused livestreaming example with two separate modes: a streamer who broadcasts video and audio, and a viewer who watches the stream. Token management is handled via the `useSandbox` hook. + +**Demonstrates:** + +- Broadcasting with `useLivestreamStreamer` +- Watching a stream with `useLivestreamViewer` +- Separate broadcaster and viewer UIs within one application +- Obtaining peer tokens with `useSandbox` + +### Running the example + +```bash +cd livestreaming +yarn install +yarn dev +``` + +The streamer side uses `useLivestreamStreamer` to publish camera and audio tracks, while the viewer side uses `useLivestreamViewer` to connect and render the incoming stream. + +Browse the full source: [livestreaming on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/livestreaming) + +--- + +## Minimal Smelter + +Shows how to apply custom video overlays to a camera feed using the Smelter rendering engine — a text label composited directly onto the outgoing video stream. + +**Demonstrates:** + +- Creating a custom video source with `useCustomSource` +- Initializing the Smelter engine with `useSmelter` +- Registering inputs and outputs with `registerInput`/`registerOutput` +- Compositing a text overlay on top of a live camera feed + +### Running the example + +```bash +cd minimal-smelter +yarn install +yarn dev +``` + +:::important +Smelter requires WebAssembly support — use a modern browser. +::: + +The `useSmelter` hook manages the Smelter engine lifecycle. `registerInput` connects the local camera feed and `registerOutput` routes the composited result back into Fishjam as a custom track. + +:::note +This example requires a **peer token** to connect. You need to obtain one yourself — either via the [Sandbox API](../how-to/backend/sandbox-api-testing#step-2-create-a-room-and-get-peer-tokens) for quick testing, or by setting up your own backend with the [Fishjam Server SDK](../tutorials/backend-quick-start). +::: + +Browse the full source: [minimal-smelter on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/minimal-smelter) + +--- + +## Fishjam Chat + +A full-featured conferencing application covering camera, microphone, screen sharing, background blur via a camera track middleware, and a settings panel for device selection. + +**Demonstrates:** + +- Connecting to a room with `useConnection` +- Managing camera and microphone with `useCamera` and `useMicrophone` +- Screen sharing with `useScreenShare` +- Applying real-time background blur using a MediaPipe camera track middleware +- Device selection in a settings panel + +### Running the example + +```bash +cd fishjam-chat +yarn install +yarn dev +``` + +Background blur is applied as a camera track middleware that processes each video frame with MediaPipe before the track is sent to other participants. Removing the middleware disables the effect without reconnecting. + +Browse the full source: [fishjam-chat on GitHub](https://github.com/fishjam-cloud/examples/tree/main/web-react/fishjam-chat) + +--- + +## Next steps + +- Follow the [React Quick Start](../tutorials/react-quick-start) if you haven't set up a project yet +- Learn how to [work with data channels](../how-to/client/text-chat) +- Learn how to [implement screen sharing](../how-to/client/screensharing) diff --git a/versioned_docs/version-0.30.0/explanation/_category_.json b/versioned_docs/version-0.30.0/explanation/_category_.json new file mode 100644 index 00000000..bf1eb1f9 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "Concepts", + "position": 5, + "link": { + "type": "generated-index", + "title": "Concepts", + "description": "Big-picture explanations of higher-level Fishjam concepts. Most useful for building understanding of a particular topic.", + "slug": "/explanation" + }, + "collapsible": false +} diff --git a/versioned_docs/version-0.30.0/explanation/agent-internals.mdx b/versioned_docs/version-0.30.0/explanation/agent-internals.mdx new file mode 100644 index 00000000..9f2e49a0 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/agent-internals.mdx @@ -0,0 +1,107 @@ +--- +type: explanation +title: Agent Internals +sidebar_position: 6 +description: Deep dive into Fishjam agent architecture, lifecycle, and how to integrate without using a server SDK. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import AgentDefinition from "../_common/agents/definition.mdx"; +import RememberToDisconnect from "../_common/agents/remember-to-disconnect.mdx"; +import Subscriptions from "../_common/agents/subscriptions.mdx"; + +# Agent Internals + +:::info +This explanation focuses on the inner workings of Fishjam Agents. +If you are looking for a tutorial that shows how to implement an agent, then you may find the [Agent Introduction](../tutorials/agents) more useful. +::: + + + +## Agent lifecycle + +There are four steps to the lifecycle of a Fishjam Agent: + +1. The agent is created in the room `roomId`. + Fishjam generates a token that the agent will use to connect to the room. +2. The agent connects to the room `roomId` via a WebSocket connection. +3. The agent receives audio from **subscribed** peers in the room `roomId`. + Subscriptions are explained in the [Peer subscriptions](#peer-subscriptions) section. +4. The agent disconnects from the room `roomId` by closing the WebSocket connection. + +We describe the steps of an agent's lifecycle in detail below. + +:::tip +The Fishjam [server SDKs](../tutorials/agents#writing-an-agent) provide a simple way to integrate with the APIs described below. +::: + +### Step 1. Creating an Agent in Fishjam + +Agents are created via the `/room/{roomId}/peer` [REST API](../api/reference#rest-api) endpoint, by setting the `type` option to `"agent"`. +An example request with [cURL](https://curl.se/) would look like: + +```bash +# [!code word:{"type"\: "agent"}] +curl -XPOST -H "Authorization: Bearer $FISHJAM_MANAGEMENT_TOKEN" \ +"https://fishjam.io/api/v1/room/$ROOM_ID/peer" \ +--json '{"type": "agent"}' +``` + +### Step 2. Connecting to the Room + +Agents connect to Fishjam by initiating a WebSocket connection on the `/socket/agent/websocket` REST API endpoint. +All communication over the WebSocket between Agent the Fishjam is done using [Protobuf messages](https://protobuf.dev/). +Check [Fishjam Protobuf reference](../api/reference#protobufs) for more info. +Once connected, the agent must authenticate with Fishjam by sending an [`AgentRequest.AuthRequest` protobuf message](../api/reference#protobufs). +An example of initiating a connection using [websocat](https://github.com/vi/websocat) and [Buf CLI](https://buf.build/docs/cli/) would look like: + +```bash +# Get the Fishjam protobuf definitions +git clone https://github.com/fishjam-cloud/protos.git + +echo "{\"authRequest\": {\"token\": \"$AGENT_TOKEN\"}}" \ +| buf convert protos/fishjam/agent_notifications.proto \ + --type="fishjam.AgentRequest" --from="-#format=json" \ +| websocat -vbn wss://fishjam.io/api/v1/connect/$FISHJAM_ID/socket/agent/websocket +``` + +In a backend application, we suggest using the [Protobuf compiler](https://protobuf.dev/installation/) to generate utilities for creating protobuf message from code. + +### Step 3. Receiving Audio + +Once connected, an agent will receive chunks of audio as [`AgentRequest.TrackData` protobuf message](../api/reference#protobufs). + +### Step 4. Sending Audio + +All further steps are done via the WebSocket connection created in [Step 2](#step-2-connecting-to-the-room). + +To send audio to an agent, you need to create an audio track first. +This is done by sending an [`AgentRequest.CreateTrack` protobuf message](../api/reference#protobufs). +Once the track is created, you can send audio to it using [`AgentRequest.TrackData` protobuf message](../api/reference#protobufs). + +### Step 5. Disconnecting from the Room + +An agent disconnects from the room by closing the WebSocket connection created in [Step 2](#step-2-connecting-to-the-room). +It may reconnect using the same token it provided in [Step 2](#step-2-connecting-to-the-room). + + + +## Peer subscriptions + + + +The subscribe option contains parameters describing the desired output format of the peer's audio stream. +This output format will be sent to connected agents. + +### Output format + +Currently, only **16-bit PCM** (raw) audio output is supported. + +### Output sample rate + +The output can have either a sample rate of **16kHz** or **24kHz**. + +The above values aim to be compatible with popular real-time AI audio APIs. +If you require a different output format, then make sure to contact us at `contact@fishjam.io`. diff --git a/versioned_docs/version-0.30.0/explanation/architecture.mdx b/versioned_docs/version-0.30.0/explanation/architecture.mdx new file mode 100644 index 00000000..911ea297 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/architecture.mdx @@ -0,0 +1,91 @@ +--- +type: explanation +sidebar_position: 2 +--- + +# Fishjam Architecture + +_Understanding how Fishjam works under the hood_ + +This document explains the technical architecture of Fishjam and how data flows through the system. + +## High-level Architecture + +Streaming with Fishjam is simple: you create a room, add peers to it, and start streaming. Below is a high-level overview of how Fishjam works. + +![Fishjam Data Flow](@site/static/img/architecture.svg) + +## Components Overview + +### 1. Your Backend Server + +Your application's backend server is responsible for: + +- Authenticating users +- Creating rooms using Fishjam Server SDKs +- Generating peer tokens for clients +- Managing room lifecycle and permissions + +### 2. Fishjam Media Server + +The Fishjam Media Server is the core infrastructure component that: + +- Routes audio and video streams between participants +- Handles WebRTC negotiations and connections +- Manages different room types (conference, audio-only, livestream) +- Processes and transcodes media when needed +- Enforces security policies and token validation + +### 3. Client Applications + +Client applications (React Native, React) use Fishjam Client SDKs to: + +- Connect to rooms using peer tokens +- Send and receive audio/video streams +- Handle device management (cameras, microphones) +- Manage connection state and reconnections + +## Data Flow + +### 1. Room Creation Flow + +```mermaid +sequenceDiagram + participant FM as Fishjam Media Server + participant BE as Your Backend + participant Client as Client App + + Client->>BE: Request to join room + BE->>FM: Create room (Server SDK) + FM->>BE: Return room ID + BE->>FM: Create peer (Server SDK) + FM->>BE: Return peer token + BE->>Client: Send peer token + Fishjam ID +``` + +### 2. Media Streaming Flow + +```mermaid +sequenceDiagram + participant C1 as Client 1 + participant FM as Fishjam Media Server + participant C2 as Client 2 + + C1->>FM: Connect with peer token + C2->>FM: Connect with peer token + C1->>FM: Send video/audio stream + FM->>C2: Route stream to other peers + C2->>FM: Send video/audio stream + FM->>C1: Route stream to other peers +``` + +## Next Steps + +To understand different room types in detail, see [Rooms](../explanation/rooms). + +To learn about security and token management, see [Security & Token Model](../explanation/security-tokens). + +Ready to implement? Start with our tutorials: + +- [React Native Quick Start](../tutorials/react-native-quick-start) +- [Backend Quick Start](../tutorials/backend-quick-start) diff --git a/versioned_docs/version-0.30.0/explanation/compositions.mdx b/versioned_docs/version-0.30.0/explanation/compositions.mdx new file mode 100644 index 00000000..efc1de61 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/compositions.mdx @@ -0,0 +1,118 @@ +--- +type: explanation +title: Compositions +sidebar_position: 4.5 +description: Understand compositions, the Fishjam feature that mixes multiple live media streams into a single composed output in real time. +--- + +# Compositions + +_Understanding real-time stream composition in Fishjam_ + +A **composition** mixes multiple live media streams into a single output stream in real time. You send inputs (WebRTC, RTMP, or MP4), describe how they should be laid out, and it produces one composed stream that it publishes to a destination of your choosing, all without running any rendering infrastructure yourself. + +Compositions are built on [Smelter](https://smelter.dev), the source-available real-time video compositing engine by [Software Mansion](https://swmansion.com), and are a native part of Fishjam: they authenticate with the same Fishjam credentials and can compose the peers of a [Fishjam room](./rooms) directly. + +## What you can build + +- **Multi-party layouts**: arrange the cameras of a conference or livestream into grids, side-by-sides, or picture-in-picture. +- **Branded streams**: overlay logos, captions, lower-thirds, and backgrounds on top of live video. +- **Cross-protocol bridging**: take WebRTC inputs and republish the composed result over RTMP, for example broadcasting a conference to YouTube or Twitch, or the other way round. +- **Recordings**: capture the composed stream as an MP4 file to store, replay, or serve on demand. + +## Core concepts + +A **composition** is a single running compositing session. You register three kinds of things into it: + +- **Inputs**: the live media sources being composed (WebRTC via WHIP/WHEP, RTMP, or MP4). +- **Outputs**: where the composed result is sent (WebRTC via WHIP, or RTMP). Each output carries a **scene** that describes the layout. +- **Renderers**: shared assets such as images and fonts you can place in a scene. + +A composition produces video, it does not serve it. There is nowhere to point a player at a composition, so it always needs an output aimed at a destination your viewers can connect to instead: a [livestream](./livestreams) they watch over WHEP, or an RTMP service such as YouTube. + +An output's scene can either be described directly in the API or rendered by a **template**: a React component, written with the layout components and the [`@fishjam-cloud/composition`](./../how-to/compositions/write-and-deploy-a-template) hooks, that updates the layout live as the room changes. + +## Cost and lifecycle + +A running composition holds a live rendering session for as long as it exists, and you are billed for that time whether or not anyone is watching. + +Two defaults keep that in check. A composition auto-starts, and it cleans itself up after five minutes in which none of its inputs carry any media. + +`cleanup_without_inputs: false` turns that guard off. It tightens the condition so cleanup needs both the inputs and the outputs to go quiet, which is what you want when inputs arrive late, such as a room whose peers have not joined yet, or when a composition legitimately has no inputs, such as an output that renders only text. The cost is that a composition whose output keeps publishing is no longer cleaned up for you, so anything created that way is yours to delete, and a forgotten one bills until you do. + +Delete a composition as soon as you are done with it: + +```bash +curl -X DELETE "$COMPOSITION_URL/api/composition/$COMPOSITION" \ + -H "Authorization: Bearer $TOKEN" +``` + +## Recordings + +A **recording** saves what one of a composition's outputs publishes into an MP4 file that stays around after the composition is gone. Recordings are a resource of their own, managed through the [Fishjam Server API](./../api/reference#server) rather than the Composition API: [Recordings](./recordings) explains how they work, and [Record a composition](./../how-to/compositions/record-a-composition) walks through making one. + +## Scenes + +Every video output carries a **scene**: a tree of components that describes how inputs, text, and images are arranged into the composed frame. Audio outputs carry an **audio scene** that describes which inputs are mixed together. + +### The video scene tree + +A video scene has a single `root` component. Each component has a `type` that determines how it lays out its children. + +```json +{ + "root": { + "type": "tiles", + "children": [ + { "type": "input_stream", "input_id": "camera_1" }, + { "type": "input_stream", "input_id": "camera_2" } + ] + } +} +``` + +The available component types are: + +| `type` | Purpose | +| -------------- | -------------------------------------------------------------------------------- | +| `input_stream` | Renders one registered input. Identified by `input_id`. | +| `view` | A container you position and style; the basic building block for custom layouts. | +| `tiles` | Automatically arranges its children into a grid. | +| `rescaler` | Fits a single child into a target area, preserving aspect ratio. | +| `text` | Renders a text string. | +| `image` | Renders a registered image. Identified by `image_id`. | + +Components nest freely: a `tiles` of `rescaler`s wrapping `input_stream`s, a `view` with a `text` caption over an `input_stream`, and so on. The styling and full property set of each component come from Smelter itself; the [Smelter HTTP API reference](https://smelter.dev/http-api/overview) documents every component and its properties. + +### The audio scene + +An audio scene lists the inputs to mix and, optionally, their relative volume: + +```json +{ + "inputs": [ + { "input_id": "camera_1" }, + { "input_id": "camera_2", "volume": 0.5 } + ] +} +``` + +`volume` defaults to `1.0`. Only the inputs you list are audible in the output. + +### Setting a scene + +You provide the initial scene when you register an output, under `video.initial` (a video scene) and `audio.initial` (an audio scene). See [Choose inputs and outputs](./../how-to/compositions/inputs-and-outputs) for the full output shape. + +### Changing a scene over time + +A scene is not fixed for the life of an output. You can replace it while the composition is running, immediately or at a chosen point on the composition timeline. + +Either you push those updates yourself, or you hand the job to a **template**: a React component that receives the live room state and re-renders as the room changes. See [Choose inputs and outputs](./../how-to/compositions/inputs-and-outputs) to send an update, or [Write and deploy a template](./../how-to/compositions/write-and-deploy-a-template) to build one. + +## Where to go next + +- [Compositions tutorial](./../tutorials/compositions): create your first composition end to end. +- [Write and deploy a template](./../how-to/compositions/write-and-deploy-a-template): build a React layout with the composition SDK. +- [Compose a Fishjam room](./../how-to/compositions/compose-a-fishjam-room): turn a room's peers into one composed stream. +- [Record a composition](./../how-to/compositions/record-a-composition): save an output as an MP4. +- [Composition API](./../api/reference#compositions): the full REST surface. diff --git a/versioned_docs/version-0.30.0/explanation/custom-sources.mdx b/versioned_docs/version-0.30.0/explanation/custom-sources.mdx new file mode 100644 index 00000000..ae979605 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/custom-sources.mdx @@ -0,0 +1,90 @@ +--- +title: "How custom sources work" +sidebar_position: 10 +description: Concepts behind Fishjam custom sources, including track metadata routing, the publish lifecycle, and the React Native video and audio pipelines. +--- + +# How custom sources work + +[Custom sources](../how-to/client/custom-sources/index.mdx) let an app publish media that Fishjam did not capture itself. This page explains how custom tracks are modeled and routed, when they are published, and how the React Native pipelines move video frames to the encoder without copying pixels and turn pushed PCM into a live audio track. + +## Built-in source, middleware, or custom source? + +Fishjam clients offer three ways to influence what a peer publishes: + +| Approach | What it does | When to use it | +| ----------------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Built-in sources (`useCamera`, `useMicrophone`, `useScreenShare`) | Capture and publish a device the SDK manages end-to-end | Plain camera, microphone or screen sharing | +| [Track middleware](../how-to/client/stream-middleware) | Transforms a built-in track before it is sent (e.g. background blur) | You want the SDK's device handling, but with a processing step in between | +| [Custom sources](../how-to/client/custom-sources/index.mdx) | Publishes a `MediaStream` your app produced entirely on its own | Content that isn't a managed device: renderers, compositors, ML pipelines | + +Capabilities differ slightly per platform: + +| Capability | Web | React Native | +| -------------------------------------- | ---------------------------------- | --------------------------------------------------- | +| Publish any `MediaStream` | ✅ | ✅ | +| Frame-level video injection | via `canvas.captureStream()` | ✅ native buffer forwarding / pooled render targets | +| Custom audio | ✅ any audio track | ✅ PCM pushed through `useCustomAudioSource` | +| GPU rendering into the published video | ✅ WebGPU/WebGL via canvas capture | ✅ WebGPU toolkit with zero-copy camera import | + +## Streams and source IDs + +A custom source is a `MediaStream` registered under a stable **source ID** with `useCustomSource(sourceId)`. The ID makes the source addressable: + +- Every `useCustomSource` call with the same ID, in any component, returns the same state, so one component can produce the stream while another controls or renders it. +- A peer can publish any number of custom sources, each under its own ID. + +When the stream is published, Fishjam takes its first video track and first audio track (whichever are present) and publishes them with the track metadata types `customVideo` and `customAudio`. The metadata is how the receiving side tells custom tracks apart from camera, microphone and screen-share tracks: `usePeers` groups each peer's tracks by type and exposes custom tracks in the `customVideoTracks` and `customAudioTracks` arrays. + +## The publish lifecycle + +`setStream` is asynchronous and connection-aware: + +- Tracks are added to the session only while the peer is connected. A stream set before joining is stored as pending and published on connect. +- On disconnect, sources return to pending; after a reconnect they are re-published automatically. +- Calls to `setStream` are serialized: replacing one stream with another in quick succession cannot interleave, and a failed call does not affect subsequent ones. +- `setStream(null)` unpublishes and forgets the source. The tracks themselves are not stopped; the producer of the stream owns them. + +## The React Native media pipelines + +On the web, the browser can produce a `MediaStream` from a canvas, a media element or Web Audio, so the base hook is all you need. React Native has no such general facility, so the SDK provides its own pipelines, built into `@fishjam-cloud/react-native-webrtc`: custom video tracks fed with frames, and custom audio tracks fed with PCM samples. + +### The video frame pipeline + +```mermaid +flowchart LR + frames["Your frames
(native buffers or
rendered surfaces)"] --> track["Custom video track
(react-native-webrtc)"] + track --> stream["MediaStream"] + stream --> hook["useCustomSource"] + hook --> room["Fishjam room"] + room --> peers["Other peers
customVideoTracks"] +``` + +A **custom video track** looks like any other WebRTC video track to the rest of the stack, but its frames are supplied by your code through one of two modes: + +- **Forwarding**: you already have finished frames as native buffers (`CVPixelBufferRef` on iOS, `AHardwareBuffer*` on Android). `forwardFrame` passes the buffer pointer to the track; the SDK retains the buffer for as long as encoding needs it, so you can release your reference immediately. +- **Render target (pooled)**: you draw the frames yourself. The SDK allocates a small pool of GPU-shareable surfaces (IOSurfaces on iOS, AHardwareBuffers on Android); you import a surface into your GPU once, render into it, and return it with `pushFrame`. A pool of about 3 surfaces keeps drawing and encoding overlapped: one surface can be encoding while the next is being drawn. + +Both paths are zero-copy: pixels stay in the same native memory from your producer to the video encoder, and only a pointer moves. + +The pipeline also handles: + +- **GPU synchronization.** With asynchronous renderers, a pushed surface may not be fully drawn when the encoder reads it. `pushFrame` accepts a _fence_ (an `MTLSharedEvent` on iOS, a sync file descriptor on Android) so the encoder waits for your GPU work. The WebGPU hooks manage this automatically. +- **One timestamp domain.** Encoders require monotonically increasing timestamps. Forwarded frames without timestamps are stamped from the native monotonic clock, and the VisionCamera adapter normalizes VisionCamera's per-platform timestamp units onto one zero-based nanosecond timeline. +- **Worklet-friendly handles.** Track handles are plain, worklet-serializable objects, so frames can be pushed straight from a frame-processor worklet without hopping through the JS thread. This synchronous JSI handoff is also why custom video tracks require the New Architecture. + +### The audio pipeline + +A **custom audio track** takes raw PCM through `pushAudioSamples`, in any chunk size, from the JS thread or a worklet. The [`useCustomAudioSource`](../how-to/client/custom-sources/react-native.mdx#publish-custom-audio) hook wraps the underlying `createCustomAudioTrack` and registers the resulting stream through `useCustomSource`, so audio follows the same source-ID contract and publish lifecycle as every other custom source. + +The native layer re-paces pushes into the continuous real-time frame stream the encoder expects and inserts silence when the buffer runs dry, so the track behaves like a live microphone: pauses in pushing are fine and the stream never ends. Pushed-but-not-yet-sent audio is buffered up to a configurable duration (one minute by default) and drains in real time. Like the video handles, the audio track handle is worklet-serializable and its push channel is a synchronous JSI binding, which is why custom audio tracks also require the New Architecture. + +## Platform foundations + +- **iOS**: video surfaces are IOSurface-backed, BGRA8 (`bgra8unorm` as a render target). The WebGPU camera import relies on Metal external-texture features that are only guaranteed on iOS 17+; publishing frames without WebGPU has no such requirement. +- **Android**: video surfaces are `AHardwareBuffer`s, RGBA8 (`rgba8unorm`). The camera arrives as an opaque YCbCr buffer, so the WebGPU toolkit's `sampleCamera` performs the BT.709 limited-range YUV→RGB conversion in-shader. + +## Where to go next + +- [Custom sources how-to guides](../how-to/client/custom-sources/index.mdx): publish from the web, React Native, Vision Camera, WebGPU, or your own pipeline +- API reference: [`useCustomSource` (Web)](../api/web/functions/useCustomSource), [`useCustomSource` (React Native)](../api/mobile/functions/useCustomSource), [`useCustomAudioSource` (React Native)](../api/mobile/functions/useCustomAudioSource), [Vision Camera Source package](../api/vision-camera-source/index), [Custom Video Source package](../api/custom-video-source/index) diff --git a/versioned_docs/version-0.30.0/explanation/data-channels.mdx b/versioned_docs/version-0.30.0/explanation/data-channels.mdx new file mode 100644 index 00000000..5fed2f19 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/data-channels.mdx @@ -0,0 +1,67 @@ +--- +type: explanation +sidebar_position: 7 +description: Send and receive arbitrary binary data between peers using Fishjam data channels. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Data Channels + +Data channels allow you to send and receive arbitrary binary data between peers in a room. This is useful for implementing features like text chat, file sharing, game state synchronization, or real-time cursor positions. + +## Prerequisites + +Before using data channels, you must be [connected to a room](../how-to/client/connecting). Data channels only work after you have successfully joined a room. + +## Channel Types + +The SDK provides two types of data channels, each optimized for different use cases: + +### Reliable Channel + +- **Ordered delivery**: Messages arrive in the order they were sent +- **Guaranteed delivery**: All messages will be delivered, with automatic retransmission if needed +- **Use cases**: Chat messages, file transfers, commands, or any data that must not be lost + +### Lossy Channel + +- **Unordered delivery**: Messages may arrive out of order +- **No retransmission**: Messages may be dropped if the network is congested +- **Lower latency**: Faster delivery since there's no waiting for retransmissions +- **Use cases**: Real-time cursor positions, game state updates, live sensor data, or any data where the latest value matters more than every value + +## Broadcast Communication + +Data channels work in a **broadcast fashion** - when you publish data, it is sent to all other peers in the room. Additionally: + +- Messages sent on the **reliable channel** are only received by peers subscribed to the **reliable channel** +- Messages sent on the **lossy channel** are only received by peers subscribed to the **lossy channel** + +This separation allows you to use both channels simultaneously for different purposes without interference. + +## Using Data Channels + +Use the `useDataChannel` hook to work with data channels. The hook is available in both the web and mobile SDKs with the same API: + + + + +Use [`useDataChannel`](../api/web/functions/useDataChannel) from `@fishjam-cloud/react-client`. + + + + +Use [`useDataChannel`](../api/mobile/functions/useDataChannel) from `@fishjam-cloud/react-native-client`. + + + + +The typical flow is: + +1. Initialize the data channel after connecting to a room +2. Subscribe to incoming messages +3. Publish messages to other peers + +For a complete step-by-step guide on implementing text chat, see [Text Chat](../how-to/client/text-chat). diff --git a/versioned_docs/version-0.30.0/explanation/glossary.md b/versioned_docs/version-0.30.0/explanation/glossary.md new file mode 100644 index 00000000..14584929 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/glossary.md @@ -0,0 +1,39 @@ +--- +type: reference +--- + +# Glossary + +A brief walk-through of the terms we use in the documentation. + +### Room + +A collection of peers that can send and receive video/audio to and from other peers. + +### Peer + +A user that is connected to a room. Each peer has some associated metadata and tracks. + +### Agent + +A program connected to a room using the Fishjam server SDK; a programmatic peer. + +### Track + +A single stream of video or audio from a peer. It could be a camera view, shared screen, or microphone audio. Each peer can stream multiple tracks. + +### Management Token + +A secret token that should be stored on your backend. It allows you to create rooms and add peers. + +### Peer Token + +A token that your backend should pass to end clients to allow access to a specific room. + +### Fishjam ID + +The ID of your Fishjam instance. It is used by your backend server to add peers to rooms (and create rooms). It is also used by end client apps to join rooms. + +### Sandbox API + +A simple testing API allowing you to test Fishjam features without requiring you to add any functionalities to your backend. It is intended for development and testing only, not for production use. You can find more details [here](/how-to/backend/sandbox-api-testing). diff --git a/versioned_docs/version-0.30.0/explanation/livestreams.mdx b/versioned_docs/version-0.30.0/explanation/livestreams.mdx new file mode 100644 index 00000000..bee685b7 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/livestreams.mdx @@ -0,0 +1,221 @@ +--- +type: explanation +title: Livestreams +sidebar_position: 4 +description: Understand the difference between private and public livestreams in Fishjam and how to configure them. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Livestreams + +:::info +This explanation only applies to Fishjam rooms with type `livestream`. +::: + +When livestreaming with Fishjam, you can chose to make your livestream `private` or `public`. +By default, created livestreams are `private`, to prevent possible bugs. + + + + + ```ts + const fishjamId = ''; + const managementToken = ''; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId, + managementToken, + }); + + const privateRoom = await fishjamClient.createRoom({ roomType: 'livestream' }); // [!code highlight] + const publicRoom = await fishjamClient.createRoom({ roomType: 'livestream', public: true }); // [!code highlight] + ``` + + + + + + ```python + from fishjam import FishjamClient, RoomOptions + + fishjam_client = FishjamClient( + fishjam_id=fishjam_id, + management_token=management_token, + ) + + private_room = fishjam_client.create_room(RoomOptions(room_type="livestream")) # [!code highlight] + public_room = fishjam_client.create_room(RoomOptions(room_type="livestream", public=True)) # [!code highlight] + ``` + + + + +The choice you make affects how **viewers** connect to the livestream and has no effect on streamers. + +## Private livestreams + +When you create a private livestream, viewers are required to provide a viewer token when connecting to the livestream. + +This aims to provide control over who can view a livestream, but requires you to distribute tokens from your backend application to your frontend applications. + +### Creating a viewer token + +Below we show how you would create a livestream viewer token in a production scenario, with your own backend. +Note that for development purposes, you can [use the Sandbox API to generate a viewer token](../tutorials/livestreaming#obtaining-a-token-1). + + + + + ```ts + const fishjamId = ''; + const managementToken = ''; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId, + managementToken, + }); + + + const privateRoom = await fishjamClient.createRoom({ roomType: 'livestream' }); + const { token: viewerToken } = await fishjamClient.createLivestreamViewerToken(privateRoom.id); // [!code highlight] + ``` + + + + + + ```python + from fishjam import FishjamClient, RoomOptions + + fishjam_client = FishjamClient( + fishjam_id=fishjam_id, + management_token=management_token, + ) + + private_room = fishjam_client.create_room(RoomOptions(room_type="livestream")) + viewer_token = fishjam_client.create_livestream_viewer_token(private_room.id) # [!code highlight] + ``` + + + + +### Connecting to a private room + +Once you've created a viewer token, you can connect to a room using the Fishjam client SDKs (examples below), or alternatively you can use [WHEP](../how-to/backend/whip-whep#private-livestreams). + + + + + ```tsx + const viewerToken = ''; + + // ---cut--- + import { useLivestreamViewer } from '@fishjam-cloud/react-client'; + + // ... + + const { connect, stream } = useLivestreamViewer(); + + // ... + + await connect({ token: viewerToken }); + // after connecting stream will be available + ``` + + + + + + ```tsx + import React from 'react'; + + const viewerToken = ''; + + // ---cut--- + import { useLivestreamViewer, RTCView } from '@fishjam-cloud/react-native-client'; + + // Inside your component: + const { connect, stream } = useLivestreamViewer(); + + // ... + + await connect({ token: viewerToken }); + + // Render the stream + {stream && ( + + )} + ``` + + + + +## Public livestreams + +Public livestreams simplify the viewing process by omitting the viewer token. +All a viewer needs to view a public livestream is the ID of the room, so your backend doesn't need to manage the creation and distribution of viewer tokens. + +Note however, that public livestreams are _not suitable for all use-cases_. + +For example, if you are developing an app, which includes exclusive live content that requires a subscription to view, then you will want to authorize viewers before allowing them to view a livestream. +Failing to do so may result in extra costs, as livestreams are billed per-viewer. +Such an application will benefit from the token-based authorization in [private livestreams](#private-livestreams). + +### Connecting to a public room + +Once you've created a room of type `livestream` with the `public` flag enabled, you may start connecting viewers to the stream via the Fishjam client SDKs or [WHEP](../how-to/backend/whip-whep#public-livestreams). + + + + + ```tsx + const roomId = ''; + + // ---cut--- + import { useLivestreamViewer } from '@fishjam-cloud/react-client'; + + // ... + + const { connect, stream } = useLivestreamViewer(); + + // ... + + await connect({ streamId: roomId }); + // after connecting `stream` will be available + ``` + + + + + + ```tsx + import React from 'react'; + + const roomId = ''; + + // ---cut--- + import { useLivestreamViewer, RTCView } from '@fishjam-cloud/react-native-client'; + + // Inside your component: + const { connect, stream } = useLivestreamViewer(); + + // ... + + await connect({ streamId: roomId }); + + // Render the stream + {stream && ( + + )} + ``` + + + diff --git a/versioned_docs/version-0.30.0/explanation/moq-with-fishjam.mdx b/versioned_docs/version-0.30.0/explanation/moq-with-fishjam.mdx new file mode 100644 index 00000000..41b6c3a5 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/moq-with-fishjam.mdx @@ -0,0 +1,154 @@ +--- +type: explanation +sidebar_position: 9 +title: Media over QUIC in Fishjam +description: Understand how Media over QUIC (MoQ) works in Fishjam — the relay model, publish/subscribe architecture, paths, and token-based access control. +--- + +# Media over QUIC in Fishjam + +_How Media over QUIC (MoQ) works in Fishjam_ + +:::warning[MoQ is a standalone feature] +MoQ runs as a **separate delivery path** in Fishjam — it handles publishing and subscribing to a live broadcast over the MoQ relay, and the rest of Fishjam's feature set does not apply to a MoQ stream. In particular, a MoQ broadcast is not part of a WebRTC [room](./rooms), so you cannot use features like [Agents](../tutorials/agents), [data channels](./data-channels), and others that are part of the Fishjam WebRTC ecosystem. + +What MoQ supports is covered end to end in the [MoQ tutorials](../tutorials/moq/web-publishing). +::: + +## What is MoQ? + +[Media over QUIC (MoQ)](https://datatracker.ietf.org/wg/moq/about/) is a new internet standard for live media delivery, designed from the ground up for **scalable, low-latency streaming to large audiences**. + +Unlike WebRTC — which was primarily built for interactive, peer-to-peer conferencing — MoQ is optimized for the one-to-many broadcast model: one publisher, potentially thousands of simultaneous subscribers, all receiving the stream with minimal delay. + +A few properties make MoQ stand out: + +- **Built on QUIC.** QUIC is a modern transport protocol that eliminates head-of-line blocking, recovers from packet loss more gracefully than TCP, and establishes connections faster. For live video, this means more resilient delivery at low latency. +- **Standardized negotiation.** Because MoQ defines a common signaling and subscription protocol, any MoQ-compliant client can connect to any MoQ-compliant relay — you are not locked into a proprietary stack. +- **Relay-based architecture.** The relay is a first-class part of the MoQ protocol, not an add-on. Because relaying is built into the protocol's design, scaling delivery to large audiences is a native capability. + +:::info +Fishjam also supports WebRTC-based livestreaming (WHIP/WHEP). See [Livestreams](./livestreams) for that approach. +::: + +## How MoQ Works in Fishjam + +Fishjam provides a **MoQ relay** that publishers push media to and subscribers pull media from. + +``` +Publisher → Fishjam MoQ Relay → Subscriber(s) +``` + +The relay is responsible for distributing the stream: it receives media from the publisher once and fans it out to every subscriber. + +### The publish/subscribe model + +MoQ uses a **publish/subscribe** model: + +- A **publisher** connects to the relay, announces a stream under a specific path, and starts sending media. +- **Subscribers** connect to the relay, discover announced paths, and receive the media. + +The relay manages the flow between them. Neither side needs a direct connection to the other. + +### Paths + +Every stream is identified by a **path** — a slash-separated string like `my-room/alice-camera`. Paths are used in two distinct ways: + +1. **Addressing** — a subscriber consumes an exact path to receive that specific stream (e.g. `my-room/alice-camera`). +2. **Discovery** — a subscriber watches a prefix (e.g. `my-room`) to learn which streams are currently live under it. This returns a live feed of announced paths — each of which must then be consumed individually. This is how you can display all participants in a room without knowing their paths in advance. + +Note that consuming an exact path and discovering a prefix are separate operations. Consuming `my-room` directly would fail unless a publisher is broadcasting at that exact path. + +### Path Scoping + +Every connection goes to `relay.fishjam.io/`. Your Fishjam ID is automatically used as the token's root namespace by the Fishjam Server — you never include it in `publishPath` or `subscribePath`; it is set for you. All paths you specify are **relative to that root**. + +Path matching is **prefix-based**: a path of `"stream-name"` permits any broadcast whose full path starts with `stream-name/`, not just the exact string `"stream-name"`. + +#### Publisher paths + +The `publishPath` you set determines how much freedom the broadcaster has when naming their broadcast: + +- **Broad path** (`publishPath: "stream-name"`) — the client can publish as any sub-path under `stream-name`, such as `stream-name/alice` or `stream-name/bob-camera`. The client chooses its own identity; the relay only enforces the prefix. +- **Specific path** (`publishPath: "stream-name/alice"`) — the client can **only** publish as `stream-name/alice`. If the broadcaster tries to use `stream-name/bob`, the relay rejects the announcement. This is how you enforce a broadcaster's identity from the server side. + +Use the broad form when clients self-identify (e.g., users pick their own stream name). Use the specific form when your backend assigns identities (e.g., you issue a per-user token for a managed conference). + +#### Subscriber paths + +The `subscribePath` works the same way: it is a prefix that limits which broadcasts the subscriber can consume and discover. + +- **Broad path** (`subscribePath: "stream-name"`) — the subscriber can consume any broadcast under `stream-name/` and will surface all publishers in that namespace as they come and go. +- **Specific path** (`subscribePath: "stream-name/alice"`) — the subscriber can only receive from `stream-name/alice`. Broadcasts at `stream-name/bob` are invisible to this client. + +#### Example: a multi-publisher room + +A typical room setup uses a combination of both patterns: + +1. The backend issues each broadcaster a **specific** publisher token — `publishPath: "my-room/"` — so each user can only occupy their own slot. +2. The backend issues viewers a **broad** subscriber token — `subscribePath: "my-room"` — so they discover and consume every broadcast in the room. +3. When a new publisher joins or leaves, the viewer is informed by the relay + +## Access Control: MoQ Tokens + +Access to the relay is controlled by **MoQ tokens** — short-lived JWTs that are path-scoped: + +| Token type | Grants | Typical recipient | +| ---------------- | ---------------------------------- | ----------------- | +| Publisher token | Write access to a specific path | Streamer | +| Subscriber token | Read access to a path or namespace | Viewer | + +A token is attached to the relay URL as a query parameter (`?jwt=`). The relay validates the token and enforces its scope before allowing any media to flow. Both the Sandbox API and the Server SDK hand you the authenticated **connection URL** (the relay URL with the token already embedded), so the client can just take it as is and connect. + +Keeping publisher and subscriber tokens separate ensures that a viewer can never accidentally publish to the stream, and a publisher cannot subscribe to paths it does not own. + +## Where to get the Connection URL from? + +There are two ways to obtain a MoQ connection URL, depending on where you are in the development lifecycle. + +### Sandbox API (prototyping) + +The **Sandbox API** is a ready-made backend provided by Fishjam for development and prototyping. It issues connection URLs without requiring you to build your own server, so you can start streaming immediately. + +To get a publisher connection URL, call: + +``` +GET https://fishjam.io/api/v1/connect/{FISHJAM_ID}/room-manager/moq/{PUBLISHER-PATH}/publisher +``` + +To get a subscriber connection URL, call: + +``` +GET https://fishjam.io/api/v1/connect/{FISHJAM_ID}/room-manager/moq/{SUBSCRIBER-PATH}/subscriber +``` + +To get a full-access connection URL — one that can both publish to and subscribe on the path — call: + +``` +GET https://fishjam.io/api/v1/connect/{FISHJAM_ID}/room-manager/moq/{PATH}/full-access +``` + +Each returns a JSON object with a `connection_url` field — the relay URL with the JWT embedded as `?jwt=` — alongside the raw `token`. + +The Sandbox API is **not intended for production** — it has no authentication and is only available in the Sandbox environment. See [What is the Sandbox API?](./sandbox-api-concept) for more context. + +### Fishjam Server SDK (production) + +In production, your backend generates connection URLs using the **Fishjam Server SDK**. This gives you full control over who can publish and who can subscribe. + +The SDK's `createMoqAccess` method accepts a `publishPath`, a `subscribePath`, or both, and returns the MoQ access details — a `connection_url` (the relay URL with the JWT embedded) alongside the raw `token`: + +- `publishPath` — returns a publisher connection URL scoped to that path. +- `subscribePath` — returns a subscriber connection URL scoped to that path or namespace prefix. +- both `publishPath` and `subscribePath` — returns a full-access connection URL that can publish and subscribe on those paths. + +Your backend then delivers each connection URL to the appropriate client (publisher or viewer), which uses it to connect to the relay. + +See the [Web Publishing](../tutorials/moq/web-publishing) and [Web Subscribing](../tutorials/moq/web-subscribing) tutorials (or their [React Native](../tutorials/moq/react-native-publishing) [counterparts](../tutorials/moq/react-native-subscribing)) for working code examples. + +## See also + +- [Web Publishing](../tutorials/moq/web-publishing) / [Web Subscribing](../tutorials/moq/web-subscribing) — step-by-step guides to publishing and subscribing +- [What is the Sandbox API?](./sandbox-api-concept) — when and why to use the Sandbox API +- [Security & Token Model](./security-tokens) — broader overview of Fishjam's token system +- [Livestreams](./livestreams) — WebRTC-based livestreaming with WHIP/WHEP diff --git a/versioned_docs/version-0.30.0/explanation/recordings.mdx b/versioned_docs/version-0.30.0/explanation/recordings.mdx new file mode 100644 index 00000000..1bbbc36a --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/recordings.mdx @@ -0,0 +1,57 @@ +--- +type: explanation +title: Recordings +sidebar_position: 4.6 +description: Understand recordings, the Fishjam resource that captures a composition's output into an MP4 file that persists after the composition ends. +--- + +# Recordings + +_Understanding how Fishjam captures composed streams as files_ + +A **recording** captures the media published by one of a [composition](./compositions)'s outputs and stores it as an MP4 file. A composition is a live process: it produces media while it runs and leaves nothing behind once it is deleted. A recording is the persistent artifact of that process. It remains available after the composition, the room, and the livestream it was created from are gone, and it is stored in Fishjam until you delete it. + +```text +composition ──output──▶ livestream / RTMP ──▶ [viewers] + │ + └──recording──▶ MP4 ──▶ [download] +``` + +## Recorders and outputs + +A composition produces media through its outputs, and outputs are the unit that is recorded. To create a recording, you specify a composition and one of its registered outputs, and Fishjam attaches a recorder to that output. The recorder captures the output as it is published: the same layout and resolution, including every scene update, encoded separately from the live stream. There is no separate recording scene. If the recorded file should differ from the live stream, register a dedicated output with its own scene and record that output instead. + +Besides composition URL and output ID, the recording API accepts a single option, `scaleRatio`, which sets the recording resolution as a fraction or multiple of the output's resolution. For example, `0.5` stores the recording at half the output resolution. + +An output can have at most one recording at a time. To record the same output again, wait until the current recording is no longer `active`. + +## Composition API and Server API + +Compositions are managed through the [Composition API](./../api/reference#compositions), while recordings are created and managed through the [Fishjam Server API](./../api/reference#server), either directly or with the JS and Python server SDKs. This split reflects ownership: a composition is a running session that you configure, whereas a recording is a resource of your Fishjam app, stored alongside your rooms and livestreams and managed with the same management token. You do not interact with the composition to record it; the Server API controls the capture inside the composition on your behalf. + +## Lifecycle + +A recording has four statuses: + +| Status | Meaning | +| ----------- | ------------------------------------------------------- | +| `active` | The output is being captured. | +| `finished` | Capture has ended and the file is being prepared. | +| `available` | The MP4 is ready and `files` contains the download URL. | +| `failed` | An error occurred and no file will be produced. | + +Capture starts as soon as the recording is created. It ends when you stop the recording explicitly, or automatically when the recorded output ends or the composition is deleted, so deleting a composition also finalizes its recordings. Finalization is asynchronous: the recording remains `active` until capture has ended, then transitions through `finished` to `available` once the file is ready. + +Every status change emits a `RecordingStatusChanged` [server notification](./../api/reference#protobufs) over your configured webhook or a websocket, so you can react to a file becoming available without polling. + +Once a recording is `available`, its `files` field lists the media files in playback order as direct HTTPS URLs that you can download or serve to your users. The recording and its files persist until you delete the recording. Deleting the recording is the only way to remove them, and a recording cannot be deleted while it is `active`. + +## Metadata + +A recording carries optional free-form `metadata`, set at creation and returned with every read. Because recordings accumulate over time, metadata also serves as the primary way to locate them: listing recordings supports filtering by metadata pairs, for example to retrieve every recording for a given show or customer. + +## Where to go next + +- [Record a composition](./../how-to/compositions/record-a-composition): start, stop, and download a recording step by step. +- [Compositions](./compositions): the sessions that recordings capture. +- [Server REST API](/api/rest): the complete request and response schemas. diff --git a/versioned_docs/version-0.30.0/explanation/rooms.mdx b/versioned_docs/version-0.30.0/explanation/rooms.mdx new file mode 100644 index 00000000..128f0432 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/rooms.mdx @@ -0,0 +1,143 @@ +--- +type: explanation +sidebar_position: 3 +--- + +# Rooms + +_Understanding different types of rooms and when to use them_ + +Fishjam provides three distinct room types, each optimized for different use cases and scenarios. +Understanding these room types helps you choose the right approach for your application. + +## Conference Rooms (Default) + +### What are Conference Rooms? + +Conference rooms are the default room type designed for multi-participant video conferencing scenarios. They support all Fishjam features and provide the most flexibility. + +### Key Characteristics + +- **Multi-participant**: Support for many participants simultaneously +- **Bidirectional media**: All participants can send and receive video/audio +- **Multiple sources**: Participants can share their camera, screen, microphone and more all at once +- **Flexible track management**: Participants can add/remove tracks dynamically + +### Best Use Cases + +- **Video conferencing applications** +- **Interactive webinars** with participant engagement + +### Cost Considerations + +Conference rooms are priced based on total connection time of all peers. + +## Audio-only Rooms + +### What are Audio-only Rooms? + +Audio-only rooms are optimized specifically for voice communication, removing video capabilities to improve performance and reduce costs. + +### Key Characteristics + +- **Voice-only communication**: No video tracks allowed +- **Cheap pricing**: Audio only rooms cost much less than other room types +- **Optimized network usage**: Works well in degraded network conditions + +### Best Use Cases + +- **Audio chat applications** +- **Podcast recording** with multiple participants +- **Large-scale audio events** (town halls, announcements) + +### Cost Benefits + +Audio-only rooms come at a **75% discount** compared to conference rooms: + +- 2 peers for 30 minutes = 60 minutes total time in conference room +- Same scenario in audio-only room = 15 minutes equivalent cost + +### Video Behavior in Audio-only Rooms + +If you attempt to add video to an audio-only room: + +- Video tracks are ignored (not transmitted) +- SDKs log warnings to help with debugging +- Only audio from screen sharing is transmitted +- No errors thrown, graceful degradation + +## Livestream Rooms + +### What are Livestream Rooms? + +Livestream rooms are designed for one-to-many livestreaming scenarios where a single streamer streams to multiple viewers. + +### Key Characteristics + +- **One sender**: Only one streamer can send media +- **Many receivers**: Unlimited viewers can watch +- **Optimized for scale**: Efficient distribution architecture + +### Livestreaming Limitations + +- **Single video track**: Only one video stream allowed +- **Single audio track**: Only one audio stream allowed +- **Additional tracks ignored**: Extra tracks are not forwarded to viewers + +### Viewer Experience + +- **Configurable access**: Livestreams can either be public, where anyone with the stream's ID can join, or private, where every viewer needs a token +- **Standard compatibility**: Any [WHEP](https://blog.swmansion.com/building-interactive-streaming-apps-webrtc-whip-whep-explained-d38f4825ec90)-compatible player works + +### Best Use Cases + +- **Live events** +- **Streaming platforms** and content distribution +- **Corporate livestreams** and announcements +- **Sports and entertainment** streaming + +### Cost Benefits + +Livestream rooms are **20% cheaper** than conference rooms for equivalent usage. + +## Choosing the Right Room Type + +### Decision Matrix + +| Use Case | Room Type | Why | +| ---------------------- | ---------- | ------------------------------------------- | +| Classic video meetings | Conference | Multiple video sources | +| Voice-only meetings | Audio-only | Cheapest and most performant option | +| Live Podcasts | Audio-only | Cheapest and most performant option | +| Sport streaming | Livestream | Highly scalable and cheaper than conference | +| Interactive workshop | Conference | Multiple video sources | + +## Video Codecs + +Fishjam supports the following video codecs: + +- **H.264** — A hardware-accelerated codec offering superior performance. Used by default. Its availability varies by device, and it may not perform optimally at lower bitrates. +- **VP8** — A software-based codec supported across all devices, ensuring maximum compatibility. Ideal for environments lacking hardware acceleration, such as Android emulators. + +Fishjam uses H.264 by default, however, to solve an issue with Android emulators, VP8 is set when you're using the Sandbox API. + +You can override the default codec by setting the `codec` parameter when [creating a room](../api/server/interfaces/RoomConfig#videocodec) using server SDKs. + +We recommend using H.264 for production and VP8 for development as it works with Android emulators. + +## Next Steps + +To understand how to use each room type: + +- [How to implement livestreaming](../tutorials/livestreaming) +- [How to create audio-only calls](../how-to/backend/audio-only-calls) + +To learn about the underlying architecture: + +- [Fishjam Architecture](../explanation/architecture) +- [Security & Token Model](../explanation/security-tokens) + +Ready to start building? Check our tutorials: + +- [React Native Quick Start](../tutorials/react-native-quick-start) +- [Backend Quick Start](../tutorials/backend-quick-start) diff --git a/versioned_docs/version-0.30.0/explanation/sandbox-api-concept.mdx b/versioned_docs/version-0.30.0/explanation/sandbox-api-concept.mdx new file mode 100644 index 00000000..24a555aa --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/sandbox-api-concept.mdx @@ -0,0 +1,92 @@ +--- +type: explanation +sidebar_position: 1 +description: A development tool that provides a simple backend for testing Fishjam without building your own server. +--- + +# What is the Sandbox API? + +The Sandbox API is a development tool that simplifies getting started with Fishjam by providing a simple backend for testing, eliminating the need to build your own server initially. + +## What can the Sandbox API do? + +The Sandbox API is an HTTP server provided by us for development and testing. +It provides basic room creation and peer management functionality without requiring you to set up your own backend infrastructure. + +### Key Characteristics + +- **Development-purposed**: Designed for initial development and testing +- **No authentication**: Simplified access for quick prototyping +- **Testing-only**: Not intended for production use; use your own authenticated backend for production + +## Sandbox API URL and Fishjam ID + +You can find your sandbox credentials in the [Sandbox tab](https://fishjam.io/app/sandbox) of the Fishjam Dashboard. + +The **Sandbox API** is a hosted HTTP backend you can use to test Fishjam without writing your own server. It creates [**rooms**](../explanation/rooms) and **peers** for conferencing, and supports [**livestreaming**](../explanation/livestreams) by issuing the streamer and viewer credentials. It's an example implementation of what you need to build using our [**JavaScript server SDK**](../api/server) to go to production. + +You can use your sandbox credentials by passing them to the `useSandbox` hook in the client SDK, which will create rooms and peer tokens for you, or by calling the Sandbox API URL directly from your client and using the returned `peerToken` to connect to Fishjam. + +The **Fishjam ID** from the [Dashboard tab](https://fishjam.io/app) is passed to `FishjamProvider` so the client can connect to the Fishjam media server after it gets a peer token. + +If your Sandbox API URL is exposed or your credentials are compromised, generate a new URL from the Sandbox tab to invalidate the old one. You can also disable the Sandbox API and enable it again when you want to resume sandbox testing. +If you expose your Sandbox API URL in a public deployment, it can leak (for example through client code or network requests). Anyone who obtains that URL can create rooms and peers on your behalf. + +## The Problem Sandbox API Solves + +When starting with videoconferencing or livestreaming development, you typically need: + +1. A **Backend server** to create rooms +2. An **Authentication system** to manage users +3. **Token management** for secure peer access +4. **API endpoints** for your frontend to call + +This creates a problem: to test your frontend, you need a backend, but during prototyping you want to focus on frontend development first. +The Sandbox API mitigates this issue and allows you to start frontend development ASAP. + +## Relationship to Server SDKs + +The Sandbox API is essentially a simplified application built using the Fishjam Server SDKs: + +```typescript +import { FishjamClient, RoomType } from "@fishjam-cloud/js-server-sdk"; +import express from "express"; +const fishjamId = ""; +const managementToken = ""; +const app = express(); + +// ---cut--- +// What Sandbox API does internally (simplified) +const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + +app.get("/", async (req: express.Request, res: express.Response) => { + const { roomName, peerName, roomType } = req.query; + + // Create or get room + const room = await fishjamClient.createRoom({ + roomType: roomType as RoomType, + }); + + // Create or get peer + const { peer, peerToken } = await fishjamClient.createPeer(room.id); + + res.json({ peerToken }); +}); +``` + +This shows you exactly what your production backend needs to do, just with proper authentication and error handling. + +## See also + +To understand how to use The Sandbox API for development: + +- [How to use The Sandbox API for testing](../how-to/backend/sandbox-api-testing) + +To learn about building your own backend: + +- [Backend Quick Start Tutorial](../tutorials/backend-quick-start) +- [How to set up your server](../how-to/backend/server-setup) + +To understand the security model: + +- [Security & Token Model](../explanation/security-tokens) diff --git a/versioned_docs/version-0.30.0/explanation/security-tokens.mdx b/versioned_docs/version-0.30.0/explanation/security-tokens.mdx new file mode 100644 index 00000000..e0e86a54 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/security-tokens.mdx @@ -0,0 +1,116 @@ +--- +type: explanation +sidebar_position: 5 +--- + +# Security & Token Model + +_Understanding Fishjam's security architecture and token system_ + +Fishjam uses a token-based security model to ensure secure access control while keeping the developer experience simple. + +## Security Architecture Overview + +Fishjam's security is built on a **two-tier token system**: + +1. **Management Tokens**: For backend-to-Fishjam server communication +2. **Peer Tokens**: For client-to-Fishjam server communication + +This separation ensures that sensitive operations remain on your backend while allowing clients secure, limited access to media streaming. + +## Management Tokens + +### Purpose + +Management tokens provide your backend server with administrative access to Fishjam resources. They allow creating, managing, and deleting rooms and peers. + +### Characteristics + +- **Long-lived**: Management tokens remain valid until manually regenerated +- **High privilege**: Management tokens allow performing administrative operations and should only be used in backend applications. +- **Backend-only**: Management tokens should never be sent to client applications. + +### What Management Tokens Can Do + +Management tokens give permission to: + +- Create and manage rooms and peers +- Setup [webhooks](../how-to/backend/server-setup#webhooks) +- Set [immutable peer metadata](../how-to/backend/server-setup#metadata) + +## Peer Tokens + +### Purpose + +Peer tokens provide client applications with limited, time-bound access to join a specific room as a specific peer. + +### Characteristics + +- **Short-lived**: Peer tokens expire 24h after creation. +- **Scope-limited**: Peer tokens give access to one specific room as one specific peer only. +- **Client-safe**: Peer tokens are safe to send to frontend applications. + +### What Peer Tokens Can Do + +Peer tokens give permission to: + +- Connect to the specific room they were issued for +- Participate in room activities (audio/video/screen sharing) +- Access peer metadata and room state + +### What Peer Tokens Cannot Do + +- Create or delete rooms +- Access multiple rooms +- Add or remove peers + +### Generation Process + +```typescript +import { FishjamClient, RoomId } from "@fishjam-cloud/js-server-sdk"; +import express from "express"; +const res = {} as any; +const managementToken = ""; +const fishjamId = ""; +const roomId = "" as unknown as RoomId; +const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + +// ---cut--- +// Backend generates peer token (using management token) +const { peer, peerToken } = await fishjamClient.createPeer(roomId, { + metadata: { name: "John Doe", userId: "user-123" }, +}); + +// Backend sends peer token to client +res.json({ + peerToken, // Client uses this to connect + roomId, // Room information +}); +``` + +### Client Usage + +```typescript +import { useConnection } from "@fishjam-cloud/react-client"; +const joinRoom = {} as any; +const peerToken = ""; + +// ---cut--- +// Client uses peer token to connect (safe to use in frontend) +await joinRoom({ peerToken }); // This is safe in client code +``` + +## Next Steps + +To implement secure authentication: + +- [Backend Quick Start Tutorial](../tutorials/backend-quick-start) +- [How to set up your server](../how-to/backend/server-setup) + +To understand the broader architecture: + +- [Fishjam Architecture](../explanation/architecture) + +To learn about the Sandbox API's security limitations: + +- [Understanding the Sandbox API](../explanation/sandbox-api-concept) diff --git a/versioned_docs/version-0.30.0/explanation/simulcast.mdx b/versioned_docs/version-0.30.0/explanation/simulcast.mdx new file mode 100644 index 00000000..5cd91431 --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/simulcast.mdx @@ -0,0 +1,83 @@ +--- +type: explanation +sidebar_position: 8 +description: How simulcast enables adaptive video quality by sending multiple resolution variants simultaneously. +--- + +# Simulcast + +_Multi-quality video streaming for adaptive bandwidth and layout-aware rendering_ + +Simulcast allows a video sender to encode and transmit the same video at multiple quality levels (variants) simultaneously. Each receiver independently chooses which variant to receive, enabling adaptive quality based on network conditions, UI layout, or user preference. + +## Why Simulcast? + +Without simulcast, every receiver gets the same video quality. This creates a trade-off: receive high quality (wastes bandwidth for small thumbnails) or receive low quality (degrades the experience for full-screen viewers). + +Simulcast solves this on the receiver side -- a sender publishes multiple variants, and each receiver requests only the quality it needs. The trade-off is increased upload bandwidth on the sender, since it encodes and transmits multiple variants simultaneously. If this overhead is not acceptable, the sender can [choose which variants to publish](#sender-configuration) or disable simulcast entirely. + +- A **thumbnail grid** can request low quality for all participants +- A **spotlight view** can request high quality for the active speaker and low for everyone else +- A participant on a **slow connection** can request medium quality regardless of UI layout + +## Quality Variants + +Three predefined quality tiers are available via the `Variant` enum: + +| Variant | Meaning | +| ------------------------ | --------------------------- | +| `Variant.VARIANT_LOW` | Low quality / resolution | +| `Variant.VARIANT_MEDIUM` | Medium quality / resolution | +| `Variant.VARIANT_HIGH` | High quality / resolution | + +## How It Works + +```mermaid +sequenceDiagram + participant Sender + participant Server as Fishjam Server + participant ReceiverA as Receiver A (thumbnail) + participant ReceiverB as Receiver B (full-screen) + + Sender->>Server: Video (LOW + MEDIUM + HIGH) + ReceiverA->>Server: setReceivedQuality(LOW) + Server->>ReceiverA: Forwards LOW variant + ReceiverB->>Server: setReceivedQuality(HIGH) + Server->>ReceiverB: Forwards HIGH variant +``` + +1. The **sender** encodes the camera feed into up to three variants and sends all of them to the Fishjam server. +2. The **server** receives all variants but only forwards the one each receiver has requested. +3. Each **receiver** calls `setReceivedQuality` on a remote track to tell the server which variant it wants. The receiver can change this at any time. + +## Sender Configuration + +The sender controls which variants to publish via the `sentQualities` option in `FishjamProvider`'s `videoConfig`: + +- **All variants** (default): Omit `sentQualities` or pass `[Variant.VARIANT_LOW, Variant.VARIANT_MEDIUM, Variant.VARIANT_HIGH]` +- **Subset**: Pass only the variants you need, e.g. `[Variant.VARIANT_LOW, Variant.VARIANT_HIGH]` +- **Disabled**: Pass `false` to send a single quality stream (no simulcast) + +## Receiver Quality Selection + +Remote tracks expose a `setReceivedQuality` method. This is only available on **remote** peer tracks. Your own local tracks don't have it, since you don't "receive" your own video. + +The `RemoteTrack` type (exported from both `@fishjam-cloud/react-client` and `@fishjam-cloud/react-native-client`) extends the base `Track` type with a `setReceivedQuality(quality: Variant)` method. + +When you call `setReceivedQuality`, the server switches which variant it forwards for that track. The change takes effect almost immediately. + +## When to Use Simulcast + +Simulcast is most valuable when: + +- Your app has **multiple layout modes** (grid, spotlight, picture-in-picture) +- Participants have **varying network conditions** +- You want to **reduce bandwidth** for participants viewing many small thumbnails +- You're building **adaptive quality** that responds to UI state + +For simple 1:1 calls where both sides always show full-screen video, simulcast adds encoding overhead without much benefit. Consider disabling it with `sentQualities: false`. + +## See also + +- [Simulcast how-to guide](../how-to/client/simulcast): step-by-step implementation +- [Architecture](./architecture): how Fishjam routes media diff --git a/versioned_docs/version-0.30.0/explanation/what-is-fishjam.mdx b/versioned_docs/version-0.30.0/explanation/what-is-fishjam.mdx new file mode 100644 index 00000000..4567811d --- /dev/null +++ b/versioned_docs/version-0.30.0/explanation/what-is-fishjam.mdx @@ -0,0 +1,67 @@ +--- +type: explanation +sidebar_position: 0 +--- + +# What is Fishjam? + +_Understanding the role and purpose of Fishjam_ + +Fishjam is a multimedia streaming toolkit that allows you to build real-time video and audio streaming applications. +It uses [WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) under the hood to ensure sub-second (in most cases **less than 300ms**) latency. +We provide the infrastructure, media server, and client SDKs so you can focus on building your apps. + +**No WebRTC knowledge is required!** + +## The Problem Fishjam Solves + +Building real-time video and audio applications is complex. Developers typically need to: + +- Set up and manage WebRTC infrastructure +- Handle complex peer-to-peer networking +- Manage media servers and scaling +- Deal with different devices and codec compatibility +- Implement secure token-based authentication + +Fishjam abstracts away this complexity, providing a simple API and managed infrastructure. + +## What Fishjam Provides + +Fishjam consists of several components that work together to provide a seamless multimedia streaming experience: + +| Component | Description | +| --------------------- | ------------------------------------------------------------------------------------------------------- | +| Developer panel | The place to access your credentials and manage your Fishjam usage. | +| Fishjam Media Servers | Media servers route your multimedia traffic. We host and manage them for you. | +| Fishjam Client SDKs | Toolkit used for multimedia integration on endpoint devices. | +| Fishjam Server SDKs | Toolkit for integrating your backend with Fishjam. We currently support Python and NodeJS. | +| Sandbox API | Simple backend for creating test rooms. You can test Fishjam without having to set up your own backend. | + +## Use Cases + +Fishjam is ideal for: + +### Video Conferencing + +Build videoconferencing applications with multiple participants in rooms, screen sharing, and audio/video. + +### Livestreaming + +Stream live content from one streamer to many viewers with low latency. +Perfect for live events or streaming platforms. + +### Audio-only Applications + +Create voice-only experiences like audio conferencing, podcasts, or voice chat applications. + +## Next Steps + +To understand how Fishjam works technically, see [Fishjam Architecture](../explanation/architecture). + +To learn about the different types of rooms available, see [Rooms](../explanation/rooms). + +Ready to start building? Check out our tutorials: + +- [React Native Quick Start](../tutorials/react-native-quick-start) +- [React Quick Start](../tutorials/react-quick-start) +- [Backend Quick Start](../tutorials/backend-quick-start) diff --git a/versioned_docs/version-0.30.0/how-to/_category_.json b/versioned_docs/version-0.30.0/how-to/_category_.json new file mode 100644 index 00000000..a932906d --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "How-to Guides", + "position": 3, + "link": { + "type": "generated-index", + "title": "How-to Guides", + "description": "Practical step-by-step guides to help you achieve a specific goal. Most useful when you're trying to get something done.", + "slug": "/how-to" + }, + "collapsible": false +} diff --git a/versioned_docs/version-0.30.0/how-to/_common/metadata/header.mdx b/versioned_docs/version-0.30.0/how-to/_common/metadata/header.mdx new file mode 100644 index 00000000..aafb60c4 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/_common/metadata/header.mdx @@ -0,0 +1,10 @@ +Alongside audio and video, it is possible to send additional metadata with each peer. Metadata is just +JSON that can contain arbitrary information. Its most common use is sending a user name associated with a peer. +However, it can be also used to send the peer's camera type, application information etc. + +:::info + +You can also set metadata on [the server side, when adding user to the room](../../../how-to/backend/server-setup#metadata). This metadata is persistent throughout its lifetime and is useful for attaching information that +can't be overwritten by the peer, like information about real user names or basic permission info. + +::: diff --git a/versioned_docs/version-0.30.0/how-to/_common/metadata/joining_room.mdx b/versioned_docs/version-0.30.0/how-to/_common/metadata/joining_room.mdx new file mode 100644 index 00000000..517a5b30 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/_common/metadata/joining_room.mdx @@ -0,0 +1,5 @@ +## Setting metadata when joining the room + +The `joinRoom` method from the `useConnection` hook has a `peerMetadata` parameter, that can be used for setting object metadata. + +{props.children} diff --git a/versioned_docs/version-0.30.0/how-to/_common/metadata/reading.mdx b/versioned_docs/version-0.30.0/how-to/_common/metadata/reading.mdx new file mode 100644 index 00000000..b0516650 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/_common/metadata/reading.mdx @@ -0,0 +1,9 @@ +## Reading metadata + +Peer metadata is available as the `metadata` property for each peer. Therefore, when you list your peers with the `usePeers` hook, you can read +the metadata associated with them. +Note that the `metadata.peer` property contains only the metadata set by the client SDK (as in the examples examples above). +The metadata set on the server side is available as `metadata.server`. +Learn more about server metadata [here](../backend/server-setup#metadata). + +{props.children} diff --git a/versioned_docs/version-0.30.0/how-to/_common/metadata/updating.mdx b/versioned_docs/version-0.30.0/how-to/_common/metadata/updating.mdx new file mode 100644 index 00000000..97bd1a1b --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/_common/metadata/updating.mdx @@ -0,0 +1,5 @@ +## Updating metadata during connection + +Once you've joined the room, you can update your peer metadata with the `updatePeerMetadata` method of the `useUpdatePeerMetadata` hook: + +{props.children} diff --git a/versioned_docs/version-0.30.0/how-to/backend/_category_.json b/versioned_docs/version-0.30.0/how-to/backend/_category_.json new file mode 100644 index 00000000..2d5af2e1 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Backend", + "position": 4 +} diff --git a/versioned_docs/version-0.30.0/how-to/backend/audio-only-calls.mdx b/versioned_docs/version-0.30.0/how-to/backend/audio-only-calls.mdx new file mode 100644 index 00000000..46cb48f4 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/audio-only-calls.mdx @@ -0,0 +1,100 @@ +--- +sidebar_position: 6 +description: Create audio-only rooms and livestreams for voice-only use cases at a discounted cost. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Audio-only Conferences and Livestreams + +In many use cases, you only need real-time audio, without any video streaming. +If your use case falls into this category, then you can benefit greatly from using audio-only rooms in Fishjam. + +## Why Should I Care? + +Audio-only rooms are heavily discounted compared to normal rooms. +As described in more detail on the [pricing page](https://fishjam.io/#pricing), Fishjam rooms are priced based on the total connection time of peers in them. +Audio-only rooms come at a **75% discount** for both conferencing and livestreaming. + +### Conferencing + +For conferencing, the base price is $1 per 1000 participant minutes. + +For example, if you have a normal room with 10 peers connected for 100 minutes, then the total cost of the room will be $1. +If the same room were audio-only, the final cost of the room would only be $0.25. + +### Livestreaming + +For livestreaming, the base price is $0.8 per 1000 minutes of streamer and each viewer. + +In a livestream with 1 streamer and 9999 viewers, all connected for 100 minutes, the total connection time is 10,000 minutes. +For a normal livestream, this would cost $8.00. +If the same room were audio-only, the final cost would only be $2.00. + +## How Do I Use It? + +Using this feature is as easy as setting the `roomType` field when creating a room using our [Server SDKs](./server-setup). + +:::info +Attempting to stream a video while connected to an `audio_only` or `audio_only_livestream` room will result in only the audio being sent to the other peers. +::: + +### Conferencing + +Set `roomType` to `audio_only` when creating a room: + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamClient = new FishjamClient({ + fishjamId: "aaa", + managementToken: "bbb", + }); + // ---cut--- + const audioOnlyRoom = await fishjamClient.createRoom({ roomType: 'audio_only' }); + ``` + + + ```python + options = RoomOptions(room_type="audio_only") + audio_only_room = fishjam_client.create_room(options) + ``` + + + +Now, you can connect peers normally to the room as described in our [Web & Mobile connecting guide](../client/connecting). + +### Livestreaming + +Set `roomType` to `audio_only_livestream` when creating a room: + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamClient = new FishjamClient({ + fishjamId: "aaa", + managementToken: "bbb", + }); + // ---cut--- + const audioOnlyRoom = await fishjamClient.createRoom({ roomType: 'audio_only_livestream' }); + ``` + + + ```python + options = RoomOptions(room_type="audio_only_livestream") + audio_only_room = fishjam_client.create_room(options) + ``` + + + +Refer to our [Livestreaming tutorial](../../tutorials/livestreaming.mdx) to learn how to connect streamers and viewers. + +:::info +The React Native and React SDKs will log a warning in the console if any attempt to add video to an audio-only room is made. +This aims to assist in debugging, as adding video to an audio-only room has no effect and is most likely a mistake. +::: diff --git a/versioned_docs/version-0.30.0/how-to/backend/fastapi-example.mdx b/versioned_docs/version-0.30.0/how-to/backend/fastapi-example.mdx new file mode 100644 index 00000000..0163749b --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/fastapi-example.mdx @@ -0,0 +1,105 @@ +--- +sidebar_position: 1 +title: FastAPI +description: Example FastAPI server integration using the Fishjam Python SDK. +--- + +# FastAPI example + +The example assumes you've already installed [**our SDK**](https://github.com/fishjam-cloud/python-server-sdk) and you're ready to go. +If you wish to see more general info, visit [**Set up your server**](../../how-to/backend/server-setup) article. + +## Minimal setup + +The same way as in the [**FastAPI docs**](https://fastapi.tiangolo.com/tutorial/first-steps/), the code below can be copied and run immediately. +Just make sure you set `FISHJAM_ID` and `FISHJAM_MANAGEMENT_TOKEN` environment variables. +The `Depends` function allows the `FishjamClient` to be provided to the route function as a dependency, which avoids code duplication and allows easy mocking. + +```python +import os +from typing import Annotated +from fastapi import Depends, FastAPI +from fishjam import FishjamClient + + +app = FastAPI() + +def fishjam_client(): + fishjam_id = os.environ["FISHJAM_ID"] + management_token = os.environ["FISHJAM_MANAGEMENT_TOKEN"] + return FishjamClient(fishjam_id=fishjam_id, management_token=management_token) + + +@app.get("/") +async def get_rooms(fishjam_client: Annotated[FishjamClient, Depends(fishjam_client)]): + rooms = fishjam_client.get_all_rooms() + return {"rooms": rooms} +``` + +## Listening to events + +Fishjam emits messages upon certain events — see [Listening to events](../../how-to/backend/server-setup#listening-to-events) for how delivery, batching, and signing work. + +### Webhooks + +Create a dependency function that [verifies the webhook signature](../../how-to/backend/server-setup#verifying-webhook-signatures) and decodes the request body into notifications, then use pattern matching to respond to different kinds of events. + +:::note +`decode_server_notifications` replaces the now-deprecated `receive_binary`. +::: + +```python +import os +from fastapi import Depends, FastAPI, HTTPException, Request +from fishjam import decode_server_notifications, verify_webhook_signature +from fishjam.events import ServerMessagePeerAdded + +app = FastAPI() + +async def parse_fishjam_notifications(request: Request): + binary = await request.body() + signature = request.headers.get("x-fishjam-signature-256", "") + if not verify_webhook_signature(binary, signature, os.environ["FISHJAM_WEBHOOK_SECRET"]): + raise HTTPException(status_code=401, detail="Invalid webhook signature") + return decode_server_notifications(binary) + +@app.post("/fishjam-webhook") +async def fishjam_webhook(notifications = Depends(parse_fishjam_notifications)): + for notification in notifications: + match notification: + case ServerMessagePeerAdded(): + print(f"Peer added: {notification.peer_id}") + case _: + ... +``` + +### SDK Notifier + +Use the `asyncio` library to run the SDK notifier. +It doesn't interact with the FastAPI library per se, just start the event loop and it will run alongside the server. + +```python +import asyncio +from fishjam import FishjamNotifier +from fishjam.events import ServerMessagePeerAdded + +notifier = FishjamNotifier(fishjam_id=fishjam_id, management_token=management_token) + +@notifier.on_server_notification +def handle_notification(notification): + match notification: + case ServerMessagePeerAdded(): + print(f"Peer added: {notification.peer_id}") + case _: + ... + +async def run_notifier(): + notifier_task = asyncio.create_task(notifier.connect()) + + # Wait for the notifier to be ready to receive messages + await notifier.wait_ready() + + await notifier_task + +asyncio.run(run_notifier()) +``` diff --git a/versioned_docs/version-0.30.0/how-to/backend/fastify-example.mdx b/versioned_docs/version-0.30.0/how-to/backend/fastify-example.mdx new file mode 100644 index 00000000..15fe9fb8 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/fastify-example.mdx @@ -0,0 +1,258 @@ +--- +sidebar_position: 1 +title: Fastify +description: Example Fastify server integration using the Fishjam Node.js SDK. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Fastify example + +The example assumes you've already installed [**our SDK**](https://www.npmjs.com/package/@fishjam-cloud/js-server-sdk) and you're ready to go. +If you wish to see more general info, visit [**set up your server**](../../how-to/backend/server-setup) article. + +## Load environment variables to Fastify + +Use [`@fastify/env` package](https://github.com/fastify/fastify-env) to load and set environment variables in your Fastify instance. + +```ts title='main.ts' +import Fastify from "fastify"; +import fastifyEnv from "@fastify/env"; + +const fastify = Fastify(); + +const envSchema = { + type: "object", + required: ["FISHJAM_ID", "FISHJAM_MANAGEMENT_TOKEN"], + properties: { + FISHJAM_ID: { + type: "string", + }, + FISHJAM_MANAGEMENT_TOKEN: { + type: "string", + }, + }, +}; + +await fastify.register(fastifyEnv, { schema: envSchema }); + +fastify.listen({ port: 3000 }); +``` + +## Setup Fishjam Fastify plugin + +Fastify allows you to create plugins to encapsulate functionality in scopes. +Check out [fastify documentation](https://fastify.dev/docs/latest/Reference/Plugins) for a deeper understanding of the concept. + +First, extend the `FastifyInstance` interface with `fishjam` entry. +This will provide types of FishjamClient wherever you access `fastify.fishjam` in the codebase. +Then, declare the plugin by invoking the `fp` function with the setup function with as an argument. + +```ts title='fishjamPlugin.ts' +import fastifyPlugin from "fastify-plugin"; +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; + +declare module "fastify" { + interface FastifyInstance { + fishjam: FishjamClient; + config: { + FISHJAM_ID: string; + FISHJAM_MANAGEMENT_TOKEN: string; + }; + } +} + +export const fishjamPlugin = fastifyPlugin((fastify) => { + const fishjamClient = new FishjamClient({ + fishjamId: fastify.config.FISHJAM_ID, + managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN, + }); + + fastify.decorate("fishjam", fishjamClient); +}); +``` + +Now, after registering the plugin, we will be able to use Fishjam client by accessing the `fastify.fishjam` property. + +```ts title='main.ts' +import fastifyPlugin from "fastify-plugin"; +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; +import Fastify from "fastify"; + +declare module "fastify" { + interface FastifyInstance { + fishjam: FishjamClient; + config: { + FISHJAM_ID: string; + FISHJAM_MANAGEMENT_TOKEN: string; + }; + } +} + +export const fishjamPlugin = fastifyPlugin((fastify) => { + const fishjamClient = new FishjamClient({ + fishjamId: fastify.config.FISHJAM_ID, + managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN, + }); + + fastify.decorate("fishjam", fishjamClient); +}); + +const fastify = Fastify(); + +// ---cut--- +await fastify.register(fishjamPlugin); + +fastify.get("/rooms", () => fastify.fishjam.getAllRooms()); + +fastify.listen({ port: 3000 }); +``` + +## Listening to events + +Fishjam emits messages upon certain events — see [Listening to events](../../how-to/backend/server-setup#listening-to-events) for how delivery, batching, and signing work. + +### Webhooks + +Add a content type parser to your global (or scoped) Fastify instance that [verifies the webhook signature](../../how-to/backend/server-setup#verifying-webhook-signatures) and decodes the body into typed notifications. +You can then iterate over the parsed notifications at `request.body`. + +```ts title='main.ts' +import Fastify, { FastifyRequest } from "fastify"; +import { + decodeServerNotifications, + verifyWebhookSignature, + ServerNotification, +} from "@fishjam-cloud/js-server-sdk"; + +const fastify = Fastify(); + +fastify.addContentTypeParser( + "application/x-protobuf", + { parseAs: "buffer" }, + async (request: FastifyRequest, body: Buffer) => { + const signature = request.headers["x-fishjam-signature-256"]; + if ( + typeof signature !== "string" || + !verifyWebhookSignature( + body, + signature, + process.env.FISHJAM_WEBHOOK_SECRET!, + ) + ) { + throw Object.assign(new Error("Invalid webhook signature"), { + statusCode: 401, + }); + } + return decodeServerNotifications(body); + }, +); + +fastify.post<{ Body: ServerNotification[] }>("/fishjam-webhook", (request) => { + // handle each notification + for (const { type, notification } of request.body) { + console.log(type, notification); + } +}); +``` + +### SDK Notifier + +You can also leverage the Fastify plugin mechanism to use websockets to receive messages from Fishjam. +Let's create another plugin in `fishjamNotifierPlugin.ts` file. + +In this case, we don't need to extend the Fastify instance type, because the plugin doesn't decorate the Fastify instance with any properties. It will work in the background. + +```ts title='fishjamNotifierPlugin.ts' +import fastifyPlugin from "fastify-plugin"; +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; +import Fastify from "fastify"; + +declare module "fastify" { + interface FastifyInstance { + fishjam: FishjamClient; + config: { + FISHJAM_ID: string; + FISHJAM_MANAGEMENT_TOKEN: string; + }; + } +} + +export const fishjamPlugin = fastifyPlugin((fastify) => { + const fishjamClient = new FishjamClient({ + fishjamId: fastify.config.FISHJAM_ID, + managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN, + }); + + fastify.decorate("fishjam", fishjamClient); +}); + +const fastify = Fastify(); + +// ---cut--- +import { type FastifyInstance } from "fastify"; +import fp from "fastify-plugin"; +import { FishjamWSNotifier } from "@fishjam-cloud/js-server-sdk"; + +export const fishjamNotifierPlugin = fp((fastify) => { + const fishjamId = fastify.config.FISHJAM_ID; + const managementToken = fastify.config.FISHJAM_MANAGEMENT_TOKEN; + + const fishjamNotifier = new FishjamWSNotifier( + { fishjamId, managementToken }, + (err) => fastify.log.error(err), + () => fastify.log.info("Websocket connection to Fishjam closed"), + ); + + // handle the messages + const handleRoomCreated = console.log; + const handlePeerAdded = console.log; + + fishjamNotifier.on("roomCreated", handleRoomCreated); + fishjamNotifier.on("peerAdded", handlePeerAdded); +}); +``` + +Don't forget to register your plugin. + +```ts title='main.ts' +import fastifyPlugin from "fastify-plugin"; +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; +import Fastify from "fastify"; +import { FishjamWSNotifier } from "@fishjam-cloud/js-server-sdk"; + +declare module "fastify" { + interface FastifyInstance { + fishjam: FishjamClient; + config: { + FISHJAM_ID: string; + FISHJAM_MANAGEMENT_TOKEN: string; + }; + } +} + +export const fishjamPlugin = fastifyPlugin((fastify) => { + const fishjamClient = new FishjamClient({ + fishjamId: "aaa", + managementToken: "bbb", + }); + + fastify.decorate("fishjam", fishjamClient); +}); + +const fastify = Fastify(); + +const fishjamNotifierPlugin = fastifyPlugin((fastify) => { + const fishjamNotifier = new FishjamWSNotifier( + { fishjamId: "aaa", managementToken: "bbb" }, + (err) => fastify.log.error(err), + (_code, _reason) => + fastify.log.info("Websocket connection to Fishjam closed"), + ); +}); + +// ---cut--- +await fastify.register(fishjamPlugin); +await fastify.register(fishjamNotifierPlugin); +``` diff --git a/versioned_docs/version-0.30.0/how-to/backend/production-deployment.mdx b/versioned_docs/version-0.30.0/how-to/backend/production-deployment.mdx new file mode 100644 index 00000000..5d8f5ca7 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/production-deployment.mdx @@ -0,0 +1,417 @@ +--- +type: how-to +description: Deploy your Fishjam backend safely to production, moving from sandbox to a production-ready setup. +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# How to Deploy Fishjam to Production + +**How-to Guide** - _Deploy your Fishjam backend safely to production_ + +This guide covers the essential steps to move from development (using the Sandbox API) to a production-ready Fishjam backend deployment. + +## Prerequisites + +- Working Fishjam backend (see [Backend Quick Start](../../tutorials/backend-quick-start)) +- A Fishjam account on the **Standard Jar** plan (recommended for production deployments) +- Domain and SSL certificates for your backend +- Production database and infrastructure + +## Step 1: Get your Fishjam credentials + +### Get credentials from the dashboard + +1. Log in to [Fishjam Dashboard](https://fishjam.io/app) +2. Copy your **Fishjam ID** and **Management Token** from the dashboard + +### Environment variables setup + +Create your environment variables: + +```bash +# Fishjam credentials +FISHJAM_ID="your-fishjam-id" +FISHJAM_MANAGEMENT_TOKEN="your-management-token" + +# Your application settings +NODE_ENV="production" +PORT="3000" +DATABASE_URL="your-production-database-url" + +# Security settings +JWT_SECRET="your-secure-jwt-secret" +CORS_ORIGIN="https://yourdomain.com" +``` + +## Step 2: Replace Sandbox API with proper authentication + +### Replace Sandbox API calls + +Remove any Sandbox API dependencies from your client code: + +```typescript +// @noErrors: 2451 +import { useSandbox } from "@fishjam-cloud/react-client"; +import express from "express"; + +const authenticateUser = {} as any; +const app = express(); + +const sandboxApiUrl = "your-sandbox-api-url-here"; +const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl }); + +const userToken = ""; +const roomName = ""; +const userName = ""; + +// ---cut--- +// ❌ Remove: Sandbox API calls +const peerToken = await getSandboxPeerToken(roomName, userName); + +// ✅ Replace with: Your authenticated API +const response = await fetch("https://your-backend.com/api/join-room", { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${userToken}`, + }, + body: JSON.stringify({ roomName, userName }), +}); +``` + +### Implement user authentication + +Wire up the Fishjam client and your own authentication. The middleware below verifies the caller and attaches the user, so the next handler can mint a peer token for them. + + + + + ```typescript + // @noErrors: 2339 + const jwt = {} as any; + import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; + import express from "express"; + + process.env.FISHJAM_ID = ""; + process.env.FISHJAM_MANAGEMENT_TOKEN = ""; + process.env.JWT_SECRET = ""; + + // ---cut--- + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, + }); + + const app = express(); + app.use(express.json()); // parse JSON request bodies + + // Your own auth (JWT, session, ...) + const authenticateUser = async ( + req: express.Request, + res: express.Response, + next: express.NextFunction, + ) => { + const token = req.headers.authorization?.replace("Bearer ", ""); + if (!token) return res.status(401).json({ error: "Unauthorized" }); + + req.user = jwt.verify(token, process.env.JWT_SECRET); + next(); + }; + ``` + + + + + + ```python + import os + import jwt + from fastapi import Body, Depends, FastAPI, Header, HTTPException + from fishjam import FishjamClient, PeerOptions + + app = FastAPI() + + fishjam_client = FishjamClient( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_MANAGEMENT_TOKEN"], + ) + + # Your own auth (JWT, session, ...) + async def authenticate_user(authorization: str = Header()): + token = authorization.removeprefix("Bearer ") + try: + return jwt.decode(token, os.environ["JWT_SECRET"], algorithms=["HS256"]) + except jwt.InvalidTokenError: + raise HTTPException(status_code=401, detail="Unauthorized") + ``` + + + + +### Create a room and add a peer + +Now expose the endpoint your client calls to join the room. Fishjam rooms are identified by an `id`, so keep a mapping from your own room name to the Fishjam room id and create the room lazily on first join. Then add a peer tagged with the authenticated user and return its peer token. + + + + + ```typescript + // @noErrors: 2339 + import { FishjamClient, RoomId } from "@fishjam-cloud/js-server-sdk"; + import express from "express"; + + const app = express(); + declare const fishjamClient: FishjamClient; + declare const authenticateUser: express.RequestHandler; + + // ---cut--- + // Map your room name to a Fishjam room id (use your database in production) + const roomIds = new Map(); + + const getOrCreateRoom = async (roomName: string): Promise => { + const existing = roomIds.get(roomName); + if (existing) return existing; + + const room = await fishjamClient.createRoom(); + roomIds.set(roomName, room.id); + return room.id; + }; + + // Mint a Fishjam peer token for the authenticated user + app.post("/api/join-room", authenticateUser, async (req, res) => { + const { roomName } = req.body; + const roomId = await getOrCreateRoom(roomName); + + const { peerToken } = await fishjamClient.createPeer(roomId, { + metadata: { userId: req.user.userId }, + }); + res.json({ peerToken }); + }); + ``` + + + + + + ```python + # Map your room name to a Fishjam room id (use your database in production) + room_ids: dict[str, str] = {} + + def get_or_create_room(room_name: str) -> str: + room_id = room_ids.get(room_name) + if room_id is not None: + return room_id + room = fishjam_client.create_room() + room_ids[room_name] = room.id + return room.id + + # Mint a Fishjam peer token for the authenticated user + @app.post("/api/join-room") + async def join_room(room_name: str = Body(embed=True), user=Depends(authenticate_user)): + room_id = get_or_create_room(room_name) + options = PeerOptions(metadata={"userId": user["userId"]}) + _, peer_token = fishjam_client.create_peer(room_id, options) + return {"peerToken": peer_token} + ``` + + + + +## (Optional) Step 3: Handle webhooks and events + +You may wish to receive events from Fishjam regarding created rooms and peers. +All you need for this is a single api endpoint: + +### Webhook endpoint + +Fishjam delivers notifications as a binary `application/x-protobuf` body. Read the raw body, [verify the webhook signature](../../how-to/backend/server-setup#verifying-webhook-signatures), and decode it with the SDK, then react to the events you care about. Store your webhook secret as `FISHJAM_WEBHOOK_SECRET`. + + + + + ```typescript + import express from "express"; + import { + decodeServerNotifications, + verifyWebhookSignature, + } from "@fishjam-cloud/js-server-sdk"; + + const app = express(); + const handlePeerConnected = {} as any; + const handlePeerDisconnected = {} as any; + const handleRoomDeleted = {} as any; + + // ---cut--- + app.post( + "/api/webhooks/fishjam", + express.raw({ type: "application/x-protobuf" }), + (req: express.Request, res: express.Response) => { + const signature = req.headers["x-fishjam-signature-256"]; + if ( + typeof signature !== "string" || + !verifyWebhookSignature( + req.body, + signature, + process.env.FISHJAM_WEBHOOK_SECRET!, + ) + ) { + return res.status(401).json({ error: "Invalid signature" }); + } + + for (const { type, notification } of decodeServerNotifications(req.body)) { + switch (type) { + case "peerConnected": + handlePeerConnected(notification); + break; + case "peerDisconnected": + handlePeerDisconnected(notification); + break; + case "roomDeleted": + handleRoomDeleted(notification); + break; + default: + break; + } + } + + res.status(200).json({ received: true }); + }, + ); + ``` + + + + + + ```python + import os + from fastapi import FastAPI, HTTPException, Request + from fishjam import decode_server_notifications, verify_webhook_signature + from fishjam.events import ( + ServerMessagePeerConnected, + ServerMessagePeerDisconnected, + ServerMessageRoomDeleted, + ) + + app = FastAPI() + + @app.post("/api/webhooks/fishjam") + async def fishjam_webhook(request: Request): + raw_body = await request.body() + signature = request.headers.get("x-fishjam-signature-256", "") + if not verify_webhook_signature(raw_body, signature, os.environ["FISHJAM_WEBHOOK_SECRET"]): + raise HTTPException(status_code=401, detail="Invalid signature") + + for notification in decode_server_notifications(raw_body): + match notification: + case ServerMessagePeerConnected(): + handle_peer_connected(notification) + case ServerMessagePeerDisconnected(): + handle_peer_disconnected(notification) + case ServerMessageRoomDeleted(): + handle_room_deleted(notification) + case _: + ... + return {"received": True} + ``` + + + + +### Enabling webhooks + +Now, with your endpoint set up, register its URL in the **Webhooks** tab of the [Fishjam Dashboard](https://fishjam.io/app). Fishjam then delivers all notifications to that endpoint. We also recommend enabling [notification batching](../../how-to/backend/server-setup#webhooks) when creating rooms: + + + + + ```typescript + import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; + const fishjamClient = {} as any; + + // ---cut--- + const createBatchedRoom = async (roomType = "conference") => { + const room = await fishjamClient.createRoom({ + roomType, + // Coalesce notifications into batches for faster delivery and fewer requests + batchWebhookNotifications: true, + }); + + return room; + }; + ``` + + + + + + ```python + import os + from fishjam import FishjamClient, RoomOptions + + fishjam_client = FishjamClient( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_MANAGEMENT_TOKEN"], + ) + + def create_batched_room(room_type="conference"): + options = RoomOptions( + room_type=room_type, + # Coalesce notifications into batches for faster delivery and fewer requests + batch_webhook_notifications=True, + ) + return fishjam_client.create_room(options) + ``` + + + + +## Common production issues + +### Issue: Token expiration handling + +Peer tokens expire 24h after creation. +We encourage keeping room and peer lifetimes as short as possible +(typically a single room corresponds to a single video call or stream). +However, if you wish to reuse a single peer over multiple days, you can make use of token refreshing: + + + + + ```ts + import { FishjamClient, RoomId, PeerId } from "@fishjam-cloud/js-server-sdk"; + const fishjamClient = new FishjamClient({ + fishjamId: "", + managementToken: "", + }); + const roomId = "" as RoomId; + const peerId = "" as PeerId; + + // ---cut--- + const newToken = fishjamClient.refreshPeerToken(roomId, peerId); + ``` + + + + + + ```python + new_token = fishjam_client.refresh_peer_token(room_id, peer_id) + ``` + + + + +## See also + +For scaling considerations: + +- [Understanding Fishjam Architecture](../../explanation/architecture) +- [Security best practices](../../explanation/security-tokens) + +For specific backend frameworks: + +- [FastAPI example](../../how-to/backend/fastapi-example) +- [Fastify example](../../how-to/backend/fastify-example) diff --git a/versioned_docs/version-0.30.0/how-to/backend/sandbox-api-testing.mdx b/versioned_docs/version-0.30.0/how-to/backend/sandbox-api-testing.mdx new file mode 100644 index 00000000..69101006 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/sandbox-api-testing.mdx @@ -0,0 +1,333 @@ +--- +sidebar_position: 5 +description: Use the Sandbox API to create rooms and peers for testing without setting up your own backend server. +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# Testing with the Sandbox API + +The Sandbox API is a development tool that lets you create rooms and peers for testing without setting up your own backend server. This guide shows you how to use it effectively. + +## Prerequisites + +- Access to [Fishjam Dashboard](https://fishjam.io/app) + +## Step 1: Get your Fishjam ID and Sandbox API URL + +1. Log in to [Fishjam Dashboard](https://fishjam.io/app) +2. Navigate to the [Sandbox tab](https://fishjam.io/app/sandbox) +3. Copy your **Fishjam ID** +4. In the **Sandbox API** section, copy your **Sandbox API URL** + +:::note +You need both values for React/React Native apps: + +- `Sandbox API url` is used to call the Sandbox API to create test rooms and return peer tokens. +- `Fishjam ID` is passed to `FishjamProvider` so the client can connect to the Fishjam media server after it gets a peer token. + +::: + +## Step 2: Create a room and get peer tokens + +### With the `useSandbox` hook + + + + + ```ts + const FISHJAM_ID = "..."; + const roomName = "testRoom"; + const peerName = "testUser"; + // ---cut--- + import { useSandbox } from '@fishjam-cloud/react-native-client'; + + // ... + + const SANDBOX_API_URL = "your-sandbox-api-url-here"; + const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); + const peerToken = await getSandboxPeerToken(roomName, peerName); + ``` + + + + + + ```ts + const roomName = "testRoom"; + const peerName = "testUser"; + // ---cut--- + import { useSandbox } from '@fishjam-cloud/react-client'; + + // ... + + const SANDBOX_API_URL = "your-sandbox-api-url-here"; + const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); + const peerToken = await getSandboxPeerToken(roomName, peerName); + ``` + + + + +### Required parameters + +- `roomName` - Name of the room to create/join +- `peerName` - Name for the peer joining the room + +### Optional parameters + +- `roomType` - Type of room to create (defaults to `conference`) + +### Room types available + +- `conference` - For video/audio conferencing (default) +- `audio_only` - For audio-only conferencing +- `livestream` - For one-to-many video/audio streaming + +## Step 3: Handle the response + +The Sandbox API returns a JSON response with connection details: + +```json +{ + "peerToken": "", + "room": { + "id": "", + "name": "foo" + }, + "peer": { + "id": "", + "name": "bar" + } +} +``` + +## Step 4: Use the tokens in your client app + +Below are examples on how to use tokens from the Sandbox API in your frontend applications: + + + + + ```tsx + import React, { useEffect, useState } from "react"; + import { Text } from "react-native"; + + const roomName = "testRoom"; + const peerName = `user_${Date.now()}`; + const FISHJAM_ID = "..."; + const SANDBOX_API_URL = "..."; + + const RoomView = (props: {peerToken: string}) => null; + // ---cut--- + import { useSandbox } from "@fishjam-cloud/react-native-client"; + + export default function TestScreen() { + const [peerToken, setPeerToken] = useState(null); + // fishjamId is provided through FishjamProvider + const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); + + useEffect(() => { + const fetchPeerToken = async () => { + try { + const token = await getSandboxPeerToken(roomName, peerName); + setPeerToken(token); + } catch (error) { + console.error("Failed to create room:", error); + } + }; + + fetchPeerToken(); + }, []); + + if (!peerToken) { + return Creating room...; + } + + return ( + + ); + } + ``` + + + + + + ```tsx + import React, { useState, useEffect } from "react"; + + const FISHJAM_ID = "your-fishjam-id-here"; + const SANDBOX_API_URL = "your-sandbox-api-url-here"; + // ---cut--- + import { FishjamProvider, useConnection, useSandbox } from "@fishjam-cloud/react-client"; + + function VideoCallComponent() { + const { joinRoom, peerStatus } = useConnection(); + const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); + + const handleJoinRoom = async () => { + const roomName = "testRoom"; + const peerName = `user_${Date.now()}`; + + try { + const peerToken = await getSandboxPeerToken(roomName, peerName) + await joinRoom({ peerToken }); + } catch (error) { + console.error("Failed to join room:", error); + } + }; + + const isConnected = peerStatus === "connected"; + + return ( +
+ {isConnected ?

Connected to room!

: } +
+ ); + } + + export default function App() { + return ( + + + + ); + } + ``` + +
+
+ +## Step 5: Test different room types + +### Testing audio-only rooms + +```ts +import { useSandbox } from "@fishjam-cloud/react-client"; +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); +// ---cut--- +const audioOnlyPeerToken = await getSandboxPeerToken( + "audioTest", + "user1", + "audio_only", +); +``` + +### Testing livestream rooms + +```ts +import { useSandbox } from "@fishjam-cloud/react-client"; +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +const { getSandboxLivestream, getSandboxViewerToken } = useSandbox({ + sandboxApiUrl: SANDBOX_API_URL, +}); +// ---cut--- + +const livestreamName = "livestream1"; +// For the streamer +const streamerData = await getSandboxLivestream(livestreamName); + +// For viewers, you need a viewer token (different endpoint) +const viewerToken = await getSandboxViewerToken(livestreamName); +``` + +## Step 6: Handle multiple peers + +To test with multiple participants, create multiple peer tokens with different peer names: + +```ts +import { useSandbox } from "@fishjam-cloud/react-client"; +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); +// ---cut--- +// First peer +const peer1Response = await getSandboxPeerToken("multiTest", "alice"); + +// Second peer +const peer2Response = await getSandboxPeerToken("multiTest", "bob"); +``` + +Both peers will join the same room (`multiTest`) and can communicate with each other. + +## Common testing patterns + +### Pattern 1: Random room names for isolation + +```ts +const roomName = `test_${Math.random().toString(36).substring(7)}`; +const peerName = `user_${Date.now()}`; +``` + +### Pattern 2: Consistent naming for repeated tests + +```ts +// @noErrors: 2451 +const roomName = "development-room"; +const peerName = `developer_1`; +``` + +### Pattern 3: Feature-specific room names + +```ts +// @noErrors: 2451 +const roomName = `screenshare-test-${Date.now()}`; +const roomName = `audio-only-test`; +const roomName = `livestream-demo`; +``` + +## Troubleshooting + +### Issue: Room not found errors + +**Problem**: Rooms might not persist between requests. + +**Solution**: Always create rooms fresh for each test session. + +### Issue: Connection failures + +**Problem**: Invalid Fishjam ID, invalid Sandbox API URL, disabled Sandbox API, or network issues. + +**Solution**: + +1. Verify your Fishjam ID in the Fishjam Dashboard. +2. Verify your Sandbox API URL in the [Sandbox tab](https://fishjam.io/app/sandbox). +3. Make sure the Sandbox API is enabled. +4. Check network connectivity. + +## Security reminder + +:::danger +**The Sandbox API is not safe for production!** + +- No authentication required +- Anyone with your Sandbox API URL can create rooms and peer tokens +- Identical room/peer names get the same tokens +- No rate limiting or abuse protection + +Only use the Sandbox API for development and testing. +::: + +## Managing your Sandbox API + +Manage the Sandbox API from the [Sandbox tab](https://fishjam.io/app/sandbox): + +- If your Sandbox API URL is exposed or credentials are compromised, click **Generate new URL**. This invalidates the old URL. +- If you want to stop using it, click **Disable Sandbox API**. +- When you want to use it again, click **Enable Sandbox API**. + Your `FISHJAM_ID` is still required by `FishjamProvider` to connect to the Fishjam media server. The Sandbox API URL is only used to request test room and peer tokens. + +## Next steps + +Once you've tested your integration with the Sandbox API: + +- [Set up your own backend](../../tutorials/backend-quick-start) +- [Learn more about the Sandbox API](../../explanation/sandbox-api-concept) +- [Understand security implications](../../explanation/security-tokens) + +For production deployment: + +- [How to set up a production server](./server-setup) +- [How to implement proper authentication](../../explanation/security-tokens) diff --git a/versioned_docs/version-0.30.0/how-to/backend/selective-subscriptions.mdx b/versioned_docs/version-0.30.0/how-to/backend/selective-subscriptions.mdx new file mode 100644 index 00000000..8cbbc386 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/selective-subscriptions.mdx @@ -0,0 +1,331 @@ +--- +title: Selective Subscriptions +sidebar_position: 7 +description: Configure manual subscription mode so your backend controls which peers receive which streams. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Selective Subscriptions + +In Fishjam, peers in a conferencing room automatically subscribe to every other peer by default. +Selective Subscriptions let you break from that — giving your backend the ability to decide who receives what. + +In **manual subscription mode**, a peer or agent: + +- does not automatically receive **any tracks**, and +- can **explicitly subscribe** to specific tracks from other peers. + +## When to use Selective Subscriptions + +- large-scale rooms with dozens or hundreds of peers, +- “stage & audience” models (viewers only see speakers), +- bandwidth optimization (e.g., audio-only dashboards, or delayed video activation). + +--- + +## Core idea + +- Peers have a `subscribeMode` — either **`auto`** or **`manual`**. +- Peers in **auto** mode subscribe to everyone automatically (default behavior). +- Peers in **manual** mode will **not** receive any media until you explicitly subscribe them using the **Server SDK**. +- Peers in manual mode can subscribe to: + - another **peer** (all of its tracks), or + - specific **tracks** of another peer. + +--- + +## Step 1 — Create a peer with `manual` subscription mode + +When creating a peer, set `subscribeMode` to `"manual"`. +This peer will start with zero subscriptions — it will not receive anyone’s audio or video. + + + + +```ts +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); + +// ---cut--- + +// Create a conference room +const room = await fishjamClient.createRoom({ + roomType: "conference", +}); + +// Create a normal publisher +const { peer: publisher } = await fishjamClient.createPeer(room.id, { + subscribeMode: "auto", +}); + +// Create a manual subscriber +const { peer: viewer } = await fishjamClient.createPeer(room.id, { + subscribeMode: "manual", +}); +``` + + + + +from fishjam import RoomOptions, PeerOptions + +```python +room_options = RoomOptions(room_type="conference") +room = fishjam_client.create_room(room_options) + +# Create a manual subscriber +peer_options = PeerOptions(subscribe_mode="manual") +publisher = fishjam_client.create_peer(room.id, peer_options) +viewer = fishjam_client.create_peer(room.id, peer_options) + +``` + + + + +--- + +## Step 2 — Subscribe a peer to another peer + +Use this when you want your manual subscriber to receive **all tracks** published by another peer. + + + + +```ts +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); + +const room = await fishjamClient.createRoom({ + roomType: "conference", +}); + +const { peer: publisher } = await fishjamClient.createPeer(room.id, { + subscribeMode: "auto", +}); + +const { peer: subscriber } = await fishjamClient.createPeer(room.id, { + subscribeMode: "manual", +}); + +// ---cut--- +// Subscribe viewer to everything published by publisher +await fishjamClient.subscribePeer(room.id, subscriber.id, publisher.id); +``` + + + + + +```python +fishjam_client.subscribe_peer(room.id, viewer_id, publisher_id) +``` + + + + +This will make **every current and future track** of the publisher available to the subscriber. +It’s additive — the subscriber can listen to multiple publishers at once. + +--- + +## Step 3 — Subscribe to specific tracks + +Sometimes you only want a subset of a publisher’s tracks, for example: + +- their **screenshare**, but not their camera, +- only **audio**, without video. + + + + +```ts +import { FishjamClient, type TrackId } from "@fishjam-cloud/js-server-sdk"; +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); + +const room = await fishjamClient.createRoom({ + roomType: "conference", +}); + +const { peer: publisher } = await fishjamClient.createPeer(room.id, { + subscribeMode: "auto", +}); + +const { peer: subscriber } = await fishjamClient.createPeer(room.id, { + subscribeMode: "manual", +}); + +// ---cut--- +// Get track IDs from your room state or webhook events +const audioTrackId = "track_audio_abc" as TrackId; +const screenTrackId = "track_screen_xyz" as TrackId; + +// Subscribe to a single track +await fishjamClient.subscribeTracks(room.id, subscriber.id, [audioTrackId]); + +// Or multiple +await fishjamClient.subscribeTracks(room.id, subscriber.id, [ + audioTrackId, + screenTrackId, +]); +``` + + + + + +```python +audio_track_id = "track_audio_abc" +screen_track_id = "track_screen_xyz" + +# Subscribe to one track +fishjam_client.subscribe_tracks(room.id, subscriber_id, [audio_track_id]) + +# Or multiple +fishjam_client.subscribe_tracks(room.id, subscriber_id, [audio_track_id, screen_track_id]) +``` + + + + +:::note +📘 Track IDs are available from [Fishjam’s events in your backend](/how-to/backend/server-setup#listening-to-events). +::: + +--- + +## Step 4 — Combine multiple publishers + +A manual peer can subscribe to **several** publishers at once. +Each call to `subscribePeer` adds more publishers — it doesn’t overwrite the previous ones. + + + + +```ts +import { FishjamClient, type PeerOptions } from "@fishjam-cloud/js-server-sdk"; +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); + +const room = await fishjamClient.createRoom({ + roomType: "conference", +}); + +// ---cut--- +const options = { subscribeMode: "manual" } satisfies PeerOptions; + +const { peer: subscriber } = await fishjamClient.createPeer(room.id, options); +const { peer: publisherA } = await fishjamClient.createPeer(room.id, options); +const { peer: publisherB } = await fishjamClient.createPeer(room.id, options); + +// Subscribe subscriber to two publishers +await fishjamClient.subscribePeer(room.id, subscriber.id, publisherA.id); +await fishjamClient.subscribePeer(room.id, subscriber.id, publisherB.id); +``` + + + + + +```python +fishjam_client.subscribe_peer(room.id, subscriber_id, publisher_a_id) +fishjam_client.subscribe_peer(room.id, subscriber_id, publisher_b_id) +``` + + + + +The subscriber now receives tracks from **both** publishers simultaneously. + +--- + +## Step 5 — Example: curated stage & audience + +You can implement a “stage” system where: + +- speakers are in auto mode (they see/hear each other), +- audience members are manual subscribers (they only see the stage). + + + + +```ts +import { FishjamClient, type Peer } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); + +const room = await fishjamClient.createRoom({ + roomType: "conference", +}); + +const { peer: publisher } = await fishjamClient.createPeer(room.id, { + subscribeMode: "auto", +}); + +// ---cut--- + +// fetch room to get actual list of peers +const fetchedRoom = await fishjamClient.getRoom(room.id); +const currentSpeakers = fetchedRoom.peers; + +// audience joins in manual mode +const { peer: audience } = await fishjamClient.createPeer(room.id, { + subscribeMode: "manual", +}); + +// subscribe them to all current speakers +await Promise.all( + currentSpeakers.map((speaker) => + fishjamClient.subscribePeer(room.id, audience.id, speaker.id), + ), +); +``` + + + + + +```python + +audience = fishjam_client.create_peer(room.id, PeerOptions(subscribe_mode="manual")) +current_speakers = fishjam_client.get_room(room.id).peers +# audience peer already exists (manual) +for speaker in current_speakers: + fishjam_client.subscribe_peer(room.id, audience.id, speaker.id) +``` + + + + +As new speakers join, simply call `subscribe_peer` again to add them to the audience’s feed. + +--- + +:::note +Unsubscribe support is not yet implemented (for now, just remove peer sessions when needed). +::: + +## See also + +- [Rooms](../../explanation/rooms) +- [React quick start](../../tutorials/react-quick-start) +- [React Native quick start](../../tutorials/react-native-quick-start) + +> 🗒️ For server-side recording or media processing, see [Agents](../../tutorials/agents.mdx) (documented separately). diff --git a/versioned_docs/version-0.30.0/how-to/backend/server-setup.mdx b/versioned_docs/version-0.30.0/how-to/backend/server-setup.mdx new file mode 100644 index 00000000..71dedaf1 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/server-setup.mdx @@ -0,0 +1,427 @@ +--- +sidebar_position: 0 +description: Install and configure a Fishjam server SDK for Node.js or Python, or integrate via the bare REST API. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Set up your server + +## Install the SDK + +Install the SDK for the language of your choice. We provide libraries for [**Node**](https://github.com/fishjam-cloud/js-server-sdk) and [**Python**](https://github.com/fishjam-cloud/python-server-sdk). +It's also possible to use the bare REST API, in this case you can skip this step. + + + + + ```bash + npm install @fishjam-cloud/js-server-sdk + ``` + + + + + + ```bash + yarn add @fishjam-cloud/js-server-sdk + ``` + + + + + + ```bash + pip install fishjam-server-sdk + ``` + + + + + + ```bash + poetry add fishjam-server-sdk + ``` + + + + + + ```bash + uv add fishjam-server-sdk + ``` + + + + +## Setup your client + +Let's setup everything you need to start communicating with a Fishjam instance. +First of all, view your app in the [**Fishjam developer panel**](https://fishjam.io/app) and copy your **Fishjam ID** and the **Management Token**. +They are required to proceed. Now, we are ready to dive into the code. + +`FishjamClient.create` constructs the client and pings the Fishjam backend with the supplied credentials, so a bad `fishjamId` or `managementToken` fails at startup instead of on the first room operation. + + + + + ```ts + process.env.FISHJAM_ID = "aaa"; + process.env.FISHJAM_MANAGEMENT_TOKEN = "bbb"; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + let fishjamClient = await FishjamClient.create({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, + }); + + // The above is roughly equivalent to: + fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, + }); + await fishjamClient.checkCredentials(); + ``` + + + + + + ```python + import os + from fishjam import FishjamClient + + fishjam_client = FishjamClient.create_and_verify( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_MANAGEMENT_TOKEN"], + ) + + # The above is roughly equivalent to: + fishjam_client = FishjamClient(...) + fishjam_client.check_credentials() + ``` + + + + +### Managing rooms + +Create a room to get the `roomId` and be able to start adding peers. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamClient = new FishjamClient({ + + fishjamId: "https://fishjam.io", + managementToken: "bbb", + }); + // ---cut--- + const createdRoom = await fishjamClient.createRoom(); + + const theSameRoom = await fishjamClient.getRoom(createdRoom.id); + + await fishjamClient.deleteRoom(theSameRoom.id) + + // puff, it's gone! + ``` + + + + + + ```python + created_room = fishjam_client.create_room() + + the_same_room = fishjam_client.get_room(created_room.id) + + fishjam_client.delete_room(the_same_room.id) + + # puff, it's gone! + ``` + + + + + +### Managing peers + +Create a peer to obtain the peer token allowing your user to join the room. +At any time you can terminate user's access by deleting the peer. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamClient = new FishjamClient({ + fishjamId: "https://fishjam.io", + managementToken: "bbb", + }); + const created_room = await fishjamClient.createRoom(); + // ---cut--- + const { peer, peerToken } = await fishjamClient.createPeer(created_room.id); + + await fishjamClient.deletePeer(created_room.id, peer.id); + ``` + + + + + + ```python + peer, token = fishjam_client.create_peer(room_id) + + fishjam_client.delete_peer(room_id, peer.id) + ``` + + + + + +#### Metadata + +When creating a peer, you can also assign metadata to that peer, which can be read later with the [client SDK](../../how-to/client/metadata). This metadata can be only set when creating the peer and can't be updated later. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamClient = new FishjamClient({ + fishjamId: "https://fishjam.io", + managementToken: "bbb", + }); + const created_room = await fishjamClient.createRoom(); + // ---cut--- + const { peer, peerToken } = await fishjamClient.createPeer(created_room.id, { + metadata: { realName: 'Tom Reeves' }, + }); + ``` + + + + + + ```py + options = PeerOptions( + metadata={"realName": "Tom Reeves"}, + ) + peer, token = self.fishjam_client.create_peer(room_id, options=options) + ``` + + + + +## Listening to events + +Fishjam instance is a stateful server that is emitting messages upon certain events. +You can listen for those messages and react as you prefer. +There are two options to obtain these. + +### Webhooks + +Configure your webhook URL in the **Webhooks** tab of the [Fishjam Dashboard](https://fishjam.io/app). Fishjam then delivers all notifications to that URL. + +We recommend also enabling **notification batching** when creating a room. Fishjam then coalesces several notifications into a single request, delivering them faster and with fewer HTTP requests — which improves your backend's response time under load. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId: "https://fishjam.io", + managementToken: "bbb", + }); + // ---cut--- + await fishjamClient.createRoom({ batchWebhookNotifications: true }); + ``` + + + + + + ```python + from fishjam import RoomOptions + + options = RoomOptions( + batch_webhook_notifications=True, + ) + + fishjam_client.create_room(options) + ``` + + + + + +On the receiving side, decode the raw request body with the SDK's decoder, then iterate the result and react to the events you care about. The decoder returns a list of notifications and transparently unwraps a batch — a single notification simply comes back as a one-element list, so the same handler works whether or not batching is enabled. + + + + + ```ts + import { decodeServerNotifications } from '@fishjam-cloud/js-server-sdk'; + + declare const rawBody: Buffer; + // ---cut--- + for (const { type, notification } of decodeServerNotifications(rawBody)) { + switch (type) { + case 'peerConnected': + console.log(`Peer ${notification.peerId} joined room ${notification.roomId}`); + break; + case 'peerDisconnected': + console.log(`Peer ${notification.peerId} left room ${notification.roomId}`); + break; + case 'roomCreated': + console.log(`Room ${notification.roomId} created`); + break; + default: + break; + } + } + ``` + + + + + + ```python + from fishjam import decode_server_notifications + from fishjam.events import ( + ServerMessagePeerConnected, + ServerMessagePeerDisconnected, + ServerMessageRoomCreated, + ) + + for notification in decode_server_notifications(raw_body): + match notification: + case ServerMessagePeerConnected(): + print(f"Peer {notification.peer_id} joined room {notification.room_id}") + case ServerMessagePeerDisconnected(): + print(f"Peer {notification.peer_id} left room {notification.room_id}") + case ServerMessageRoomCreated(): + print(f"Room {notification.room_id} created") + case _: + ... + ``` + + + + + +#### Verifying webhook signatures + +Every webhook request is signed so you can confirm it really came from Fishjam. Each delivery carries an `x-fishjam-signature-256: sha256=` header — an HMAC-SHA256 of the **raw request body**, keyed with your webhook secret. Find (and rotate) that secret in the **Webhooks** tab of the [Fishjam Dashboard](https://fishjam.io/app). + +Verify the header against the raw body **before** decoding, and reject mismatches with `401`. Verification needs the exact bytes Fishjam sent, so read the raw body before any parsing. + + + + + ```ts + declare const rawBody: Buffer; + declare const signatureHeader: string; + // ---cut--- + import { verifyWebhookSignature, decodeServerNotifications } from '@fishjam-cloud/js-server-sdk'; + + const secret = process.env.FISHJAM_WEBHOOK_SECRET!; + + // rawBody: Buffer, signatureHeader: req.headers['x-fishjam-signature-256'] + if (!verifyWebhookSignature(rawBody, signatureHeader, secret)) { + // respond with 401 here — how depends on your framework, see the examples linked below + throw new Error('Invalid webhook signature'); + } + + // signature is valid — safe to decode + const notifications = decodeServerNotifications(rawBody); + ``` + + + + + + ```python + import os + from fishjam import verify_webhook_signature, decode_server_notifications + + secret = os.environ["FISHJAM_WEBHOOK_SECRET"] + + # raw_body: bytes, signature_header: request.headers["x-fishjam-signature-256"] + if not verify_webhook_signature(raw_body, signature_header, secret): + # respond with 401 here — how depends on your framework, see the examples linked below + raise PermissionError("Invalid webhook signature") + + # signature is valid — safe to decode + notifications = decode_server_notifications(raw_body) + ``` + + + + + +See the [Fastify](../../how-to/backend/fastify-example#webhooks) and [FastAPI](../../how-to/backend/fastapi-example#webhooks) examples for a full webhook handler wired into a web framework. + +### SDK Notifier + +Our SDKs come equipped with a Notifier allowing you to subscribe for messages. +It sets up a websocket connection with a Fishjam instance and provides a simple interface allowing you to handle messages. + + + + + ```ts + const fishjamId = "https://fishjam.io"; + const managementToken = "bbb"; + // ---cut--- + import { FishjamWSNotifier } from '@fishjam-cloud/js-server-sdk'; + + const onClose = console.log; + const onError = console.error; + const onConnectionFailed = console.error; + + const fishjamNotifier = new FishjamWSNotifier({ fishjamId, managementToken }, onError, onClose); + + fishjamNotifier.on('roomCreated', console.log); + ``` + + + + + + ```python + import asyncio + from fishjam import FishjamNotifier + from fishjam.events import ServerMessageRoomCreated + + notifier = FishjamNotifier(fishjam_id, management_token) + + @notifier.on_server_notification + def handle_notification(notification): + match notification: + case ServerMessageRoomCreated(): + print(notification) + case _: + ... + + async def run_notifier(): + notifier_task = asyncio.create_task(notifier.connect()) + + # Wait for notifier to be ready to receive messages + await notifier.wait_ready() + + await notifier_task + + asyncio.run(run_notifier()) + ``` + + + + diff --git a/versioned_docs/version-0.30.0/how-to/backend/whip-whep.mdx b/versioned_docs/version-0.30.0/how-to/backend/whip-whep.mdx new file mode 100644 index 00000000..a5b61c6c --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/backend/whip-whep.mdx @@ -0,0 +1,229 @@ +--- +title: WHIP/WHEP with Fishjam +sidebar_position: 8 +description: Publish and receive Fishjam livestreams directly using the WHIP and WHEP protocols. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Livestreaming using WHIP/WHEP + +:::tip +Make sure to read [Livestreaming with Fishjam](../../tutorials/livestreaming) before reading this guide. +This guide focuses on a low-level way to communicate with Fishjam. + +The majority of use-cases should prefer to use the methods described in [Livestreaming with Fishjam](../../tutorials/livestreaming). +::: + +If you've reading this guide, it is more than likely that you've already heard of **WHIP** (WebRTC HTTP Ingress Protocol) and **WHEP** (WebRTC HTTP Egress Protocol). +If not, then we recommend to read our [article about WHIP/WHEP](https://blog.swmansion.com/building-interactive-streaming-apps-webrtc-whip-whep-explained-d38f4825ec90). +In short, these are two protocols which standardize real-time livestreaming. +This prevents vendor lock-in and allows implementations and solutions to be reused in different scenarios. + +Fishjam supports both WHIP and WHEP, so you can choose how to publish and receive streams. +For example, you can use [OBS Studio](https://obsproject.com/) to publish a livestream with WHIP and then receive the stream using any public online WHEP player you like. + +## WHIP with Fishjam + +WHIP is the protocol used by streamers to start publishing. +To use WHIP you need two things: + +1. The URL of an HTTP endpoint implementing the WHIP specification. +2. A token, used by the endpoint to authorize the streamer. + +### Getting the URL + +Fishjam's WHIP endpoint is available at + +```sh +https://fishjam.io/api/v1/live/api/whip +``` + +You can paste this URL in your WHIP client of choice to start streaming. + +### Getting the token + +To authenticate a streamer, you need to first create a room of type `livestream` and a streamer token for that room. +You can read about this in detail in [Production Livestreaming with Server SDKs](../../tutorials/livestreaming#production-livestreaming-with-server-sdks), but the TL;DR is + + + + + ```ts + const fishjamId = ""; + const managementToken = ""; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId, + managementToken, + }); + + const room = await fishjamClient.createRoom({ roomType: 'livestream' }); + const { token: streamerToken } = await fishjamClient.createLivestreamStreamerToken(room.id); // [!code highlight] + ``` + + + + + + ```python + from fishjam import FishjamClient, RoomOptions + + fishjam_client = FishjamClient( + fishjam_id=fishjam_id, + management_token=management_token, + ) + + room = fishjam_client.create_room(RoomOptions(room_type="livestream")) + streamer_token = fishjam_client.create_livestream_streamer_token(room.id) # [!code highlight] + ``` + + + + +The created streamer token must be supplied in the HTTP headers of the WHIP request: + +```sh +POST https://fishjam.io/api/v1/live/api/whip +Authorization: Bearer [STREAMER-TOKEN] +``` + +## WHEP with Fishjam + +WHEP is the protocol used by viewers to start receiving a published livestream. +The usage of WHEP is very similar to WHIP, as you need the following: + +1. The URL of an HTTP endpoint implementing the WHEP specification. +2. **(Optional)** A token, used by the endpoint to authorize the viewer. + +With Fishjam, if the livestream is private, then the **token is required**. +On the other hand, if the livestream is public, then the **token is omitted**. + +[Livestreams](../../explanation/livestreams) explains private and public livestreams in more detail. +In this guide we demonstrate how to view each livestream type using WHEP directly. + +### Private livestreams + +#### Getting the URL + +For private livestreams, Fishjam's WHEP endpoint is available at + +```sh +https://fishjam.io/api/v1/live/api/whep +``` + +You can paste this URL in your WHEP client of choice to start viewing. + +#### Getting the token + +To authenticate a viewer, you need to create a viewer token for a room of `livestream` type. +You can read about this in detail in [Production Livestreaming with Server SDKs](../../tutorials/livestreaming#production-livestreaming-with-server-sdks), but the TL;DR is + + + + + ```ts + const fishjamId = ""; + const managementToken = ""; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId, + managementToken, + }); + + const room = await fishjamClient.createRoom({ roomType: 'livestream', public: false }); + + // ... + + const { token: viewerToken } = await fishjamClient.createLivestreamViewerToken(room.id); // [!code highlight] + ``` + + + + + + ```python + from fishjam import FishjamClient, RoomOptions + + fishjam_client = FishjamClient( + fishjam_id=fishjam_id, + management_token=management_token, + ) + + room = fishjam_client.create_room(RoomOptions(room_type="livestream", public=False)) + + # ... + + viewer_token = fishjam_client.create_livestream_viewer_token(room.id) # [!code highlight] + ``` + + + + +The created viewer token must be supplied in the HTTP headers of the WHEP request: + +```sh +POST https://fishjam.io/api/v1/live/api/whep +Authorization: Bearer [VIEWER-TOKEN] +``` + +### Public livestreams + +For public livestreams, you don't need a token, however you still need a room of `livestream` type with the `public` flag enabled. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ""; + const managementToken = ""; + const fishjamClient = new FishjamClient({ + fishjamId, + managementToken, + }); + + // ---cut--- + const room = await fishjamClient.createRoom({ roomType: 'livestream', public: true }); + // now you can use room.id to start viewing + ``` + + + + + + ```python + room = fishjam_client.create_room(room_type="livestream", public=True) + # now you can use room.id to start viewing + ``` + + + + +Once you have such a room, you can view a stream published to that room by supplying the following URL: + +```sh +http://fishjam.io/api/v1/live/api/whep/[ROOM-ID] +``` + +## See also + +More on livestreaming: + +- [Livestreaming tutorial](../../tutorials/livestreaming) +- [Livestreams](../../explanation/livestreams) + +If livestreaming doesn't fit your use case: + +- [Rooms](../../explanation/rooms) +- [Videoconferencing in React Native](../../tutorials/react-native-quick-start) +- [Videoconferencing in React](../../tutorials/react-quick-start) +- [Audio-only calls](./audio-only-calls) diff --git a/versioned_docs/version-0.30.0/how-to/client/_category_.json b/versioned_docs/version-0.30.0/how-to/client/_category_.json new file mode 100644 index 00000000..ce35362b --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Web & Mobile", + "position": 1, + "link": { + "type": "generated-index", + "description": "Learn how to integrate Fishjam into your web and mobile applications." + } +} diff --git a/versioned_docs/version-0.30.0/how-to/client/background-streaming.mdx b/versioned_docs/version-0.30.0/how-to/client/background-streaming.mdx new file mode 100644 index 00000000..440c2cca --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/background-streaming.mdx @@ -0,0 +1,231 @@ +--- +title: "Background calls" +sidebar_position: 13 +sidebar_label: "Background calls 📱" +description: Enable calls running in the background on Android and iOS in React Native applications. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Background calls Mobile + +:::note +This guide is exclusively for **Mobile** (React Native) applications. +::: + +Both Android and iOS support calls running in the background, but they use different approaches: + +- **Android**: Uses foreground services to keep the app active in the background +- **iOS**: Uses CallKit integration to maintain VoIP calls in the background + +Below is configuration required to make it work: + + + + + +You need to modify `app.json` file and add our plugin: + +```json +{ + "expo": { + ... + "plugins": { + ... + [ + "@fishjam-cloud/react-native-client", + { + "android": { + "enableForegroundService": true + }, + "ios": { + "enableVoIPBackgroundMode": true + } + } + ], + ... + } + } +} +``` + + + + +**Android Configuration** + +Add the following permissions and services to `AndroidManifest.xml`: + +```xml title='AndroidManifest.xml' + + ... + + + + + + ... + + + + + +``` + +**iOS Configuration** + +You need to add VoIP background mode in `Info.plist`: + +```xml title='Info.plist' +UIBackgroundModes + + voip + +``` + + + + +## Usage + + + + + +You can use [`useForegroundService`](../../api/mobile/variables/useForegroundService) hook to handle how foreground service behaves on Android. + +:::important[Permissions] + +If you want to use [`enableCamera`](../../api/mobile/type-aliases/ForegroundServiceConfig#enablecamera) or [`enableMicrophone`](../../api/mobile/type-aliases/ForegroundServiceConfig#enablemicrophone), +user must first grant permission for this resource. [`useForegroundService`](../../api/mobile/variables/useForegroundService) will check if permission is +granted and only then allow to start a service. + +::: + +```tsx +import { + useForegroundService, + useCamera, + useMicrophone, +} from "@fishjam-cloud/react-native-client"; + +const { isCameraOn } = useCamera(); +const { isMicrophoneOn } = useMicrophone(); + +useForegroundService({ + // [!code highlight] + channelId: "io.fishjam.example.fishjamchat.foregroundservice.channel", + channelName: "Fishjam Chat Notifications", + notificationTitle: "Your video call is ongoing", + notificationContent: "Tap to return to the call.", + enableCamera: isCameraOn, + enableMicrophone: isMicrophoneOn, + // enableScreenSharing: true, +}); +``` + + + + +On iOS, background calls are achieved through CallKit integration. You can use the CallKit hooks to manage VoIP calls that continue running in the background. + +### Manual CallKit Management + +Use the [`useCallKit`](../../api/mobile/functions/useCallKit) hook for fine-grained control over CallKit sessions: + +```tsx +import { useCallKit } from "@fishjam-cloud/react-native-client"; + +const { startCallKitSession, endCallKitSession } = useCallKit(); + +// Start CallKit session when joining a room +const handleJoinRoom = async () => { + await startCallKitSession({ + displayName: "John Doe", + isVideo: true, + }); + // ... join room logic +}; + +// End CallKit session when leaving +const handleLeaveRoom = async () => { + await endCallKitSession(); + // ... leave room logic +}; +``` + +### Automatic CallKit Management + +Use the [`useCallKitService`](../../api/mobile/functions/useCallKitService) hook for automatic session lifecycle management: + +```tsx +import React from "react"; +import { useCallKitService } from "@fishjam-cloud/react-native-client"; +import { View } from "react-native"; + +function CallScreen({ username }: { username: string }) { + // CallKit session automatically starts when component mounts + // and ends when component unmounts + useCallKitService({ + displayName: username, + isVideo: true, + }); + + return ...; +} +``` + +### Listening to CallKit Events + +Use the [`useCallKitEvent`](../../api/mobile/functions/useCallKitEvent) hook to respond to user interactions with the native CallKit interface: + +```tsx +import { + useCallKitEvent, + useCamera, + useMicrophone, + useConnection, +} from "@fishjam-cloud/react-native-client"; + +const { startMicrophone, stopMicrophone } = useMicrophone(); +const { leaveRoom } = useConnection(); + +// Listen for mute toggle from CallKit UI +useCallKitEvent("muted", (isMuted?: boolean) => { + if (isMuted === true) { + stopMicrophone(); + } else if (isMuted === false) { + startMicrophone(); + } +}); + +// Listen for hold state changes +useCallKitEvent("held", (isHeld?: boolean) => { + console.log("Call hold state:", isHeld); + // Handle hold state in your app +}); + +// Listen for call end from CallKit UI +useCallKitEvent("ended", () => { + // Handle call termination + leaveRoom(); +}); +``` + + + + +## See Also + +For an enhanced user experience when your app is in the background, consider enabling [Picture in Picture](./picture-in-picture), which allows users to see video content in a floating window while using other apps. + +To surface an incoming call as a native CallKit (iOS) or Telecom (Android) call driven by a push notification, see [VoIP calls](./voip-calls). diff --git a/versioned_docs/version-0.30.0/how-to/client/connecting.mdx b/versioned_docs/version-0.30.0/how-to/client/connecting.mdx new file mode 100644 index 00000000..f96524e0 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/connecting.mdx @@ -0,0 +1,178 @@ +--- +sidebar_position: 3 +description: Connect to a Fishjam room using a peer token and room URL obtained from your backend. +--- + +import TabItem from "@theme/TabItem"; +import Tabs from "@theme/Tabs"; + +# Connecting + +This article will guide you through the process of connecting to a Fishjam room. + +## Getting URL and token + +In order to connect, you need to obtain a **Peer Token** (the token that will authenticate the peer in +your Room). + + + + + +Once you create your account on [Fishjam](https://fishjam.io), you can [use the Sandbox API](../backend/sandbox-api-testing) to generate peer tokens for testing or development purposes without setting up your own backend. +This is basically a service that will create a Room, add your app as +the Room's Peer, and return the token required to use that Room. It is available to all accounts, including the free **Mini Jar** plan. +For React/React Native apps, copy both the Fishjam ID from the [Dashboard tab](https://fishjam.io/app) and Sandbox API URL from the [Sandbox tab](https://fishjam.io/app/sandbox): the Sandbox API URL is used to get peer tokens, while the Fishjam ID is passed to `FishjamProvider` for media server access. + + + + +```ts +import { useSandbox } from "@fishjam-cloud/react-client"; +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +const roomName = "room"; +const peerName = "user"; +// ---cut--- + +const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); +const peerToken = await getSandboxPeerToken(roomName, peerName); +``` + + + + +```ts +import { useSandbox } from "@fishjam-cloud/react-native-client"; +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +const roomName = "room"; +const peerName = "user"; +// ---cut--- + +const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL }); +const peerToken = await getSandboxPeerToken(roomName, peerName); +``` + + + + + + + +For production, you need to implement your own backend service that will provide the user with a **Peer Token**. To do that, +follow our [server setup instructions](../backend/server-setup). The **Standard Jar** plan is recommended for production deployments. + + + + +## Connecting + +Use the [`useConnection`](../../api/web/functions/useConnection) hook to get +the [`joinRoom`](../../api/web/functions/useConnection#joinroom) function. + + + + +```tsx +const SANDBOX_API_URL = "your-sandbox-api-url-here"; +// ---cut-before--- +import { useConnection, useSandbox } from "@fishjam-cloud/react-client"; +import React, { useCallback } from "react"; + +export function JoinRoomButton() { + const { joinRoom } = useConnection(); // [!code highlight] + // get the peer token from sandbox or your backend + const { getSandboxPeerToken } = useSandbox({ + sandboxApiUrl: SANDBOX_API_URL, + }); + + const onJoinRoomPress = useCallback(async () => { + // [!code highlight:5] + const peerToken = await getSandboxPeerToken("Room", "User"); + await joinRoom({ peerToken }); + }, [joinRoom, getSandboxPeerToken]); + + return ; +} +``` + + + + +```tsx +import React, { useCallback } from "react"; +import { Button } from "react-native"; +import { useConnection, useSandbox } from "@fishjam-cloud/react-native-client"; + +const SANDBOX_API_URL = "your-sandbox-api-url-here"; + +export function JoinRoomButton() { + const { joinRoom } = useConnection(); // [!code highlight] + // get the peer token from sandbox or your backend + const { getSandboxPeerToken } = useSandbox({ + sandboxApiUrl: SANDBOX_API_URL, + }); + + const onPressJoin = useCallback(async () => { + // in production apps, get the peerToken from your own backend instead + const peerToken = await getSandboxPeerToken("Room", "User"); + + await joinRoom({ peerToken }); // [!code highlight] + }, [joinRoom, getSandboxPeerToken]); + + return ; +} +``` + + + + +```tsx +import React, { useCallback } from "react"; +import { Button } from "react-native"; +import { useConnection } from "@fishjam-cloud/react-native-client"; + +export function LeaveRoomButton() { + const { leaveRoom } = useConnection(); // [!code highlight] + + const onPressLeave = useCallback(async () => { + await leaveRoom(); // [!code highlight] + }, [leaveRoom]); + + return + + ))} + + ); +} +``` + + + + +To select the desired camera, use the [`selectCamera`](../../api/mobile/functions/useCamera) method. +The list of the available camera devices is available via the [`cameraDevices`](../../api/mobile/functions/useCamera). + +```tsx +import React, { useCallback, useState } from "react"; +import { Button } from "react-native"; +import { useCamera } from "@fishjam-cloud/react-native-client"; + +export function FlipButton() { + const { cameraDevices, selectCamera } = useCamera(); // [!code highlight] + const [currentIndex, setCurrentIndex] = useState(0); + + const onPressFlipCamera = useCallback(() => { + if (cameraDevices.length === 0) return; + + // Cycle through available cameras + const nextIndex = (currentIndex + 1) % cameraDevices.length; + const nextCamera = cameraDevices[nextIndex]; + if (nextCamera) { + selectCamera(nextCamera.deviceId); // [!code highlight] + setCurrentIndex(nextIndex); + } + }, [cameraDevices, currentIndex, selectCamera]); + + return ; +} +``` + + + + +You can use [`toggleCamera`](../../api/mobile/functions/useCamera) to toggle the camera state, or use [`startCamera`](../../api/mobile/functions/useCamera) and [`stopCamera`](../../api/mobile/functions/useCamera) for more explicit control. + +#### Using toggleCamera + +```tsx +import { Button } from "react-native"; +import React from "react"; +import { useCamera } from "@fishjam-cloud/react-native-client"; + +export function ToggleCameraButton() { + const { isCameraOn, toggleCamera } = useCamera(); // [!code highlight] + + return ( + + + + ); +} +``` + +## Audio processing: noise cancellation and auto gain control + +When capturing a microphone, the browser (Web) or OS (Mobile) applies audio processing — **echo cancellation**, **noise suppression** (noise cancellation) and **auto gain control** — to make speech clearer. These are enabled by default and are the right choice for most voice and meeting use cases. + +Turn them off only when you need the raw, unprocessed signal — for example capturing music or an instrument, or running your own audio processing — since these filters can distort non-speech audio. + + + + +On Web, audio processing follows the browser's defaults (noise suppression, auto gain control and echo cancellation are on by default). To set them explicitly, pass [`constraints`](../../api/web/interfaces/FishjamProviderProps#constraints) to `FishjamProvider`. The `audio` field accepts standard [`MediaTrackConstraints`](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints). + +```tsx +import React from "react"; +import { FishjamProvider } from "@fishjam-cloud/react-client"; + +export function App({ fishjamId }: { fishjamId: string }) { + return ( + + {/* your app */} + + ); +} +``` + +To capture raw audio (for example, music), set `echoCancellation`, `noiseSuppression`, and `autoGainControl` to `false` instead. + +:::note +These constraints are applied when `FishjamProvider` creates the microphone track. `selectMicrophone` and `startMicrophone` reuse the same constraints — they don't accept per-call overrides. +::: + + + + +On Mobile, echo cancellation, noise suppression and auto gain control are enabled by default in the native audio pipeline and aren't currently configurable from JavaScript. + + + + +## Managing Permissions (Mobile only) + +The SDK provides built-in hooks for querying and requesting device permissions: `useCameraPermissions` and `useMicrophonePermissions` from `@fishjam-cloud/react-native-client`. + +Both hooks return a `[query, request]` tuple: + +- **`query()`** — checks the current permission status without prompting the user +- **`request()`** — triggers the native permission dialog and returns the resulting status + +The returned `PermissionStatus` is one of: `'granted'`, `'denied'`, or `'prompt'`. + +:::info +Requesting permissions manually is optional — `initializeDevices()` will automatically prompt for any permissions that haven't been granted yet. +However, you must always call `initializeDevices()` to set up camera and microphone devices. +::: + +#### Usage Example + +```tsx +// @noErrors: 2305 +import React, { useEffect } from "react"; +import { + useCameraPermissions, + useMicrophonePermissions, + useInitializeDevices, +} from "@fishjam-cloud/react-native-client"; + +function RoomScreen() { + const [queryCamera, requestCamera] = useCameraPermissions(); // [!code highlight] + const [queryMicrophone, requestMicrophone] = useMicrophonePermissions(); // [!code highlight] + const { initializeDevices } = useInitializeDevices(); // [!code highlight] + + useEffect(() => { + const setup = async () => { + let cam = await queryCamera(); + let mic = await queryMicrophone(); + + if (cam !== "granted") cam = await requestCamera(); + if (mic !== "granted") mic = await requestMicrophone(); + + if (cam === "granted" && mic === "granted") { + await initializeDevices(); // [!code highlight] + } + }; + setup(); + }, [ + queryCamera, + requestCamera, + queryMicrophone, + requestMicrophone, + initializeDevices, + ]); +} +``` diff --git a/versioned_docs/version-0.30.0/how-to/client/metadata.mdx b/versioned_docs/version-0.30.0/how-to/client/metadata.mdx new file mode 100644 index 00000000..a80ae16f --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/metadata.mdx @@ -0,0 +1,211 @@ +--- +sidebar_position: 6 +title: "Metadata" +description: "How to use metadata" +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +Alongside audio and video, it is possible to send additional metadata with each peer. Metadata is just +JSON that can contain arbitrary information. Its most common use is sending a user name associated with a peer. +However, it can be also used to send the peer's camera type, application information etc. + +:::info + +You can also set metadata on [the server side, when adding user to the room](../backend/server-setup#metadata). This metadata is persistent throughout its lifetime and is useful for attaching information that +can't be overwritten by the peer, like information about real user names or basic permission info. + +::: + +## Setting metadata when joining the room + +The `joinRoom` method from the `useConnection` hook has a `peerMetadata` parameter, that can be used for setting object metadata. + + + + +```tsx +const PEER_TOKEN = "some-peer-token"; +// ---cut--- +import { useConnection } from "@fishjam-cloud/react-client"; +import React, { useCallback } from "react"; + +type PeerMetadata = { + displayName: string; +}; + +export function JoinRoomButton() { + const { joinRoom } = useConnection(); // [!code highlight] + + const onJoinRoomPress = useCallback(async () => { + await joinRoom({ + peerToken: PEER_TOKEN, + peerMetadata: { displayName: "John Wick" }, // [!code highlight] + }); + }, [joinRoom]); + + return ; +} +``` + + + + +```tsx +const PEER_TOKEN = "some-peer-token"; +// ---cut--- +import React, { useCallback } from "react"; +import { Button } from "react-native"; +import { useConnection } from "@fishjam-cloud/react-native-client"; + +type PeerMetadata = { + displayName: string; +}; + +export function JoinRoomButton() { + const { joinRoom } = useConnection(); + + const onPressJoin = useCallback(async () => { + // Note: fishjamId is passed to FishjamProvider, not joinRoom + await joinRoom({ + peerToken: PEER_TOKEN, + peerMetadata: { displayName: "John Wick" }, // [!code highlight] + }); + }, [joinRoom]); + + return ; +} +``` + + + + +```tsx +import React, { useCallback } from "react"; +import { Button } from "react-native"; +import { useUpdatePeerMetadata } from "@fishjam-cloud/react-native-client"; + +type PeerMetadata = { + displayName: string; +}; + +export function UpdateNameButton() { + const { updatePeerMetadata } = useUpdatePeerMetadata(); // [!code highlight] + + const onPressUpdateName = useCallback(async () => { + await updatePeerMetadata({ displayName: "Thomas A. Anderson" }); // [!code highlight] + }, [updatePeerMetadata]); + + return + ))} + + ); +} +``` + + + + +```tsx +import React from "react"; +import { type RemoteTrack, Variant } from "@fishjam-cloud/react-native-client"; +import { View, Pressable, Text, StyleSheet } from "react-native"; + +// ---cut--- + +const variants = [ + { label: "Low", value: Variant.VARIANT_LOW }, + { label: "Medium", value: Variant.VARIANT_MEDIUM }, + { label: "High", value: Variant.VARIANT_HIGH }, +]; + +function QualitySelector({ track }: { track: RemoteTrack }) { + return ( + + {variants.map(({ label, value }) => ( + track.setReceivedQuality(value)} + > + {label} + + ))} + + ); +} + +const styles = StyleSheet.create({ + row: { flexDirection: "row", gap: 8, marginTop: 4 }, + pill: { + paddingHorizontal: 12, + paddingVertical: 6, + borderRadius: 16, + backgroundColor: "#e0e0e0", + }, +}); +``` + + + + +--- + +## Type differences: `Track` vs `RemoteTrack` + +When using `usePeers`, the track types differ between local and remote peers: + +- **`localPeer.tracks`** are typed as `Track` (no quality selection methods) +- **`remotePeers[].tracks`** are typed as `RemoteTrack` (extends `Track` with `setReceivedQuality`) + +This means `setReceivedQuality` is only available on tracks from remote peers, which is the correct behavior. You don't need to select a quality variant for your own video. + +--- + +## See also + +- [Simulcast explanation](../../explanation/simulcast): conceptual overview of how simulcast works +- [Connecting to a room](./connecting): prerequisite for using simulcast diff --git a/versioned_docs/version-0.30.0/how-to/client/start-streaming.mdx b/versioned_docs/version-0.30.0/how-to/client/start-streaming.mdx new file mode 100644 index 00000000..4bbd1bf8 --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/start-streaming.mdx @@ -0,0 +1,135 @@ +--- +sidebar_position: 2 +description: Initialize camera and microphone access and start streaming media in a Fishjam room. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Streaming media + +This guide covers the basics of initializing and using camera and microphone devices. For more advanced device management (selecting specific devices, device switching, muting, etc.), see the [Managing devices](./managing-devices) guide. + +## Initialize access to your devices + + + + +Fishjam provides an API to browse and manage media devices you can use. +To ask the browser for permission to list the available devices, +call the [`initializeDevices`](../../api/web/functions/useInitializeDevices#initializedevices) +function from [`useInitializeDevices`](../../api/web/functions/useInitializeDevices) hook. + +You can choose whether to initialize both camera and microphone devices or just one of them by passing [`InitializeDevicesSettings`](../../api/web/type-aliases/InitializeDevicesSettings) +as an argument. By default, both camera and microphone are initialized. + +The [`initializeDevices`](../../api/web/functions/useInitializeDevices#initializedevices) function will return a [`Promise`](../../api/web/type-aliases/InitializeDevicesResult) object. + +```ts +import React, { useEffect } from "react"; +import { useInitializeDevices } from "@fishjam-cloud/react-client"; + +export function useExample() { + const { initializeDevices } = useInitializeDevices(); + + useEffect(() => { + initializeDevices().then((result) => { + // optionally handle the result + console.log(result); + }); + }, [initializeDevices]); +} +``` + +:::note +The [`useInitializeDevices`](../../api/web/functions/useInitializeDevices) hook gives you the convenience of asking the user for all permissions at once. + +It is not the only way to enable the device. You can just toggle the device using [`useCamera`](../../api/web/functions/useCamera) or [`useMicrophone`](../../api/web/functions/useMicrophone) hooks. +::: + + + + +On mobile, you should use `initializeDevices()` when you first want to stream. This gives your app access to all available devices and automatically requests camera and microphone permissions. The SDK will show the system permission dialog if permissions haven't been granted yet. + +Once devices are initialized, you can manage their state using the methods described in the [Managing devices](./managing-devices) guide. + + + + +## Device API + + + + +To manage users' camera and microphone devices, use the respective [`useCamera`](../../api/web/functions/useCamera) and [`useMicrophone`](../../api/web/functions/useMicrophone) hooks. Both of them have similar API. To keep things simple, we will just use the camera hook. + +```tsx +import React, { useEffect, useRef } from "react"; +import { useCamera } from "@fishjam-cloud/react-client"; + +export function ExampleCameraPreview() { + const videoRef = useRef(null); + + const { activeCamera, selectCamera, cameraStream, cameraDevices } = + useCamera(); // [!code highlight] + + useEffect(() => { + if (!videoRef.current) return; + videoRef.current.srcObject = cameraStream ?? null; + }, [cameraStream]); + + return ( +
+

Active camera: {activeCamera?.label ?? "None"}

+ + {cameraStream &&
+ ); +} +``` + +
+ + +To manage users' camera and microphone devices, use the respective [`useCamera`](../../api/mobile/functions/useCamera) and [`useMicrophone`](../../api/mobile/functions/useMicrophone) hooks. Both of them have similar API. To keep things simple, we will just use the camera hook. + +You can preview your camera stream using the `RTCView` component. + +```tsx +import React, { useEffect } from "react"; +import { View, Text } from "react-native"; +import { useCamera, RTCView } from "@fishjam-cloud/react-native-client"; + +export function CameraPreview() { + const { startCamera, cameraStream } = useCamera(); // [!code highlight] + + useEffect(() => { + startCamera(); // [!code highlight] + }, [startCamera]); + + return ( + + {cameraStream ? ( + + ) : ( + No camera stream + )} + + ); +} +``` + + +
diff --git a/versioned_docs/version-0.30.0/how-to/client/stream-middleware.mdx b/versioned_docs/version-0.30.0/how-to/client/stream-middleware.mdx new file mode 100644 index 00000000..714ab90c --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/client/stream-middleware.mdx @@ -0,0 +1,105 @@ +--- +title: "Stream middleware" +sidebar_position: 7 +sidebar_label: "Stream middleware 🌐" +description: Intercept and transform media tracks before sending them to Fishjam, enabling effects and custom encodings. +--- + +# Stream middleware Web + +:::note +This guide is exclusively for **Web** (React) applications. +::: + +Stream middleware in Fishjam allows you to intercept and manipulate media tracks before they are sent to the Fishjam server. +This feature is powerful for applying effects, custom encodings, or any other transformations to the media stream. + +## Overview + +Define a [`TrackMiddleware`](../../api/web/type-aliases/TrackMiddleware) function which takes a `MediaStreamTrack` and returns an object containing the modified `MediaStreamTrack` +and an optional `onClear` function, which is called when the middleware needs to be removed or reapplied when a device changes. + +### Type definition + +```typescript +export type TrackMiddleware = ( + track: MediaStreamTrack, +) => { track: MediaStreamTrack; onClear?: () => void } | null; +``` + +### Setting middleware + +You can set the middleware for your media tracks using [`setTrackMiddleware`](../../api/web/functions/useCamera) method. This method accepts a `TrackMiddleware` or `null` for removing previously set middleware. + +### Example: Applying a blur effect + +The following example demonstrates how to apply a custom blur effect to the camera track using the [`useCamera`](../../api/web/functions/useCamera) hook and middleware. + +```tsx +class BlurProcessor { + track: MediaStreamTrack; + + constructor(stream: MediaStream) { + this.track = this.applyBlurEffect(stream); + } + + private applyBlurEffect(stream: MediaStream): MediaStreamTrack { + return stream.getVideoTracks()[0]; + } + + destroy() {} +} + +// ---cut--- +import React, { useCallback, useEffect, useRef } from "react"; +import type { TrackMiddleware } from "@fishjam-cloud/react-client"; +import { useCamera } from "@fishjam-cloud/react-client"; + +export function CameraWithBlurEffect() { + const videoRef = useRef(null); + // [!code highlight:2] + const { cameraStream, currentCameraMiddleware, setCameraTrackMiddleware } = + useCamera(); + + useEffect(() => { + if (!videoRef.current) return; + videoRef.current.srcObject = cameraStream ?? null; + }, [cameraStream]); + + // Define blur middleware + const blurMiddleware: TrackMiddleware = useCallback( + (track: MediaStreamTrack) => { + const streamToBlur = new MediaStream([track]); + // BlurProcessor is just an example, + // process the stream however you need + const blurProcessor = new BlurProcessor(streamToBlur); + + return { + track: blurProcessor.track, + onClear: () => blurProcessor.destroy(), + }; + }, + [], + ); + + // Check if the current middleware is blur + const isBlurEnabled = currentCameraMiddleware === blurMiddleware; + + // Toggle blur effect + const toggleBlur = () => { + setCameraTrackMiddleware(isBlurEnabled ? null : blurMiddleware); // [!code highlight] + }; + + return ( + <> + + + {cameraStream &&
+ +Note the following: + +- The recording mirrors the output it captures: the same layout and resolution, including every scene update. The file is encoded separately from the live stream. To record at a different resolution than the live output, add `scaleRatio` to `source`: `0.5` records at half the output's resolution, and values above `1` upscale. The default is `1`. +- An output can have at most one recording at a time. To record the same output again, wait until the current recording is no longer `active`. +- `metadata` is optional and free-form. It is returned with the recording and can be used to filter recordings later. + +## Step 3: Check the status + + + + +```bash +curl "$FISHJAM_URL/recordings/$RECORDING" \ + -H "Authorization: Bearer $TOKEN" +``` + + + + +```ts +import { FishjamClient, type Recording } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); +declare const recording: Recording; +// ---cut--- +const { status } = await fishjamClient.getRecording(recording.id); +``` + + + + +```python +status = fishjam_client.get_recording(recording.id).status +``` + + + + +A recording has four statuses: + +| Status | Meaning | +| ----------- | ------------------------------------------------------- | +| `active` | The output is being captured. | +| `finished` | Capture has ended and the file is being prepared. | +| `available` | The MP4 is ready and `files` contains the download URL. | +| `failed` | An error occurred and no file will be produced. | + +Instead of polling, you can subscribe to [server notifications](./../../api/reference#protobufs): every status change emits a `RecordingStatusChanged` message containing the recording's id, its new status, and its metadata, delivered over your configured webhook or a websocket. + +## Step 4: Stop the recording + + + + +```bash +curl -X POST "$FISHJAM_URL/recordings/$RECORDING/stop" \ + -H "Authorization: Bearer $TOKEN" +``` + + + + +```ts +import { FishjamClient, type Recording } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); +declare const recording: Recording; +// ---cut--- +await fishjamClient.stopRecording(recording.id); +``` + + + + +```python +fishjam_client.stop_recording(recording.id) +``` + + + + +Finalization is asynchronous: the recording remains `active` until capture has ended, then transitions to `finished`. Stopping a recording that is no longer active has no effect. + +Stopping a recording explicitly is optional. Capture ends automatically when the recorded output ends or the composition is deleted, so [deleting the composition](./../../explanation/compositions#cost-and-lifecycle) also finalizes its recordings. + +## Step 5: Download the MP4 + +Once the status is `available`, the recording's `files` field lists its media files in playback order as direct HTTPS URLs: + +```json +{ + "data": { + "id": "", + "status": "available", + "files": [{ "url": "https://media.fishjam.io/.../index.mp4" }], + "source": { "...": "..." }, + "metadata": { "show": "weekly-standup" } + } +} +``` + +You can download the file or serve the URL to your users directly. Until the recording is `available`, `files` is empty. + +## Step 6: List your recordings + +`GET /recordings` lists every recording in your app and accepts filters on status and metadata. A metadata filter matches recordings whose metadata contains all of the given pairs. Values are compared as strings, so numeric and boolean metadata values cannot be matched this way. + + + + +```bash +curl -g "$FISHJAM_URL/recordings?status=available&metadata[show]=weekly-standup" \ + -H "Authorization: Bearer $TOKEN" +``` + +The `-g` flag prevents curl from interpreting the square brackets. + + + + +```ts +import { FishjamClient } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); +// ---cut--- +const recordings = await fishjamClient.getAllRecordings({ + show: "weekly-standup", +}); +``` + + + + +```python +recordings = fishjam_client.get_all_recordings({"show": "weekly-standup"}) +``` + + + + +The SDK methods filter by metadata only. To filter by status as well, call the REST endpoint directly. + +## Step 7: Clean up + +Recordings persist independently of the composition until you delete them. Deleting a recording also removes its files: + + + + +```bash +curl -X DELETE "$FISHJAM_URL/recordings/$RECORDING" \ + -H "Authorization: Bearer $TOKEN" +``` + + + + +```ts +import { FishjamClient, type Recording } from "@fishjam-cloud/js-server-sdk"; + +const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.MANAGEMENT_TOKEN!, +}); +declare const recording: Recording; +// ---cut--- +await fishjamClient.deleteRecording(recording.id); +``` + + + + +```python +fishjam_client.delete_recording(recording.id) +``` + + + + +An `active` recording cannot be deleted. Stop it first and delete it once its status is no longer `active`. + +See the [Server REST API](/api/rest) reference for the complete request and response schemas. diff --git a/versioned_docs/version-0.30.0/how-to/compositions/write-and-deploy-a-template.mdx b/versioned_docs/version-0.30.0/how-to/compositions/write-and-deploy-a-template.mdx new file mode 100644 index 00000000..78858a3c --- /dev/null +++ b/versioned_docs/version-0.30.0/how-to/compositions/write-and-deploy-a-template.mdx @@ -0,0 +1,185 @@ +--- +type: how-to +sidebar_position: 1 +description: Write a React composition template, bundle it with the CLI, and deploy it as an output. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Write and deploy a template + +A **template** is a React component that describes an output's layout. Instead of sending a static scene, you write a component, bundle it into a single file with the composition CLI, and upload it when registering an output. + +## Scaffold a project + +Create a new template project with the CLI: + +```bash npm2yarn +npx @fishjam-cloud/composition-cli init my-template +cd my-template +npm install +``` + +This generates a ready-to-build project: a `package.json` with `build` and `typecheck` scripts, a TypeScript config, and a starter `src/App.tsx`. + +## Write the template + +A template **default-exports a React component**. You lay out the composition with components from [`@swmansion/smelter`](https://smelter.dev/ts-sdk/overview). + +The example below builds a grid that maintains itself. `useInputStreams()` returns every input currently registered on the composition, so the layout follows them without you sending a single scene update: + +```tsx +// @jsx: react-jsx +// ---cut-before--- +import { + InputStream, + Rescaler, + Text, + Tiles, + View, + useInputStreams, +} from "@swmansion/smelter"; + +export default function App() { + const inputs = Object.values(useInputStreams()); + const playing = inputs.filter((input) => input.videoState === "playing"); + + if (playing.length === 0) { + return ( + + + Waiting for inputs + + + ); + } + + return ( + + + {playing.map((input) => ( + + + + ))} + + + ); +} +``` + +Register an input and a tile appears; unregister it and the grid reflows. Each entry also carries `videoState` and `audioState`, one of `ready`, `playing`, `paused`, or `finished`, which is what the filter above uses to keep inputs off screen until their media actually starts. + +`` renders one of the composition's registered inputs. Layout, styling, and every visual component (`View`, `Tiles`, `InputStream`, `Rescaler`, `Text`, `Image`, …) come from `@swmansion/smelter`. See the [Smelter TypeScript SDK reference](https://smelter.dev/ts-sdk/overview) for every component and its style props. + +## Build the bundle + +```bash npm2yarn +npm run build +``` + +## Deploy the template + +Now create the composition, as in [Step 1 of the tutorial](./../../tutorials/compositions#step-1-create-a-composition), and the livestream with its streamer token, as in [Step 3](./../../tutorials/compositions#step-3-create-a-livestream-to-publish-to): + +```bash +export COMPOSITION_URL="https://rtc.fishjam.io" +export FISHJAM_URL="https://fishjam.io/api/v1/connect/" +export TOKEN="" +export COMPOSITION="" +export STREAM="" +export STREAMER_TOKEN="" +``` + +A templated output is registered in a **single multipart request** to `POST …/output/{output_id}/template`. Do not call the plain `…/register` endpoint first. The request carries two parts: + +- `config`: the same JSON body a regular output registration takes (see [Choose inputs and outputs](./inputs-and-outputs)). Its `video.initial` scene is only a placeholder; the template takes over rendering as soon as it loads. +- `template`: the built bundle. + +`endpoint_url` is wherever the composed stream should go. The quickest destination to watch is a Fishjam livestream, exactly as in [the tutorial](./../../tutorials/compositions#step-3-create-a-livestream-to-publish-to): create one, take its streamer token, and publish to `https://fishjam.io/api/v1/live/api/whip`. + + + + +```bash +CONFIG=$(cat < + + +```js +const config = { + type: "whip_client", + endpoint_url: "https://fishjam.io/api/v1/live/api/whip", + bearer_token: streamerToken, + video: { + resolution: { width: 1280, height: 720 }, + initial: { root: { type: "view" } }, + }, + audio: { initial: { inputs: [] } }, +}; + +const form = new FormData(); +form.append("config", JSON.stringify(config)); +form.append("template", new Blob([bundle]), "App.js"); + +await fetch( + `${COMPOSITION_URL}/api/composition/${composition}/output/main/template`, + { + method: "POST", + headers: { Authorization: `Bearer ${token}` }, + body: form, + }, +); +``` + + + + +## Redeploy after an edit + +Unregister the output first, then deploy again: + +```bash +curl -X POST "$COMPOSITION_URL/api/composition/$COMPOSITION/output/main/unregister" \ + -H "Authorization: Bearer $TOKEN" \ + -H "Content-Type: application/json" \ + -d '{}' +``` + +Rebuild with `npm run build` and repeat the deploy request. The inputs stay registered, so only the layout changes. + +## Clean up + +Deleting the composition removes its inputs and outputs with it, so a finished experiment takes two calls: + +```bash +curl -X DELETE "$COMPOSITION_URL/api/composition/$COMPOSITION" \ + -H "Authorization: Bearer $TOKEN" + +curl -X DELETE "$FISHJAM_URL/livestream/$STREAM" \ + -H "Authorization: Bearer $TOKEN" +``` + +## Next steps + +To feed a whole Fishjam room's peers into the template, continue with [Compose a Fishjam room](./compose-a-fishjam-room). To update the template's on-screen state at runtime, see [Drive a template with events](./drive-a-template-with-events). diff --git a/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-folder.png b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-folder.png new file mode 100644 index 00000000..59299cf3 Binary files /dev/null and b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-folder.png differ diff --git a/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-group.png b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-group.png new file mode 100644 index 00000000..8ec7c415 Binary files /dev/null and b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-group.png differ diff --git a/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-target.png b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-target.png new file mode 100644 index 00000000..4ecff358 Binary files /dev/null and b/versioned_docs/version-0.30.0/how-to/react-native/assets/ios-new-target.png differ diff --git a/versioned_docs/version-0.30.0/index.mdx b/versioned_docs/version-0.30.0/index.mdx new file mode 100644 index 00000000..84c284af --- /dev/null +++ b/versioned_docs/version-0.30.0/index.mdx @@ -0,0 +1,158 @@ +--- +sidebar_position: 0 +--- + +import QuickNavigation from "@site/src/components/QuickNavigation"; +import SkillCallout from "@site/src/components/SkillCallout"; +import { items } from "@site/src/content/cardItems"; +import { useVersionedLink } from "@site/src/hooks/useVersionedLink"; + +# Welcome to Fishjam + +

+Welcome to the Fishjam documentation! + +Learn how to create live video and audio streaming applications with Fishjam, the all-in-one multimedia streaming toolkit. +To get started, check out one of our guides or browse the examples below: + +

+ + + + + +## Tutorials + +
+
+

+ Learning-oriented lessons that take you through a series of steps to + complete a project. Most useful when you want to get started with Fishjam. +

+ +
+
+
    +
  • [React Native Quick Start](./tutorials/react-native-quick-start.mdx)
  • +
  • [React Quick Start](./tutorials/react-quick-start.mdx)
  • +
  • [Backend Quick Start](./tutorials/backend-quick-start.mdx)
  • +
  • See all →
  • +
+ +
+
+ +## How-to Guides + +
+
+

+ Practical step-by-step guides to help you achieve a specific goal. Most + useful when you're trying to get something done. +

+ +
+
+
    +
  • [Web & Mobile Installation](./how-to/client/installation.mdx)
  • +
  • [Backend Production Deployment](./how-to/backend/production-deployment.mdx)
  • +
  • See all →
  • +
+ +
+
+ +## Explanation + +
+
+

+ Big-picture explanations of higher-level Fishjam concepts. Most useful for + building understanding of a particular topic. +

+ +
+
+
    +
  • [What is Fishjam?](./explanation/what-is-fishjam.mdx)
  • +
  • [Architecture Overview](./explanation/architecture.mdx)
  • +
  • [Sandbox API](./explanation/sandbox-api-concept.mdx)
  • +
  • See all →
  • +
+ +
+
+ +## Examples + +
+
+

+ Ready-to-run example applications for web and mobile. Most useful when + you want to see Fishjam in action or use a project as a starting point. +

+ +
+
+
    +
  • [React Examples](./examples/react.mdx)
  • +
  • [React Native Examples](./examples/react-native.mdx)
  • +
+ +
+
+ +## API Reference + +
+
+

+ Nitty-gritty technical descriptions of how Fishjam works. Most useful when + you need detailed information about Fishjam's APIs. +

+ +
+
+
    +
  • [React Native SDK API](./api/mobile/index.md)
  • +
  • [React SDK API](./api/web/index.md)
  • +
  • [Server SDK API](./api/server/index.md)
  • +
  • See all →
  • +
+ +
+
+ +--- + +**Looking for live examples?** Check out our [Fishjam Chat demo](https://room.fishjam.io/) → diff --git a/versioned_docs/version-0.30.0/integrations/_category_.json b/versioned_docs/version-0.30.0/integrations/_category_.json new file mode 100644 index 00000000..ae7fd655 --- /dev/null +++ b/versioned_docs/version-0.30.0/integrations/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "Integrations", + "position": 4, + "link": { + "type": "generated-index", + "title": "Integrations", + "description": "Guides for integrating third-party services with Fishjam.", + "slug": "/integrations" + }, + "collapsible": false +} diff --git a/versioned_docs/version-0.30.0/integrations/gemini-live-integration.mdx b/versioned_docs/version-0.30.0/integrations/gemini-live-integration.mdx new file mode 100644 index 00000000..6548433b --- /dev/null +++ b/versioned_docs/version-0.30.0/integrations/gemini-live-integration.mdx @@ -0,0 +1,329 @@ +--- +sidebar_position: 0 +title: Gemini Live Integration +description: Build a real-time speech-to-speech voice assistant using Fishjam and Google's Multimodal Live API. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Gemini Live Integration + +:::info +This tutorial requires a working Fishjam backend. If you haven't set one up yet, please check the [Backend Quick Start](../tutorials/backend-quick-start). +::: + +This guide demonstrates how to build a real-time speech-to-speech agent using Fishjam and [Google's Multimodal Live API](https://ai.google.dev/gemini-api/docs/live). +By connecting these two services, you can create a low-latency voice assistant that not only listens to peers in a room and responds with natural voice, but also provides a real-time transcription of the conversation. + +## Overview + +The implementation acts as a bridge between two real-time streams: + +1. **Fishjam ➡️ Gemini:** The Agent receives audio from the room and forwards it to Google GenAI. +2. **Gemini ➡️ Fishjam:** The Agent receives audio generated by Gemini and plays it back into the room. + +To ensure these streams connect without audio glitches (garbled voice, wrong pitch), the audio sample rates must match between services. + +## Prerequisites + +You will need: + +- **Fishjam Server Credentials:** `fishjamId` and `managementToken`. You can get them at [fishjam.io/app](https://fishjam.io/app). +- **Google Gemini API Key:** Obtainable from [Google AI Studio](https://aistudio.google.com/). + +### Installation + +Since the Google integration is optional, you need to install the specific dependencies for your SDK. + + + + + First, ensure you have the Google GenAI SDK installed alongside Fishjam. + + ```bash + npm install @fishjam-cloud/js-server-sdk @google/genai + ``` + + + + + + Install Fishjam with the `gemini` extra to pull in the necessary libraries. + + ```bash + pip install "fishjam-server-sdk[gemini]" + ``` + + + + +## Implementation + +### Step 1: Initialize Clients + +We provide a helper factory to initialize the Google Client. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + import GeminiIntegration from '@fishjam-cloud/js-server-sdk/gemini'; + + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_TOKEN!, + }); + + // [!code highlight:4] + const genAi = GeminiIntegration.createClient({ + // Pass standard Google client options here + apiKey: process.env.GOOGLE_API_KEY!, + }); + ``` + + + + + + ```python + import os + from fishjam import FishjamClient + from fishjam.integrations.gemini import GeminiIntegration + + fishjam_client = FishjamClient( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_TOKEN"] + ) + + # pass standard Google client kwargs here + # [!code highlight:1] + gen_ai = GeminiIntegration.create_client(api_key=os.environ["GOOGLE_API_KEY"]) + ``` + + + + +### Step 2: Configure the Agent + +Create a Fishjam agent configured to match the audio format that the Google client expects (16kHz and 24kHz on Gemini input and output, respectively). + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + + // ---cut--- + import GeminiIntegration from '@fishjam-cloud/js-server-sdk/gemini'; + + const room = await fishjamClient.createRoom(); + + const { agent } = await fishjamClient.createAgent(room.id, { + subscribeMode: 'auto', + // Use our preset to match the required audio format (16kHz) + // [!code highlight:1] + output: GeminiIntegration.geminiInputAudioSettings, + }); + ``` + + + + + + ```python + from fishjam import AgentOptions + from fishjam.integrations.gemini import GeminiIntegration + + room = fishjam_client.create_room() + + # Use our preset to match the required audio format (16kHz) + # [!code highlight:1] + agent_options = AgentOptions(output=GeminiIntegration.GEMINI_INPUT_AUDIO_SETTINGS) + agent = fishjam_client.create_agent(room.id, agent_options) + ``` + + + + +### Step 3: Connect the Streams + +:::warning[Encoding] +Fishjam handles raw bytes, while Google GenAI SDKs often expect Base64 strings. Ensure you convert between them correctly as shown below. +::: + + + + Now we setup the callbacks. We need to forward incoming Fishjam audio to Google, and forward incoming Google audio to Fishjam. + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + import GI from '@fishjam-cloud/js-server-sdk/gemini'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const genAi = GI.createClient({ + apiKey: process.env.GOOGLE_API_KEY!, + }); + + const room = await fishjamClient.createRoom(); + + const { agent } = await fishjamClient.createAgent(room.id, { + subscribeMode: 'auto', + output: GI.geminiInputAudioSettings, + }); + + + + // ---cut--- + import GeminiIntegration from '@fishjam-cloud/js-server-sdk/gemini'; + import { Modality } from '@google/genai'; + + const GEMINI_MODEL = 'gemini-2.5-flash-native-audio-preview-12-2025' + + // Use our preset to match the required audio format (24kHz) + const agentTrack = agent.createTrack(GeminiIntegration.geminiOutputAudioSettings); + + const session = await genAi.live.connect({ + model: GEMINI_MODEL, + config: { responseModalities: [Modality.AUDIO] }, + callbacks: { + // Google -> Fishjam + onmessage: (msg) => { + if (msg.data) { + const pcmData = Buffer.from(msg.data, 'base64'); + agent.sendData(agentTrack.id, pcmData); + } + + if (msg.serverContent?.interrupted) { + console.log('Agent was interrupted by user.'); + // Clears the buffer on the Fishjam media server + agent.interruptTrack(agentTrack.id); + } + } + } + }); + + // Fishjam -> Google + agent.on('trackData', ({ data }) => { + session.sendRealtimeInput({ + audio: { + mimeType: GeminiIntegration.inputMimeType, + data: Buffer.from(data).toString('base64'), + } + }); + }); + + ``` + + + + + + Now we connect the websocket loops. We need to forward incoming Fishjam audio to Google, and forward incoming Google audio to Fishjam. + ```python + import asyncio + from google.genai.types import Blob, Modality + from fishjam.integrations.gemini import GeminiIntegration + + GEMINI_MODEL = "gemini-2.5-flash-native-audio-preview-12-2025" + + async def run(): + async with agent.connect() as fishjam_session: + + # Use our preset to match the required audio format (24kHz) + outgoing_track = await fishjam_session.add_track(GeminiIntegration.GEMINI_OUTPUT_AUDIO_SETTINGS) + + async with gen_ai.aio.live.connect( + model=GEMINI_MODEL, + config={"response_modalities": [Modality.AUDIO]} + ) as gemini_session: + + # Fishjam -> Google + async def forward_audio_to_gemini(): + async for track_data in fishjam_session.receive(): + await gemini_session.send_realtime_input(audio=Blob( + mime_type=GeminiIntegration.GEMINI_AUDIO_MIME_TYPE, + data=track_data.data + )) + + # Google -> Fishjam + async def forward_audio_to_fishjam(): + async for msg in gemini_session.receive(): + server_content = msg.server_content + + if server_content is None: + continue + + if server_content.interrupted: + await outgoing_track.interrupt() + + if server_content.model_turn and server_content.model_turn.parts: + for part in server_content.model_turn.parts: + if part.inline_data and part.inline_data.data: + await outgoing_track.send_chunk(part.inline_data.data) + + # Run both loops concurrently + await asyncio.gather( + forward_audio_to_gemini(), + forward_audio_to_fishjam() + ) + + asyncio.run(run()) + ``` + + + + +## Troubleshooting Gemini API keys + +If your agent joins the room but silently does nothing — no audio, no transcription, and no error — the issue is often related to the Gemini API key. + +:::warning[API key errors surface asynchronously] +`createClient` is a thin synchronous wrapper around Google's `GoogleGenAI` and makes no network call, so it does **not** validate your key — an invalid or unauthorized key is not rejected when you create the client. Unless you verify it explicitly (see below), the key is first exercised when `live.connect()` opens the Live websocket, and authentication or access failures then typically surface through the Live session callbacks (`onerror` / `onclose`) rather than as a thrown exception. (Other problems, such as a malformed config, can still reject the awaited `connect()` call — keep a `try/catch` around it too.) +::: + +To catch a bad key up front, call `checkCredentials` before connecting: it makes a single network request and throws if the key is rejected, so misconfiguration fails fast instead of silently. Still implement the `onerror` and `onclose` callbacks and log the close code and reason — that is where model-specific rejections (see below) and other Live failures appear: + +```ts +import GeminiIntegration from "@fishjam-cloud/js-server-sdk/gemini"; +import { Modality, type LiveServerMessage } from "@google/genai"; + +const genAi = GeminiIntegration.createClient({ + apiKey: process.env.GOOGLE_API_KEY!, +}); +const GEMINI_MODEL = "gemini-2.5-flash-native-audio-preview-12-2025"; +const handleMessage = (msg: LiveServerMessage) => {}; + +// ---cut--- +await GeminiIntegration.checkCredentials(genAi); + +const session = await genAi.live.connect({ + model: GEMINI_MODEL, + config: { responseModalities: [Modality.AUDIO] }, + callbacks: { + onopen: () => console.log("Gemini Live connected"), + onerror: (e) => console.error("Gemini Live error:", e), + onclose: (e) => + console.error(`Gemini Live closed: code=${e.code} reason=${e.reason}`), + onmessage: handleMessage, + }, +}); +``` + +### Common reasons a key doesn't work + +- Wrong or mistyped key, or a key from the wrong Google Cloud project. +- The Gemini API is not enabled for the key's project. +- Region or country restriction — the Gemini API (or its free tier) is not available in your region. +- Model-specific rejection. The native-audio Live models (e.g. `gemini-2.5-flash-native-audio-preview-*`) can reject an otherwise-valid key: the websocket closes with code `1008` and the message _"Your API key was reported as leaked. Please use another API key."_ (even when the key is not actually leaked), or with code `1011` internal errors. A key that works for other models can still fail here. + +### How to fix + +- Verify or regenerate your key at [Google AI Studio](https://aistudio.google.com/app/apikey). +- Confirm the Gemini API is enabled for the key's project and that your region is supported. +- If you see the `1008` "leaked" message, rotate to a freshly generated key. diff --git a/versioned_docs/version-0.30.0/integrations/vapi-integration.mdx b/versioned_docs/version-0.30.0/integrations/vapi-integration.mdx new file mode 100644 index 00000000..c8684887 --- /dev/null +++ b/versioned_docs/version-0.30.0/integrations/vapi-integration.mdx @@ -0,0 +1,191 @@ +--- +sidebar_position: 2 +title: VAPI Integration +description: Add a VAPI voice AI agent to a Fishjam room with a single API call. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# VAPI Integration + +:::info +This tutorial requires a working Fishjam backend. If you haven't set one up yet, please check the [Backend Quick Start](../tutorials/backend-quick-start). +::: + +This guide shows how to add a [VAPI](https://vapi.ai/) voice AI agent to a Fishjam room. +Unlike custom agent integrations (such as [Gemini](./gemini-live-integration)), there is no need to build a WebSocket bridge yourself — +Fishjam connects to VAPI internally. You only need to create a VAPI call and pass its ID to Fishjam. + +## Overview + +The workflow has two steps: + +1. **Create a VAPI call** using the VAPI SDK. This gives you a `callId`. +2. **Pass the call ID to Fishjam** via `createVapiAgent()` / `create_vapi_agent()`. Fishjam joins the call and streams audio to and from the room. + +:::note +The VAPI peer receives audio from only one peer at a time, so this integration works best in 1-on-1 calls. All peers in the room hear VAPI's responses. +::: + +## Prerequisites + +You will need: + +- **Fishjam Server Credentials:** `fishjamId` and `managementToken`. You can get them at [fishjam.io/app](https://fishjam.io/app). +- **VAPI Private API Key:** Obtainable from the [VAPI Dashboard](https://dashboard.vapi.ai/). +- **VAPI Assistant ID** _(optional)_**:** Create an assistant in the [VAPI Dashboard](https://dashboard.vapi.ai/), or provide a transient assistant configuration inline. + +### Installation + + + + + ```bash + npm install @fishjam-cloud/js-server-sdk @vapi-ai/server-sdk + ``` + + + + + + ```bash + pip install fishjam-server-sdk vapi_server_sdk + ``` + + + + +## Implementation + +### Step 1: Create a VAPI Call + +Use the VAPI SDK to create a call with `vapi.websocket` transport and `pcm_s16le` audio at `16000` Hz. +You can reference an existing assistant by its ID, or create a transient assistant inline by providing the full configuration via the `assistant` field instead of `assistantId`. + + + + + ```ts + import { VapiClient, Vapi } from '@vapi-ai/server-sdk'; + + const vapiClient = new VapiClient({ + token: process.env.VAPI_API_KEY!, + }); + + // [!code highlight:11] + const call = await vapiClient.calls.create({ + assistantId: process.env.VAPI_ASSISTANT_ID!, + transport: { + provider: 'vapi.websocket', + audioFormat: { + format: 'pcm_s16le', + container: 'raw', + sampleRate: 16000, + }, + }, + }) as Vapi.Call; + ``` + + + + + + ```python + import os + from vapi import Vapi + + vapi_client = Vapi(token=os.environ["VAPI_API_KEY"]) + + # [!code highlight:11] + call = vapi_client.calls.create( + assistant_id=os.environ["VAPI_ASSISTANT_ID"], + transport={ + "provider": "vapi.websocket", + "audioFormat": { + "format": "pcm_s16le", + "container": "raw", + "sampleRate": 16000, + }, + }, + ) + ``` + + + + +### Step 2: Add the VAPI Peer to Fishjam + +Pass the call ID and your VAPI API key to Fishjam. Fishjam handles the rest. + + + + + ```ts + import { VapiClient, Vapi } from '@vapi-ai/server-sdk'; + + const vapiClient = new VapiClient({ + token: process.env.VAPI_API_KEY!, + }); + + const call = await vapiClient.calls.create({ + assistantId: process.env.VAPI_ASSISTANT_ID!, + transport: { + provider: 'vapi.websocket', + audioFormat: { + format: 'pcm_s16le', + container: 'raw', + sampleRate: 16000, + }, + }, + }) as Vapi.Call; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_TOKEN!, + }); + + const room = await fishjamClient.createRoom(); + + // [!code highlight:4] + await fishjamClient.createVapiAgent(room.id, { + callId: call.id, + apiKey: process.env.VAPI_API_KEY!, + }); + ``` + + + + + + ```python + import os + from fishjam import FishjamClient, PeerOptionsVapi + + fishjam_client = FishjamClient( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_TOKEN"], + ) + + room = fishjam_client.create_room() + + # [!code highlight:2] + options = PeerOptionsVapi(api_key=os.environ["VAPI_API_KEY"], call_id=call.id) + peer = fishjam_client.create_vapi_agent(room.id, options) + ``` + + + + +## That's it + +Once both steps are complete, the VAPI assistant is live in the room — peers can speak to it and hear its responses. + +The VAPI peer's lifetime is tied to the underlying WebSocket connection. If there is a prolonged period of silence or the call ends for any other reason, the peer will disconnect and be removed from the room. You can detect this by listening for `PeerDisconnected` and `PeerDeleted` server notifications. If the peer crashes (e.g. due to an invalid transport configuration or call ID), a `PeerCrashed` notification is sent instead. See [Listening to events](../how-to/backend/server-setup#listening-to-events) for how to subscribe to these notifications. + +## Billing + +The VAPI peer is billed as a single Fishjam peer. VAPI's own usage pricing applies separately — see [VAPI pricing](https://vapi.ai/pricing) for details. diff --git a/versioned_docs/version-0.30.0/tutorials/_category_.json b/versioned_docs/version-0.30.0/tutorials/_category_.json new file mode 100644 index 00000000..942b9871 --- /dev/null +++ b/versioned_docs/version-0.30.0/tutorials/_category_.json @@ -0,0 +1,11 @@ +{ + "label": "Tutorials", + "position": 2, + "link": { + "type": "generated-index", + "title": "Tutorials", + "description": "Learning-oriented lessons that take you through a series of steps to complete a project. Most useful when you want to get started with Fishjam.", + "slug": "/tutorials" + }, + "collapsible": false +} diff --git a/versioned_docs/version-0.30.0/tutorials/agents.mdx b/versioned_docs/version-0.30.0/tutorials/agents.mdx new file mode 100644 index 00000000..9087dc0a --- /dev/null +++ b/versioned_docs/version-0.30.0/tutorials/agents.mdx @@ -0,0 +1,418 @@ +--- +type: tutorial +sidebar_position: 4 +title: Agents +description: Introduction to Fishjam agents and how to implement them using server SDKs. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; +import AgentDefinition from "../_common/agents/definition.mdx"; +import RememberToDisconnect from "../_common/agents/remember-to-disconnect.mdx"; +import Subscriptions from "../_common/agents/subscriptions.mdx"; + +# Fishjam Agent Introduction + +:::tip +We recommend going through the steps in the [Backend Quick Start](../tutorials/backend-quick-start) +before trying Fishjam agents, as you will need a working backend server to use them. +::: + +This page gives an introduction to Fishjam agents and how to use them. +You can learn more about how Agents work on the [Agent Internals](../explanation/agent-internals) page. + + + +## Writing an Agent + +In this section we show how to implement an agent using the Fishjam server SDKs. +If you are not using the SDKs, then you can check out the [Agent Internals](../explanation/agent-internals#agent-lifecycle), to learn how to integrate with Fishjam Agents. + +### Prerequisites + +Before we create the actual agent, we need to [create a room](../tutorials/backend-quick-start#step-4-create-a-room) first, as agents are scoped to rooms. +Additionally, we will also create a peer so that the agent has someone to listen to and talk to. + + + + + ```ts + const fishjamId = ""; + const managementToken = ""; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + const peer = await fishjamClient.createPeer(room.id); + ``` + + + + + + ```python + from fishjam import FishjamClient + + fishjam_client = FishjamClient(fishjam_id, management_token) + room = fishjam_client.create_room() + peer = fishjam_client.create_peer(room.id) + ``` + + + + +### Creating a listening Agent + +If you are using the server SDKs, then creating an agent and defining its behavior is very simple. +By default, agents receive all peers' audio streams. +However, it's likely that in your scenario you'll want to use the [Selective Subscriptions API](../how-to/backend/selective-subscriptions.mdx) for fine-grained control over which peers/tracks they should receive audio from. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + + // ---cut--- + + import type { AgentCallbacks, PeerOptions } from '@fishjam-cloud/js-server-sdk'; + + const agentOptions = { + subscribeMode: 'auto', + output: { audioFormat: 'pcm16', audioSampleRate: 16000 } + } satisfies PeerOptions; + + const agentCallbacks = { + onError: console.error, + onClose: (code, reason) => console.log('Agent closed', code, reason) + } satisfies AgentCallbacks; + + // [!code highlight:1] + const { agent } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks); + + // Register a callback for incoming audio data + agent.on('trackData', ({ track, peerId, data }) => { + // process the incoming data + }) + ``` + + + + + + ```python + import asyncio + from fishjam import FishjamClient, AgentOptions + from fishjam.agent import IncomingTrackData + + fishjam_client = FishjamClient(fishjam_id, management_token) + + agent_options = AgentOptions(subscribe_mode="auto") + agent = fishjam_client.create_agent(room_id, agent_options) + + async def run(): + # the agent will disconnect once you exit the context + async with agent.connect() as session: + async for track_data in session.receive(): + # process the incoming data + pass + + asyncio.run(run()) + ``` + + + + + +### Multiple Agents in a Room + +You can create multiple agents inside a single room by creating agents with the same room ID multiple times. +Each agent operates independently, with its own set of tracks and callbacks. + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + + import type { AgentCallbacks, PeerOptions } from '@fishjam-cloud/js-server-sdk'; + + const agentOptions = { + subscribeMode: 'auto', + output: { audioFormat: 'pcm16', audioSampleRate: 16000 } + } satisfies PeerOptions; + + const agentCallbacks = { + onError: console.error, + onClose: (code, reason) => console.log('Agent closed', code, reason) + } satisfies AgentCallbacks; + + // ---cut--- + const agentCallbacks1 = { + onError: console.error, + onClose: (code, reason) => console.log('Agent 1 closed', code, reason) + } satisfies AgentCallbacks; + + const agentCallbacks2 = { + onError: console.error, + onClose: (code, reason) => console.log('Agent 2 closed', code, reason) + } satisfies AgentCallbacks; + + const { agent: agent1 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks1); + const { agent: agent2 } = await fishjamClient.createAgent(room.id, agentOptions, agentCallbacks2); + ``` + + + + + + ```python + from fishjam import FishjamClient + + fishjam_client = FishjamClient(fishjam_id, management_token) + + agent1 = fishjam_client.create_agent(room_id) + agent2 = fishjam_client.create_agent(room_id) + ``` + + + + + +### Making the Agent speak + +Apart from just listening, agents can also send audio data to peers. +Let's assume that in the previous section we forwarded the peer's audio to some audio chatbot. +Now, the chatbot returns responses, and we want to play it back to the peer. + +:::tip +You can interrupt the currently played audio chunk. See the example below. +::: + + + + + ```ts + import { RoomId, FishjamClient, TrackId } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + const { agent } = await fishjamClient.createAgent(room.id, {}); + const chatbot: any = null; + + // ---cut--- + import { type AudioCodecParameters } from '@fishjam-cloud/js-server-sdk'; + + const codecParameters = { + encoding: 'pcm16', + sampleRate: 16000, + channels: 1, + } satisfies AudioCodecParameters; + + const agentTrack = agent.createTrack(codecParameters); + + // that's a dummy chatbot, + // you can bring your audio from anywhere + chatbot.on('response', (response: Uint8Array) => { + // [!code highlight:1] + agent.sendData(agentTrack.id, response); + + // you're able to interrupt the currently played audio chunk + // [!code highlight:1] + agent.interruptTrack(agentTrack.id); + }); + + ``` + + + + + + ```python + import asyncio + from fishjam import FishjamClient, AgentOptions + from fishjam.agent import OutgoingAudioTrackOptions + from fishjam.events import TrackEncoding + + fishjam_client = FishjamClient(fishjam_id, management_token) + + agent_options = AgentOptions(subscribe_mode="auto") + + agent = fishjam_client.create_agent(room_id, agent_options) + + track_options = OutgoingAudioTrackOptions(encoding=TrackEncoding.TRACK_ENCODING_PCM16) + + async def run(): + # the agent will disconnect once you exit the context + async with agent.connect() as session: + outgoing_track = await session.add_track(track_options) + + # that's a dummy chatbot + async for chatbot_data in chatbot.receive(): + await outgoing_track.send_chunk(chatbot_data) + + # you're able to interrupt the currently played audio chunk + # [!code highlight:1] + await outgoing_track.interrupt() + + asyncio.run(run()) + ``` + + + + + +### Making the Agent see + +Agents can also request video frames (JPEG images) from peers' video tracks. +Unlike audio, which streams continuously, video frames must be explicitly requested and arrive asynchronously. + +:::important +Video frame capture is rate-limited to one frame per second per track. +::: + + + + + ```ts + // @noErrors + import { RoomId, FishjamClient, TrackId } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + const { agent } = await fishjamClient.createAgent(room.id, {}); + const trackId: TrackId = '' as TrackId; + + // ---cut--- + import type { IncomingTrackImage } from '@fishjam-cloud/js-server-sdk'; + + // Listen for incoming video frames + agent.on('trackImage', (message: IncomingTrackImage) => { + const { contentType, data } = message; + // process the image data + }); + + // Request a frame periodically + setInterval(() => { + // [!code highlight:1] + agent.captureImage(trackId); + }, 1000); + + ``` + + + + + + ```python + import asyncio + + from fishjam import FishjamClient + from fishjam.agent import IncomingTrackImage + + fishjam_client = FishjamClient(fishjam_id, management_token) + + agent = fishjam_client.create_agent(room_id) + + async def run(): + async with agent.connect() as session: + # Request a frame + # [!code highlight:1] + await session.capture_image(track_id) + + # Captured frames arrive as IncomingTrackImage messages + async for message in session.receive(): + match message: + case IncomingTrackImage() as msg if msg.track_id == track_id: + data = msg.data + # process the image data + pass + + asyncio.run(run()) + ``` + + + + + +### Disconnecting + +After you're done using an agent, you can disconnect it from the room. + + + + + ```ts + import { RoomId, FishjamClient, TrackId } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = ''; + const managementToken = ''; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + const room = await fishjamClient.createRoom(); + const { agent } = await fishjamClient.createAgent(room.id, {}); + + // ---cut--- + agent.disconnect(); + + ``` + + + + + + ```python + import asyncio + + async def run(): + # the agent will disconnect once you exit the context + async with agent.connect() as session: + pass + + asyncio.run(run()) + ``` + + + + + + + +## Pricing + +Agents are billed as if they were normal peers. + +For example, a room with 2 peers and 1 agent connected will be billed as if there were 3 peers connected to the room. +Exact pricing values can be found on our [pricing page](https://fishjam.io/#pricing). + +## Using agents without our SDKs + +If you are using Fishjam's REST API directly, then check out this [Agent Internals section](../explanation/agent-internals#step-1-creating-an-agent-in-fishjam). + +## See also + +Learn more about how agents work: + +- [Agent Internals](../explanation/agent-internals) +- [Selective Subscriptions API](../how-to/backend/selective-subscriptions.mdx) + +Writing a backend server with Fishjam: + +- [Backend Quick Start](../tutorials/backend-quick-start) +- [How to Setup a Backend Server](../how-to/backend/server-setup) +- [Going to Production](../how-to/backend/production-deployment) diff --git a/versioned_docs/version-0.30.0/tutorials/backend-quick-start.mdx b/versioned_docs/version-0.30.0/tutorials/backend-quick-start.mdx new file mode 100644 index 00000000..d684afdd --- /dev/null +++ b/versioned_docs/version-0.30.0/tutorials/backend-quick-start.mdx @@ -0,0 +1,572 @@ +--- +type: tutorial +sidebar_position: 2 +description: Set up a backend server to create rooms and manage peers for your Fishjam application. +--- + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Backend Quick Start + +This tutorial will guide you through setting up a backend server that can create rooms and manage peers for your Fishjam application. +By the end, you'll have a working backend and understand how to integrate it with your client apps. + +## Choose your language + +Select your preferred backend language and all code examples will be shown for that language: + + + + + We'll use **Node.js with TypeScript** and the `@fishjam-cloud/js-server-sdk` package. + + + + + + We'll use **Python** and the `fishjam-server-sdk` package. + + + + +## What you'll build + +A simple backend server that can create rooms, add peers, and generate tokens for client apps. + +## What you'll learn + +- How to install and set up a Fishjam server SDK +- How to create and manage rooms +- How to create peers and generate tokens + +## Prerequisites + + + + + - Node.js environment set up + - Access to [Fishjam Dashboard](https://fishjam.io/app) with your credentials + + + + + + - Python environment set up + - Access to [Fishjam Dashboard](https://fishjam.io/app) with your credentials + + + + +## Step 1: Install the SDK + + + + + Install the JavaScript server SDK using your preferred package manager: + + + + + ```bash + npm install @fishjam-cloud/js-server-sdk + ``` + + + + + + ```bash + yarn add @fishjam-cloud/js-server-sdk + ``` + + + + + + ```bash + pnpm add @fishjam-cloud/js-server-sdk + ``` + + + + + + + + + Install the Python server SDK using your preferred package manager: + + + + + ```bash + pip install fishjam-server-sdk + ``` + + + + + + ```bash + poetry add fishjam-server-sdk + ``` + + + + + + ```bash + uv add fishjam-server-sdk + ``` + + + + + + + +## Step 2: Get your credentials + +1. Log in to [Fishjam Dashboard](https://fishjam.io/app) +2. Navigate to your app +3. Copy your **Fishjam ID** and **Management Token** +4. Store them as environment variables: + + + + + ```bash + export FISHJAM_ID="your-fishjam-id" + export FISHJAM_MANAGEMENT_TOKEN="your-management-token" + ``` + + + + + + ```bash + export FISHJAM_ID="your-fishjam-id" + export FISHJAM_MANAGEMENT_TOKEN="your-management-token" + ``` + + + + +## Step 3: Set up the client + +Create your Fishjam client: + + + + + ```ts + process.env.FISHJAM_ID = ""; + process.env.FISHJAM_MANAGEMENT_TOKEN = ""; + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamId = process.env.FISHJAM_ID; + const managementToken = process.env.FISHJAM_MANAGEMENT_TOKEN; + + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + ``` + + + + + + ```python + import os + from fishjam import FishjamClient + + fishjam_id = os.environ["FISHJAM_ID"] + management_token = os.environ["FISHJAM_MANAGEMENT_TOKEN"] + + fishjam_client = FishjamClient(fishjam_id, management_token) + ``` + + + + +## Step 4: Create a room + +Create your first room: + + + + + ```ts + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + const fishjamId = ""; + const managementToken = ""; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + + // ---cut--- + async function createRoom() { + const room = await fishjamClient.createRoom(); + console.log('Room created:', room.id); + return room; + } + ``` + + + + + + ```python + def create_room(): + room = fishjam_client.create_room() + print(f'Room created: {room.id}') + return room + ``` + + + + +## Step 5: Add a peer to the room + +Create a peer and get a token for your client app: + + + + + ```ts + import { FishjamClient, RoomId } from '@fishjam-cloud/js-server-sdk'; + const fishjamId = ""; + const managementToken = ""; + const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + + // ---cut--- + async function addPeer(roomId: RoomId, peerName: string) { + const { peer, peerToken } = await fishjamClient.createPeer(roomId, { + metadata: { name: peerName }, + }); + + console.log('Peer created:', peer.id); + console.log('Peer token:', peerToken); + + return { peer, peerToken }; + } + ``` + + + + + + ```python + from fishjam import PeerOptions + + def add_peer(room_id: str, peer_name: str): + options = PeerOptions(metadata={"name": peer_name}) + peer, peer_token = fishjam_client.create_peer(room_id, options=options) + + print(f'Peer created: {peer.id}') + print(f'Peer token: {peer_token}') + + return peer, peer_token + ``` + + + + +## Step 6: Create a simple API endpoint + +Build a simple HTTP endpoint that your client apps can call: + + + + + ```ts + process.env.FISHJAM_ID = ""; + process.env.FISHJAM_MANAGEMENT_TOKEN = ""; + // ---cut--- + import express from 'express'; + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const app = express(); + app.use(express.json()); + + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN! + }); + + app.post('/join-room', async (req, res) => { + try { + const { roomName, peerName } = req.body; + + // Create room + const room = await fishjamClient.createRoom(); + + // Add peer + const { peer, peerToken } = await fishjamClient.createPeer(room.id, { + metadata: { name: peerName }, + }); + + res.json({ + roomId: room.id, + peerToken, + }); + } catch (error: any) { + res.status(500).json({ error: error.message }); + } + }); + + app.listen(3000, () => { + console.log('Server running on port 3000'); + }); + ``` + + Don't forget to install Express: + + + + + ```bash + npm install express @types/express + ``` + + + + + + ```bash + yarn add express @types/express + ``` + + + + + + ```bash + pnpm add express @types/express + ``` + + + + + + + + + ```python + import os + from fastapi import FastAPI, HTTPException + from pydantic import BaseModel + from fishjam import FishjamClient, PeerOptions + + app = FastAPI() + + fishjam_client = FishjamClient( + os.environ["FISHJAM_ID"], + os.environ["FISHJAM_MANAGEMENT_TOKEN"] + ) + + class JoinRoomRequest(BaseModel): + room_name: str + peer_name: str + + @app.post("/join-room") + async def join_room(request: JoinRoomRequest): + try: + # Create room + room = fishjam_client.create_room() + + # Add peer + options = PeerOptions(metadata={"name": request.peer_name}) + peer, peer_token = fishjam_client.create_peer(room.id, options=options) + + return { + "room_id": room.id, + "peer_token": peer_token, + } + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + ``` + + Don't forget to install FastAPI: + + + + + ```bash + pip install fastapi[standard] + ``` + + + + + + ```bash + poetry add fastapi[standard] + ``` + + + + + + ```bash + uv add fastapi[standard] + ``` + + + + + + + +## Step 7: Run your server + +Start your backend server: + + + + + ```bash + # If using TypeScript directly + npx tsx server.ts + + # Or compile and run + npx tsc server.ts && node server.js + ``` + + + + + + ```bash + fastapi run --port 3000 + ``` + + + + +## Step 8: Test your backend + +Test your endpoint: + + + + + ```bash + curl -X POST http://localhost:3000/join-room \ + -H "Content-Type: application/json" \ + -d '{"roomName": "test-room", "peerName": "test-user"}' + ``` + + + + + + ```bash + curl -X POST http://localhost:3000/join-room \ + -H "Content-Type: application/json" \ + -d '{"room_name": "test-room", "peer_name": "test-user"}' + ``` + + + + +You should receive a response with: + +- `roomId` / `room_id` - The ID of the created room +- `peerToken` / `peer_token` - Token for the client to join the room + +## Complete example + +Here's a complete working backend: + + + + + ```ts + process.env.FISHJAM_ID = ""; + process.env.FISHJAM_MANAGEMENT_TOKEN = ""; + // ---cut--- + import express from 'express'; + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const app = express(); + app.use(express.json()); + + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN! + }); + + app.post('/join-room', async (req, res) => { + try { + const { roomName, peerName } = req.body; + + const room = await fishjamClient.createRoom(); + const { peer, peerToken } = await fishjamClient.createPeer(room.id, { + metadata: { name: peerName }, + }); + + res.json({ + roomId: room.id, + peerToken, + }); + } catch (error: any) { + res.status(500).json({ error: error.message }); + } + }); + + app.listen(3000, () => { + console.log('Fishjam backend running on port 3000'); + }); + ``` + + + + + + ```python + import os + from fastapi import FastAPI, HTTPException + from pydantic import BaseModel + from fishjam import FishjamClient, PeerOptions + + app = FastAPI() + + fishjam_client = FishjamClient( + os.environ["FISHJAM_ID"], + os.environ["FISHJAM_MANAGEMENT_TOKEN"] + ) + + class JoinRoomRequest(BaseModel): + room_name: str + peer_name: str + + @app.post("/join-room") + async def join_room(request: JoinRoomRequest): + try: + room = fishjam_client.create_room() + options = PeerOptions(metadata={"name": request.peer_name}) + peer, peer_token = fishjam_client.create_peer(room.id, options=options) + + return { + "room_id": room.id, + "peer_token": peer_token + } + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + ``` + + + + +## Next steps + +Now that you have a working backend, explore these guides: + +- [How to set up a production deployment](../how-to/backend/production-deployment) +- [How to handle webhooks and events](../how-to/backend/server-setup#webhooks) +- [How to implement a FastAPI backend](../how-to/backend/fastapi-example) +- [How to implement a Fastify backend](../how-to/backend/fastify-example) + +Or learn more about Fishjam concepts: + +- [Understanding security and tokens](../explanation/security-tokens) +- [Rooms](../explanation/rooms) diff --git a/versioned_docs/version-0.30.0/tutorials/compositions.mdx b/versioned_docs/version-0.30.0/tutorials/compositions.mdx new file mode 100644 index 00000000..d3f6cc48 --- /dev/null +++ b/versioned_docs/version-0.30.0/tutorials/compositions.mdx @@ -0,0 +1,236 @@ +--- +type: tutorial +title: Compositions +sidebar_position: 3.5 +description: Create your first composition end to end, overlaying one video on another and watching the composed result in your browser. +--- + +import useBaseUrl from "@docusaurus/useBaseUrl"; + +# Compositions + +This tutorial walks you through creating your first composition. You will overlay a small player camera on top of full-screen gameplay, publish the result to a livestream, and watch it in your browser. + +Both sources are sample MP4 files, so you need no camera, no encoder, and no publishing tool to get a picture. Nothing else in the tutorial depends on that, so you can swap either one for a live camera afterwards. + +## What you'll build + +```text +[race.mp4] ──┐ + ├─▶ composition ──WHIP──▶ livestream ──WHEP──▶ [your browser] +[player.mp4] ──┘ +``` + +The composed frame puts the race full-screen with the player in a small overlay in the top-left corner, standard gaming stream layout: + +