add mse codecs to console debug on errors

This commit is contained in:
Josh Hawkins 2025-11-24 07:11:43 -06:00
parent 086330a542
commit a76c4c180e

View File

@ -82,6 +82,7 @@ function MSEPlayer({
[key: string]: (msg: { value: string; type: string }) => void;
}>({});
const msRef = useRef<MediaSource | null>(null);
const mseCodecRef = useRef<string | null>(null);
const wsURL = useMemo(() => {
return `${baseUrl.replace(/^http/, "ws")}live/mse/api/ws?src=${camera}`;
@ -93,6 +94,10 @@ function MSEPlayer({
console.error(
`${camera} - MSE error '${error}': ${description} See the documentation: https://docs.frigate.video/configuration/live/#live-player-error-messages`,
);
if (mseCodecRef.current) {
// eslint-disable-next-line no-console
console.error(`MSE codec in use: ${mseCodecRef.current}`);
}
onError?.(error);
},
[camera, onError],
@ -299,6 +304,9 @@ function MSEPlayer({
onmessageRef.current["mse"] = (msg) => {
if (msg.type !== "mse") return;
// Store the codec value for error logging
mseCodecRef.current = msg.value;
let sb: SourceBuffer | undefined;
try {
sb = msRef.current?.addSourceBuffer(msg.value);