This commit is contained in:
Radhakrishnan Pachyappan 2026-06-26 13:16:11 +05:30 committed by GitHub
commit 8a3d63b771
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 0 deletions

View file

@ -7,6 +7,10 @@ let fileType;
let pendingFiles = 0;
let formatSelected = false;
const urlParams = new URLSearchParams(window.location.search);
const defaultTo = urlParams.get("to");
const defaultConverter = urlParams.get("converter");
dropZone.addEventListener("dragover", (e) => {
e.preventDefault();
dropZone.classList.add("dragover");
@ -59,6 +63,24 @@ function handleFile(file) {
.then((html) => {
selectContainer.innerHTML = html;
updateSearchBar();
if (defaultTo) {
const targetBtn = Array.from(document.querySelectorAll(".target")).find((t) =>
defaultConverter
? t.dataset.target === defaultTo && t.dataset.converter === defaultConverter
: t.dataset.target === defaultTo,
);
if (targetBtn) {
const convertToEl = document.querySelector("select[name='convert_to']");
const convertToInputEl = document.querySelector("input[name='convert_to_search']");
convertToEl.value = targetBtn.dataset.value;
convertToInputEl.value = `${targetBtn.dataset.target} using ${targetBtn.dataset.converter}`;
formatSelected = true;
if (pendingFiles === 0 && fileNames.length > 0) {
convertButton.disabled = false;
}
}
}
})
.catch(console.error);
}

View file

@ -670,6 +670,7 @@ export const properties = {
"vvc",
"w64",
"wav",
"wav-3cx",
"wbmp",
"webm",
"webp",
@ -708,6 +709,12 @@ export async function convert(
message = "Done: resized to 256x256";
}
if (convertTo === "wav-3cx") {
// 3CX telephony preset: mono, 8 kHz, 16-bit PCM (pcm_s16le is explicit to
// avoid FFMPEG_OUTPUT_ARGS overriding the codec and breaking 3CX playback)
extraArgs.push("-ac", "1", "-ar", "8000", "-c:a", "pcm_s16le");
}
if (convertTo.split(".").length > 1) {
// Support av1.mkv and av1.mp4 and h265.mp4 etc.
const split = convertTo.split(".");

View file

@ -49,6 +49,8 @@ export const normalizeOutputFiletype = (filetype: string): string => {
return "fbx";
case "assjson":
return "json";
case "wav-3cx":
return "wav";
default:
return lowercaseFiletype;
}