@vidtreo/recorder 1.0.0-rc1 → 1.0.5
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/dist/index.js +16 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
3007
|
-
if (!
|
|
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": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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",
|