@vidtreo/recorder 0.9.10 → 1.0.4

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://api.vidtreo.com', // Optional, defaults to https://api.vidtreo.com
18
+ apiUrl: 'https://core.vidtreo.com', // Optional, defaults to https://core.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` (optional): Your backend API URL endpoint. Defaults to `https://api.vidtreo.com` if not provided
50
+ - `config.apiUrl` (optional): Your backend API URL endpoint. Defaults to `https://core.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`
@@ -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', // Optional, defaults to https://api.vidtreo.com
284
+ apiUrl: 'https://api.example.com', // Optional, defaults to https://core.vidtreo.com
285
285
  onUploadComplete: (result) => {
286
286
  console.log('Uploaded:', result.uploadUrl);
287
287
  },
@@ -612,7 +612,6 @@ const controller = new RecorderController({
612
612
 
613
613
  await controller.initialize({
614
614
  apiKey: 'your-api-key',
615
- backendUrl: 'https://api.example.com', // Optional, defaults to https://api.vidtreo.com
616
615
  });
617
616
  ```
618
617
 
package/dist/index.d.ts CHANGED
@@ -1025,7 +1025,7 @@ export declare const RESOLUTION_MAP: Record<BackendPreset, {
1025
1025
  width: number;
1026
1026
  height: number;
1027
1027
  }>;
1028
- export declare const DEFAULT_BACKEND_URL = "https://api.vidtreo.com";
1028
+ export declare const DEFAULT_BACKEND_URL = "https://core.vidtreo.com";
1029
1029
  export declare const DEFAULT_TRANSCODE_CONFIG: Readonly<TranscodeConfig>;
1030
1030
  export declare function getDefaultConfigForFormat(format: TranscodeConfig["format"]): TranscodeConfig;
1031
1031
 
package/dist/index.js CHANGED
@@ -189,7 +189,7 @@ var RESOLUTION_MAP = {
189
189
  fhd: { width: 1920, height: 1080 },
190
190
  "4k": { width: 3840, height: 2160 }
191
191
  };
192
- var DEFAULT_BACKEND_URL = "https://api.vidtreo.com";
192
+ var DEFAULT_BACKEND_URL = "https://core.vidtreo.com";
193
193
  var DEFAULT_TRANSCODE_CONFIG = Object.freeze({
194
194
  format: "mp4",
195
195
  fps: 30,
@@ -321,7 +321,8 @@ class ConfigService {
321
321
  if (!response.ok) {
322
322
  throw new Error(`Failed to fetch config: ${response.status} ${response.statusText}`);
323
323
  }
324
- const data = await response.json();
324
+ const apiResponse = await response.json();
325
+ const data = apiResponse.data;
325
326
  if (!data.presetEncoding) {
326
327
  throw new Error("Invalid config response from backend: missing presetEncoding");
327
328
  }
@@ -2952,7 +2953,8 @@ class VideoUploadService {
2952
2953
  const errorMessage = await this.extractErrorFromResponse(response, "Failed to initialize video upload");
2953
2954
  throw new Error(errorMessage);
2954
2955
  }
2955
- return await response.json();
2956
+ const apiResponse = await response.json();
2957
+ return apiResponse.data;
2956
2958
  }
2957
2959
  async extractErrorFromResponse(response, defaultMessage) {
2958
2960
  const errorData = await this.parseJsonResponse(response);
@@ -3003,11 +3005,21 @@ class VideoUploadService {
3003
3005
  });
3004
3006
  }
3005
3007
  parseSuccessResponse(xhr, resolve, reject) {
3006
- const result = this.safeParseJsonFromXhr(xhr);
3007
- if (!result) {
3008
+ const parsed = this.safeParseJsonFromXhr(xhr);
3009
+ if (!parsed) {
3008
3010
  reject(new Error("Failed to parse upload response: invalid JSON"));
3009
3011
  return;
3010
3012
  }
3013
+ const responseData = parsed.data;
3014
+ if (!responseData) {
3015
+ reject(new Error("Failed to parse upload response: missing data"));
3016
+ return;
3017
+ }
3018
+ const result = {
3019
+ videoId: responseData.id,
3020
+ status: responseData.status,
3021
+ uploadUrl: responseData.videoUrl
3022
+ };
3011
3023
  resolve(result);
3012
3024
  }
3013
3025
  parseErrorResponse(xhr, reject) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidtreo/recorder",
3
- "version": "0.9.10",
3
+ "version": "1.0.4",
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",