feat(playback): add per-user transcoding controls (#375)
* feat(playback): add per-user transcoding controls * fix(playback): enforce forced video transcode permission * chore: address transcode control review feedback * fix(playback): recheck transcode permission on audio switch --------- Co-authored-by: Quick104 <31828688+Quick104@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { PlayerFetchError } from "./player-fetch";
|
||||
|
||||
export interface PlaybackPolicyErrorDescription {
|
||||
title: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export function describeTranscodingPolicyError(
|
||||
error: unknown,
|
||||
): PlaybackPolicyErrorDescription | null {
|
||||
if (!(error instanceof PlayerFetchError) || error.status !== 403) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (error.code === "transcoding_disabled") {
|
||||
return {
|
||||
title: "Transcoding is disabled",
|
||||
message: "Transcoding is disabled for your user. Ask your server administrator for access.",
|
||||
};
|
||||
}
|
||||
|
||||
if (error.code === "audio_transcoding_disabled") {
|
||||
return {
|
||||
title: "Audio transcoding is disabled",
|
||||
message:
|
||||
"This item requires audio conversion, but audio transcoding is disabled for your user.",
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user