refactor: implement new playback method for playbutton (wip)

This commit is contained in:
Prayag Prajapati committed 2024-04-24 16:19:45 +05:30
1 parent a7a5d45b33
commit ef003e04a5
27 files changed
+1926 -50

No files matched your search

@@ -0,0 +1,51 @@
/**
* @deprecated - Check @/utils/playback-profiles/index
*/
import { isEdge } from "src/utils/browser-detection";
import { getSupportedAudioCodecs } from "./audio-formats";
import {
hasAacSupport,
hasAc3InHlsSupport,
hasAc3Support,
hasEac3Support,
hasMp3AudioSupport,
} from "./mp4-audio-formats";
/**
* Gets an array with the supported fmp4 codecs
*
* @param videoTestElement - A HTML video element for testing codecs
* @returns List of supported FMP4 audio codecs
*/
export function getSupportedFmp4AudioCodecs(
videoTestElement: HTMLVideoElement,
): string[] {
const codecs = [];
if (hasAacSupport(videoTestElement)) {
codecs.push("aac");
}
if (hasMp3AudioSupport(videoTestElement)) {
codecs.push("mp3");
}
if (hasAc3Support(videoTestElement) && hasAc3InHlsSupport(videoTestElement)) {
codecs.push("ac3");
if (hasEac3Support(videoTestElement)) {
codecs.push("eac3");
}
}
if (getSupportedAudioCodecs("flac") && !isEdge()) {
codecs.push("flac");
}
if (getSupportedAudioCodecs("alac")) {
codecs.push("alac");
}
return codecs;
}