@vidtreo/recorder 0.9.3 → 0.9.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.d.ts +9 -3
- package/dist/index.js +59 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1961,6 +1961,10 @@ class StreamManager {
|
|
|
1961
1961
|
this.setState("starting");
|
|
1962
1962
|
logger.debug("[StreamManager] State set to 'starting'");
|
|
1963
1963
|
try {
|
|
1964
|
+
logger.debug("[StreamManager] Building constraints", {
|
|
1965
|
+
selectedVideoDeviceId: this.selectedVideoDeviceId,
|
|
1966
|
+
selectedAudioDeviceId: this.selectedAudioDeviceId
|
|
1967
|
+
});
|
|
1964
1968
|
const constraints = {
|
|
1965
1969
|
video: this.buildVideoConstraints(this.selectedVideoDeviceId),
|
|
1966
1970
|
audio: this.buildAudioConstraints(this.selectedAudioDeviceId)
|
|
@@ -3023,6 +3027,35 @@ function isScreenCaptureStream(stream) {
|
|
|
3023
3027
|
return "displaySurface" in settings || videoTrack.label.toLowerCase().includes("screen") || videoTrack.label.toLowerCase().includes("display");
|
|
3024
3028
|
}
|
|
3025
3029
|
|
|
3030
|
+
// src/core/processor/bitrate-utils.ts
|
|
3031
|
+
import {
|
|
3032
|
+
QUALITY_HIGH as QUALITY_HIGH3,
|
|
3033
|
+
QUALITY_LOW as QUALITY_LOW2,
|
|
3034
|
+
QUALITY_MEDIUM as QUALITY_MEDIUM2,
|
|
3035
|
+
QUALITY_VERY_HIGH as QUALITY_VERY_HIGH2
|
|
3036
|
+
} from "mediabunny";
|
|
3037
|
+
function serializeBitrate(bitrate) {
|
|
3038
|
+
if (bitrate === undefined) {
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3041
|
+
if (typeof bitrate === "number") {
|
|
3042
|
+
return bitrate;
|
|
3043
|
+
}
|
|
3044
|
+
if (bitrate === QUALITY_LOW2) {
|
|
3045
|
+
return "low";
|
|
3046
|
+
}
|
|
3047
|
+
if (bitrate === QUALITY_MEDIUM2) {
|
|
3048
|
+
return "medium";
|
|
3049
|
+
}
|
|
3050
|
+
if (bitrate === QUALITY_HIGH3) {
|
|
3051
|
+
return "high";
|
|
3052
|
+
}
|
|
3053
|
+
if (bitrate === QUALITY_VERY_HIGH2) {
|
|
3054
|
+
return "very-high";
|
|
3055
|
+
}
|
|
3056
|
+
return "high";
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3026
3059
|
// src/core/processor/codec-detector.ts
|
|
3027
3060
|
async function detectBestCodec(width, height, bitrate) {
|
|
3028
3061
|
try {
|
|
@@ -8766,7 +8799,10 @@ class Quality {
|
|
|
8766
8799
|
return Math.round(finalBitrate / 1000) * 1000;
|
|
8767
8800
|
}
|
|
8768
8801
|
}
|
|
8802
|
+
var QUALITY_LOW = /* @__PURE__ */ new Quality(0.6);
|
|
8803
|
+
var QUALITY_MEDIUM = /* @__PURE__ */ new Quality(1);
|
|
8769
8804
|
var QUALITY_HIGH = /* @__PURE__ */ new Quality(2);
|
|
8805
|
+
var QUALITY_VERY_HIGH = /* @__PURE__ */ new Quality(4);
|
|
8770
8806
|
|
|
8771
8807
|
// ../../node_modules/mediabunny/dist/modules/src/media-source.js
|
|
8772
8808
|
/*!
|
|
@@ -10295,13 +10331,15 @@ class RecorderWorker {
|
|
|
10295
10331
|
const keyFrameIntervalSeconds = config.keyFrameInterval / fps;
|
|
10296
10332
|
const videoSourceOptions = {
|
|
10297
10333
|
codec: config.codec,
|
|
10298
|
-
|
|
10334
|
+
width: config.width,
|
|
10335
|
+
height: config.height,
|
|
10336
|
+
sizeChangeBehavior: "contain",
|
|
10299
10337
|
bitrateMode: "variable",
|
|
10300
10338
|
latencyMode: "quality",
|
|
10301
10339
|
contentHint: "detail",
|
|
10302
10340
|
hardwareAcceleration: "prefer-hardware",
|
|
10303
10341
|
keyFrameInterval: keyFrameIntervalSeconds,
|
|
10304
|
-
bitrate: config.bitrate
|
|
10342
|
+
bitrate: this.deserializeBitrate(config.bitrate)
|
|
10305
10343
|
};
|
|
10306
10344
|
this.videoSource = new VideoSampleSource(videoSourceOptions);
|
|
10307
10345
|
const output = requireNonNull(this.output, "Output must be initialized before adding video track");
|
|
@@ -11014,6 +11052,24 @@ class RecorderWorker {
|
|
|
11014
11052
|
};
|
|
11015
11053
|
self.postMessage(response);
|
|
11016
11054
|
}
|
|
11055
|
+
deserializeBitrate(bitrate) {
|
|
11056
|
+
if (typeof bitrate === "number") {
|
|
11057
|
+
return bitrate;
|
|
11058
|
+
}
|
|
11059
|
+
if (bitrate === "low") {
|
|
11060
|
+
return QUALITY_LOW;
|
|
11061
|
+
}
|
|
11062
|
+
if (bitrate === "medium") {
|
|
11063
|
+
return QUALITY_MEDIUM;
|
|
11064
|
+
}
|
|
11065
|
+
if (bitrate === "high") {
|
|
11066
|
+
return QUALITY_HIGH;
|
|
11067
|
+
}
|
|
11068
|
+
if (bitrate === "very-high") {
|
|
11069
|
+
return QUALITY_VERY_HIGH;
|
|
11070
|
+
}
|
|
11071
|
+
return QUALITY_HIGH;
|
|
11072
|
+
}
|
|
11017
11073
|
}
|
|
11018
11074
|
new RecorderWorker;
|
|
11019
11075
|
`;
|
|
@@ -11151,7 +11207,7 @@ class WorkerProcessor {
|
|
|
11151
11207
|
width: config.width,
|
|
11152
11208
|
height: config.height,
|
|
11153
11209
|
fps: config.fps,
|
|
11154
|
-
bitrate: config.bitrate,
|
|
11210
|
+
bitrate: serializeBitrate(config.bitrate),
|
|
11155
11211
|
audioCodec,
|
|
11156
11212
|
audioBitrate: config.audioBitrate,
|
|
11157
11213
|
codec,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidtreo/recorder",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.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",
|