@vidtreo/recorder 0.9.3 → 0.9.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/dist/index.d.ts +9 -3
- package/dist/index.js +56 -2
- 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
|
/*!
|
|
@@ -10301,7 +10337,7 @@ class RecorderWorker {
|
|
|
10301
10337
|
contentHint: "detail",
|
|
10302
10338
|
hardwareAcceleration: "prefer-hardware",
|
|
10303
10339
|
keyFrameInterval: keyFrameIntervalSeconds,
|
|
10304
|
-
bitrate: config.bitrate
|
|
10340
|
+
bitrate: this.deserializeBitrate(config.bitrate)
|
|
10305
10341
|
};
|
|
10306
10342
|
this.videoSource = new VideoSampleSource(videoSourceOptions);
|
|
10307
10343
|
const output = requireNonNull(this.output, "Output must be initialized before adding video track");
|
|
@@ -11014,6 +11050,24 @@ class RecorderWorker {
|
|
|
11014
11050
|
};
|
|
11015
11051
|
self.postMessage(response);
|
|
11016
11052
|
}
|
|
11053
|
+
deserializeBitrate(bitrate) {
|
|
11054
|
+
if (typeof bitrate === "number") {
|
|
11055
|
+
return bitrate;
|
|
11056
|
+
}
|
|
11057
|
+
if (bitrate === "low") {
|
|
11058
|
+
return QUALITY_LOW;
|
|
11059
|
+
}
|
|
11060
|
+
if (bitrate === "medium") {
|
|
11061
|
+
return QUALITY_MEDIUM;
|
|
11062
|
+
}
|
|
11063
|
+
if (bitrate === "high") {
|
|
11064
|
+
return QUALITY_HIGH;
|
|
11065
|
+
}
|
|
11066
|
+
if (bitrate === "very-high") {
|
|
11067
|
+
return QUALITY_VERY_HIGH;
|
|
11068
|
+
}
|
|
11069
|
+
return QUALITY_HIGH;
|
|
11070
|
+
}
|
|
11017
11071
|
}
|
|
11018
11072
|
new RecorderWorker;
|
|
11019
11073
|
`;
|
|
@@ -11151,7 +11205,7 @@ class WorkerProcessor {
|
|
|
11151
11205
|
width: config.width,
|
|
11152
11206
|
height: config.height,
|
|
11153
11207
|
fps: config.fps,
|
|
11154
|
-
bitrate: config.bitrate,
|
|
11208
|
+
bitrate: serializeBitrate(config.bitrate),
|
|
11155
11209
|
audioCodec,
|
|
11156
11210
|
audioBitrate: config.audioBitrate,
|
|
11157
11211
|
codec,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidtreo/recorder",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.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",
|