@vidtreo/recorder 1.7.2 → 1.7.3
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 +31 -16
- 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
|
@@ -1762,15 +1762,17 @@ async function resolveVideoCodecFromPolicy(options) {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
throw createVideoCodecUnavailableError(options.format, candidates, probeErrors);
|
|
1764
1764
|
}
|
|
1765
|
+
function resolveUnavailableAudioCodec(options) {
|
|
1766
|
+
if (options.shouldThrowIfNoCodecAvailable) {
|
|
1767
|
+
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1768
|
+
}
|
|
1769
|
+
return options.policy.preferredAudioCodec;
|
|
1770
|
+
}
|
|
1765
1771
|
async function resolveAudioCodecFromPolicy(options) {
|
|
1766
1772
|
const dependencies = resolveCodecPolicyResolverDependencies(options.dependencies);
|
|
1767
1773
|
const mediabunnyModule = await dependencies.loadMediabunnyModule();
|
|
1768
1774
|
if (mediabunnyModule === null) {
|
|
1769
|
-
return options
|
|
1770
|
-
}
|
|
1771
|
-
const getFirstEncodableAudioCodec = mediabunnyModule.getFirstEncodableAudioCodec;
|
|
1772
|
-
if (typeof getFirstEncodableAudioCodec !== "function") {
|
|
1773
|
-
return options.policy.preferredAudioCodec;
|
|
1775
|
+
return resolveUnavailableAudioCodec(options);
|
|
1774
1776
|
}
|
|
1775
1777
|
const candidates = buildAudioCandidates(options.overrideCodec, options.policy);
|
|
1776
1778
|
const audioCodecOptions = {};
|
|
@@ -1783,28 +1785,40 @@ async function resolveAudioCodecFromPolicy(options) {
|
|
|
1783
1785
|
if (options.sampleRate !== undefined) {
|
|
1784
1786
|
audioCodecOptions.sampleRate = options.sampleRate;
|
|
1785
1787
|
}
|
|
1788
|
+
const canEncodeAudio = mediabunnyModule.canEncodeAudio;
|
|
1789
|
+
if (typeof canEncodeAudio === "function") {
|
|
1790
|
+
for (const candidate of candidates) {
|
|
1791
|
+
const candidateProbeResults = await Promise.allSettled([
|
|
1792
|
+
canEncodeAudio(candidate, audioCodecOptions)
|
|
1793
|
+
]);
|
|
1794
|
+
const candidateProbeResult = candidateProbeResults[FIRST_RESULT_INDEX];
|
|
1795
|
+
const isCandidateSupported = candidateProbeResult.status === "fulfilled" && candidateProbeResult.value;
|
|
1796
|
+
if (isCandidateSupported) {
|
|
1797
|
+
return candidate;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
return resolveUnavailableAudioCodec(options);
|
|
1801
|
+
}
|
|
1802
|
+
const getFirstEncodableAudioCodec = mediabunnyModule.getFirstEncodableAudioCodec;
|
|
1803
|
+
if (typeof getFirstEncodableAudioCodec !== "function") {
|
|
1804
|
+
return resolveUnavailableAudioCodec(options);
|
|
1805
|
+
}
|
|
1786
1806
|
const probeResults = await Promise.allSettled([
|
|
1787
1807
|
getFirstEncodableAudioCodec(candidates, audioCodecOptions)
|
|
1788
1808
|
]);
|
|
1789
1809
|
const firstProbeResult = probeResults[FIRST_RESULT_INDEX];
|
|
1790
1810
|
if (firstProbeResult.status === "rejected") {
|
|
1791
|
-
return options
|
|
1811
|
+
return resolveUnavailableAudioCodec(options);
|
|
1792
1812
|
}
|
|
1793
1813
|
const resolvedCodec = firstProbeResult.value;
|
|
1794
1814
|
if (resolvedCodec === null) {
|
|
1795
|
-
|
|
1796
|
-
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1797
|
-
}
|
|
1798
|
-
return options.policy.preferredAudioCodec;
|
|
1815
|
+
return resolveUnavailableAudioCodec(options);
|
|
1799
1816
|
}
|
|
1800
1817
|
const canUseResolvedCodec = candidates.includes(resolvedCodec);
|
|
1801
1818
|
if (canUseResolvedCodec) {
|
|
1802
1819
|
return resolvedCodec;
|
|
1803
1820
|
}
|
|
1804
|
-
|
|
1805
|
-
throw new Error(`No encodable audio codec available for format: ${options.format}`);
|
|
1806
|
-
}
|
|
1807
|
-
return options.policy.preferredAudioCodec;
|
|
1821
|
+
return resolveUnavailableAudioCodec(options);
|
|
1808
1822
|
}
|
|
1809
1823
|
|
|
1810
1824
|
// src/core/transcode/output-format.ts
|
|
@@ -6305,7 +6319,7 @@ function resolveDeviceError(input) {
|
|
|
6305
6319
|
// package.json
|
|
6306
6320
|
var package_default = {
|
|
6307
6321
|
name: "@vidtreo/recorder",
|
|
6308
|
-
version: "1.7.
|
|
6322
|
+
version: "1.7.3",
|
|
6309
6323
|
type: "module",
|
|
6310
6324
|
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
6325
|
main: "./dist/index.js",
|
|
@@ -21800,7 +21814,8 @@ class WorkerProcessor {
|
|
|
21800
21814
|
policy,
|
|
21801
21815
|
bitrate: audioBitrate,
|
|
21802
21816
|
numberOfChannels: audioConfig?.numberOfChannels,
|
|
21803
|
-
sampleRate: audioConfig?.sampleRate
|
|
21817
|
+
sampleRate: audioConfig?.sampleRate,
|
|
21818
|
+
shouldThrowIfNoCodecAvailable: audioConfig !== null
|
|
21804
21819
|
});
|
|
21805
21820
|
}
|
|
21806
21821
|
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.3",
|
|
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",
|