Remove input track descriptors, add async getters on tracks for everything, deprecate old sync getters

This commit is contained in:
Vanilagy
2026-04-10 16:23:17 +02:00
parent aa810fc433
commit 051578c2ca
42 changed files with 1386 additions and 1504 deletions
+3 -3
View File
@@ -306,7 +306,7 @@ const conversion = await Conversion.init({
output,
// Function gets invoked for each video track:
video: (videoTrack) => {
video: async (videoTrack) => {
if (videoTrack.number > 1) {
// Keep only the first video track
return { discard: true };
@@ -314,13 +314,13 @@ const conversion = await Conversion.init({
return {
// Shrink width to 640 only if the track is wider
width: Math.min(videoTrack.displayWidth, 640),
width: Math.min(await videoTrack.getDisplayWidth(), 640),
};
},
// Async functions work too:
audio: async (audioTrack) => {
if (audioTrack.languageCode !== 'rus') {
if (await audioTrack.getLanguageCode() !== 'rus') {
// Keep only Russian audio tracks
return { discard: true };
}