@vidtreo/recorder 1.7.2 → 1.7.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 +1 -0
- package/dist/index.js +33 -25
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1951,6 +1951,7 @@ type AudioCodecCheckOptions = {
|
|
|
1951
1951
|
sampleRate?: number;
|
|
1952
1952
|
};
|
|
1953
1953
|
type MediabunnyModule = {
|
|
1954
|
+
canEncodeAudio?: (codec: AudioCodec, options: AudioCodecCheckOptions) => Promise<boolean>;
|
|
1954
1955
|
canEncodeVideo?: (codec: VideoCodec, options: VideoCodecCheckOptions) => Promise<boolean>;
|
|
1955
1956
|
getFirstEncodableAudioCodec?: (codecs: AudioCodec[], options: AudioCodecCheckOptions) => Promise<string | null>;
|
|
1956
1957
|
};
|
package/dist/index.js
CHANGED
|
@@ -1475,7 +1475,7 @@ async function buildDeviceCapabilityProfile(options = {}) {
|
|
|
1475
1475
|
|
|
1476
1476
|
// src/core/routing/recording-route-decision.ts
|
|
1477
1477
|
var DEFAULT_MIN_DEVICE_MEMORY_GB = 4;
|
|
1478
|
-
var DEFAULT_MIN_HARDWARE_CONCURRENCY =
|
|
1478
|
+
var DEFAULT_MIN_HARDWARE_CONCURRENCY = 4;
|
|
1479
1479
|
var PLATFORM_KEYWORD_ANDROID2 = "android";
|
|
1480
1480
|
var UNSUPPORTED_GUIDANCE_MESSAGE = "Recording is not supported in this browser context. Use a secure connection, go online, and try a current Chrome or Edge browser.";
|
|
1481
1481
|
function hasSufficientDeviceMemory(profile, minDeviceMemory) {
|
|
@@ -1566,14 +1566,7 @@ function decideRecordingRoute(options) {
|
|
|
1566
1566
|
const hasSmoothEncoding = hasSmoothEncodingCapability(selectedCodec);
|
|
1567
1567
|
const hasPowerEfficientEncoding = hasPowerEfficientEncodingCapability(selectedCodec);
|
|
1568
1568
|
const localRouteBlockers = buildLocalRouteBlockers(options.profile, hasSupportedTargetCodec, hasEnoughDeviceMemory, hasEnoughHardwareConcurrency, hasSupportedEncoding, hasSmoothEncoding, hasPowerEfficientEncoding);
|
|
1569
|
-
if (
|
|
1570
|
-
return {
|
|
1571
|
-
route: "safe-capture-post-recording-transcode",
|
|
1572
|
-
reasonCodes: buildPostRecordingTranscodeReasonCodes(options.profile, localRouteBlockers),
|
|
1573
|
-
selectedCodecId
|
|
1574
|
-
};
|
|
1575
|
-
}
|
|
1576
|
-
if (options.profile.features.isSecureContext && options.profile.features.hasVideoEncoder && hasSupportedTargetCodec && options.profile.network.online !== false && hasEnoughDeviceMemory && hasEnoughHardwareConcurrency && hasSupportedEncoding && hasSmoothEncoding && hasPowerEfficientEncoding) {
|
|
1569
|
+
if (options.profile.features.isSecureContext && options.profile.features.hasVideoEncoder && hasSupportedTargetCodec && options.profile.network.online !== false && hasEnoughDeviceMemory && hasEnoughHardwareConcurrency && hasSupportedEncoding && hasSmoothEncoding) {
|
|
1577
1570
|
return {
|
|
1578
1571
|
route: "local-webcodecs",
|
|
1579
1572
|
reasonCodes: ["webcodecs-supported", "target-codec-supported"],
|
|
@@ -1762,15 +1755,17 @@ async function resolveVideoCodecFromPolicy(options) {
|
|
|
1762
1755
|
}
|
|
1763
1756
|
throw createVideoCodecUnavailableError(options.format, candidates, probeErrors);
|
|
1764
1757
|
}
|
|
1758
|
+
function resolveUnavailableAudioCodec(options) {
|
|
1759
|
+
if (options.shouldThrowIfNoCodecAvailable) {
|
|
1760
|
+
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1761
|
+
}
|
|
1762
|
+
return options.policy.preferredAudioCodec;
|
|
1763
|
+
}
|
|
1765
1764
|
async function resolveAudioCodecFromPolicy(options) {
|
|
1766
1765
|
const dependencies = resolveCodecPolicyResolverDependencies(options.dependencies);
|
|
1767
1766
|
const mediabunnyModule = await dependencies.loadMediabunnyModule();
|
|
1768
1767
|
if (mediabunnyModule === null) {
|
|
1769
|
-
return options
|
|
1770
|
-
}
|
|
1771
|
-
const getFirstEncodableAudioCodec = mediabunnyModule.getFirstEncodableAudioCodec;
|
|
1772
|
-
if (typeof getFirstEncodableAudioCodec !== "function") {
|
|
1773
|
-
return options.policy.preferredAudioCodec;
|
|
1768
|
+
return resolveUnavailableAudioCodec(options);
|
|
1774
1769
|
}
|
|
1775
1770
|
const candidates = buildAudioCandidates(options.overrideCodec, options.policy);
|
|
1776
1771
|
const audioCodecOptions = {};
|
|
@@ -1783,28 +1778,40 @@ async function resolveAudioCodecFromPolicy(options) {
|
|
|
1783
1778
|
if (options.sampleRate !== undefined) {
|
|
1784
1779
|
audioCodecOptions.sampleRate = options.sampleRate;
|
|
1785
1780
|
}
|
|
1781
|
+
const canEncodeAudio = mediabunnyModule.canEncodeAudio;
|
|
1782
|
+
if (typeof canEncodeAudio === "function") {
|
|
1783
|
+
for (const candidate of candidates) {
|
|
1784
|
+
const candidateProbeResults = await Promise.allSettled([
|
|
1785
|
+
canEncodeAudio(candidate, audioCodecOptions)
|
|
1786
|
+
]);
|
|
1787
|
+
const candidateProbeResult = candidateProbeResults[FIRST_RESULT_INDEX];
|
|
1788
|
+
const isCandidateSupported = candidateProbeResult.status === "fulfilled" && candidateProbeResult.value;
|
|
1789
|
+
if (isCandidateSupported) {
|
|
1790
|
+
return candidate;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
return resolveUnavailableAudioCodec(options);
|
|
1794
|
+
}
|
|
1795
|
+
const getFirstEncodableAudioCodec = mediabunnyModule.getFirstEncodableAudioCodec;
|
|
1796
|
+
if (typeof getFirstEncodableAudioCodec !== "function") {
|
|
1797
|
+
return resolveUnavailableAudioCodec(options);
|
|
1798
|
+
}
|
|
1786
1799
|
const probeResults = await Promise.allSettled([
|
|
1787
1800
|
getFirstEncodableAudioCodec(candidates, audioCodecOptions)
|
|
1788
1801
|
]);
|
|
1789
1802
|
const firstProbeResult = probeResults[FIRST_RESULT_INDEX];
|
|
1790
1803
|
if (firstProbeResult.status === "rejected") {
|
|
1791
|
-
return options
|
|
1804
|
+
return resolveUnavailableAudioCodec(options);
|
|
1792
1805
|
}
|
|
1793
1806
|
const resolvedCodec = firstProbeResult.value;
|
|
1794
1807
|
if (resolvedCodec === null) {
|
|
1795
|
-
|
|
1796
|
-
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1797
|
-
}
|
|
1798
|
-
return options.policy.preferredAudioCodec;
|
|
1808
|
+
return resolveUnavailableAudioCodec(options);
|
|
1799
1809
|
}
|
|
1800
1810
|
const canUseResolvedCodec = candidates.includes(resolvedCodec);
|
|
1801
1811
|
if (canUseResolvedCodec) {
|
|
1802
1812
|
return resolvedCodec;
|
|
1803
1813
|
}
|
|
1804
|
-
|
|
1805
|
-
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1806
|
-
}
|
|
1807
|
-
return options.policy.preferredAudioCodec;
|
|
1814
|
+
return resolveUnavailableAudioCodec(options);
|
|
1808
1815
|
}
|
|
1809
1816
|
|
|
1810
1817
|
// src/core/transcode/output-format.ts
|
|
@@ -6305,7 +6312,7 @@ function resolveDeviceError(input) {
|
|
|
6305
6312
|
// package.json
|
|
6306
6313
|
var package_default = {
|
|
6307
6314
|
name: "@vidtreo/recorder",
|
|
6308
|
-
version: "1.7.
|
|
6315
|
+
version: "1.7.4",
|
|
6309
6316
|
type: "module",
|
|
6310
6317
|
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.",
|
|
6311
6318
|
main: "./dist/index.js",
|
|
@@ -21800,7 +21807,8 @@ class WorkerProcessor {
|
|
|
21800
21807
|
policy,
|
|
21801
21808
|
bitrate: audioBitrate,
|
|
21802
21809
|
numberOfChannels: audioConfig?.numberOfChannels,
|
|
21803
|
-
sampleRate: audioConfig?.sampleRate
|
|
21810
|
+
sampleRate: audioConfig?.sampleRate,
|
|
21811
|
+
shouldThrowIfNoCodecAvailable: audioConfig !== null
|
|
21804
21812
|
});
|
|
21805
21813
|
}
|
|
21806
21814
|
async resolveVideoCodec(config, format, policy) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vidtreo/recorder",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.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",
|