@vidtreo/recorder 0.8.6 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ import { VidtreoRecorder } from '@vidtreo/recorder';
15
15
 
16
16
  const recorder = new VidtreoRecorder({
17
17
  apiKey: 'your-api-key',
18
- apiUrl: 'https://your-worker.workers.dev',
18
+ apiUrl: 'https://api.vidtreo.com', // Optional, defaults to https://api.vidtreo.com
19
19
  enableSourceSwitching: true,
20
20
  maxRecordingTime: 300000,
21
21
  onUploadComplete: (result) => {
@@ -47,7 +47,7 @@ Creates a new recorder instance with the specified configuration.
47
47
  **Parameters:**
48
48
 
49
49
  - `config.apiKey` (required): Your API key for backend authentication
50
- - `config.apiUrl` (required): Your backend API URL endpoint
50
+ - `config.apiUrl` (optional): Your backend API URL endpoint. Defaults to `https://api.vidtreo.com` if not provided
51
51
  - `config.enableSourceSwitching` (optional): Enable switching between camera and screen during recording. Default: `false`
52
52
  - `config.enableMute` (optional): Enable mute/unmute functionality. When disabled, `muteAudio()`, `unmuteAudio()`, and `toggleMute()` will throw errors. Default: `true`
53
53
  - `config.enablePause` (optional): Enable pause/resume functionality. When disabled, `pauseRecording()` and `resumeRecording()` will throw errors. Default: `true`
@@ -62,7 +62,7 @@ Creates a new recorder instance with the specified configuration.
62
62
  - `config.onRecordingStop` (optional): Callback invoked when recording stops
63
63
  - `config.onError` (optional): Callback invoked when a stream error occurs
64
64
 
65
- **Throws:** `Error` if `apiKey` or `apiUrl` are missing
65
+ **Throws:** `Error` if `apiKey` is missing
66
66
 
67
67
  #### Methods
68
68
 
@@ -200,7 +200,7 @@ Cleans up all resources, stops active streams, and cancels any pending operation
200
200
  ```typescript
201
201
  interface VidtreoRecorderConfig {
202
202
  apiKey: string;
203
- apiUrl: string;
203
+ apiUrl?: string;
204
204
  enableSourceSwitching?: boolean;
205
205
  enableMute?: boolean;
206
206
  enablePause?: boolean;
@@ -281,7 +281,7 @@ import { VidtreoRecorder } from '@vidtreo/recorder';
281
281
 
282
282
  const recorder = new VidtreoRecorder({
283
283
  apiKey: 'your-api-key',
284
- apiUrl: 'https://api.example.com',
284
+ apiUrl: 'https://api.example.com', // Optional, defaults to https://api.vidtreo.com
285
285
  onUploadComplete: (result) => {
286
286
  console.log('Uploaded:', result.uploadUrl);
287
287
  },
@@ -612,7 +612,7 @@ const controller = new RecorderController({
612
612
 
613
613
  await controller.initialize({
614
614
  apiKey: 'your-api-key',
615
- backendUrl: 'https://api.example.com',
615
+ backendUrl: 'https://api.example.com', // Optional, defaults to https://api.vidtreo.com
616
616
  });
617
617
  ```
618
618
 
@@ -628,7 +628,7 @@ const stream = streamManager.getStream();
628
628
 
629
629
  ## Configuration
630
630
 
631
- Video transcoding configuration is managed through your backend API. The recorder fetches configuration using the provided `apiKey` and `apiUrl`. Default transcoding settings include:
631
+ Video transcoding configuration is managed through your backend API. The recorder fetches configuration using the provided `apiKey` and `apiUrl` (defaults to `https://api.vidtreo.com` if not provided). Default transcoding settings include:
632
632
 
633
633
  - Format: MP4
634
634
  - Frame rate: 30 fps
package/dist/index.d.ts CHANGED
@@ -85,7 +85,7 @@ export {};
85
85
 
86
86
  export type VidtreoRecorderConfig = {
87
87
  apiKey: string;
88
- apiUrl: string;
88
+ apiUrl?: string;
89
89
  enableSourceSwitching?: boolean;
90
90
  enableMute?: boolean;
91
91
  enablePause?: boolean;
@@ -888,6 +888,7 @@ export type BackendConfigResponse = {
888
888
  export declare function mapPresetToConfig(preset: BackendPreset, maxWidth: number, maxHeight: number, format?: TranscodeConfig["format"]): TranscodeConfig;
889
889
 
890
890
  import type { TranscodeConfig } from "../transcode/transcode-types";
891
+ export declare const DEFAULT_BACKEND_URL = "https://api.vidtreo.com";
891
892
  export declare const DEFAULT_TRANSCODE_CONFIG: Readonly<TranscodeConfig>;
892
893
  export declare function getDefaultConfigForFormat(format: TranscodeConfig["format"]): TranscodeConfig;
893
894
 
package/dist/index.js CHANGED
@@ -145,6 +145,7 @@ function getAudioCodecForFormat(format, overrideCodec) {
145
145
  }
146
146
 
147
147
  // src/core/config/config-constants.ts
148
+ var DEFAULT_BACKEND_URL = "https://api.vidtreo.com";
148
149
  var DEFAULT_TRANSCODE_CONFIG = Object.freeze({
149
150
  format: "mp4",
150
151
  fps: 30,
@@ -305,10 +306,11 @@ class ConfigManager {
305
306
  if (!apiKey) {
306
307
  throw new Error("apiKey is required");
307
308
  }
308
- if (!backendUrl) {
309
- throw new Error("backendUrl is required");
310
- }
311
- this.configService = ConfigService.getInstance({ apiKey, backendUrl });
309
+ const normalizedBackendUrl = backendUrl || DEFAULT_BACKEND_URL;
310
+ this.configService = ConfigService.getInstance({
311
+ apiKey,
312
+ backendUrl: normalizedBackendUrl
313
+ });
312
314
  this.currentConfig = await this.configService.fetchConfig();
313
315
  this.configFetched = true;
314
316
  }
@@ -11879,10 +11881,10 @@ class VidtreoRecorder {
11879
11881
  if (!config.apiKey) {
11880
11882
  throw new Error("apiKey is required");
11881
11883
  }
11882
- if (!config.apiUrl) {
11883
- throw new Error("apiUrl is required");
11884
- }
11885
- this.config = config;
11884
+ this.config = {
11885
+ ...config,
11886
+ apiUrl: config.apiUrl || DEFAULT_BACKEND_URL
11887
+ };
11886
11888
  const callbacks = {
11887
11889
  recording: {
11888
11890
  onStateChange: (state) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidtreo/recorder",
3
- "version": "0.8.6",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "Vidtreo SDK for browser-based video recording and transcoding. Features include camera/screen recording, real-time MP4 transcoding, audio level analysis, mute/pause controls, source switching, device selection, and automatic backend uploads. Similar to Ziggeo and Addpipe, Vidtreo provides enterprise-grade video processing capabilities for web applications.",
6
6
  "main": "./dist/index.js",