remove aac again, fix track selection when decoding is stuck

AuthorKonata <konata@posteo.jp>
Date
Commit9077ceab030661722100c886f12b8d2455c151b9
Parent47b4a8a
4 files changed, 2 insertions(+), 17 deletions(-)
▾Mserver/src/utils.ts
@@ -160,7 +160,6 @@ export function convertWithFFmpeg(filePath: string, bitrate: number, format: Med
let codec = undefined;
let container = undefined;
let mimeType = undefined;
let flags: string[] = [];
switch (format) {
case MediaFormat["opus/ogg"]: {
codec = "libopus";
@@ -192,19 +191,12 @@ export function convertWithFFmpeg(filePath: string, bitrate: number, format: Med
mimeType = 'audio/webm; codecs="vorbis"';
break;
}
case MediaFormat.aac: {
codec = "libfdk_aac";
container = "mp4";
mimeType = "audio/aac";
flags = ["-movflags", "frag_keyframe+empty_moov"];
break;
}
default: {
throw new Error(`Unsupported format: ${format}`);
}
}
const cmd = Bun.spawn(
["ffmpeg", "-i", filePath, "-vn", "-c:a", codec, "-f", container, "-b:a", bitrate.toString(), ...flags, "-"],
["ffmpeg", "-i", filePath, "-vn", "-c:a", codec, "-f", container, "-b:a", bitrate.toString(), "-"],
{
stdin: "ignore",
stdout: "pipe",
▾Mshared/types.ts
@@ -33,5 +33,4 @@ export enum MediaFormat {
mp3 = "mp3",
"vorbis/ogg" = "vorbis/ogg",
"vorbis/webm" = "vorbis/webm",
aac = "aac",
}
▾Mwebclient/src/App.tsx
@@ -13,7 +13,6 @@ import PlaylistManager from "./components/PlaylistManager";
import { BUILD_HASH } from "./build-info";
//TODO: change download actions?
//TODO: AAC support
//TODO: search
//TODO: remember scroll position for parent directories
//TODO: merge fileblobs and filemetadata, try putting signals in the onlinetree
@@ -85,6 +84,7 @@ const App: Component = () => {
let audioElement!: HTMLAudioElement;
function handlePlayerError(e: unknown) {
if (e instanceof Error && e.name === "AbortError") return;
if (e instanceof Error && e.name === "NotSupportedError") {
toast(
"Playing track failed: Format not supported, check if the server is up when playing a remote file, or change your transcoding settings",
@@ -95,11 +95,8 @@ const App: Component = () => {
}
}
let playRequested = false; //solves errors about aborting playback
// Play a track from the playlist
async function playTrack(track: PlaylistItem) {
if (playRequested) return;
playRequested = true;
try {
const src = await getSrc(track.path, options(), isOffline());
if (!src) return;
@@ -125,8 +122,6 @@ const App: Component = () => {
currentTime: 0,
});
handlePlayerError(e);
} finally {
playRequested = false;
}
}
▾Mwebclient/src/components/OptionsModal.tsx
@@ -120,7 +120,6 @@ export default function OptionsModal(props: OptionsModalProps) {
<option>{MediaFormat.mp3}</option>
<option>{MediaFormat["vorbis/ogg"]}</option>
<option>{MediaFormat["vorbis/webm"]}</option>
<option>{MediaFormat.aac}</option>
</select>
</div>
<div>