The plugin shows its own advice for the reasons the user can act on and
the player's message for the rest. reason.code is looked up among the
codes the plugin knows; an unknown code from a newer player falls
through to the message, which names the GPU and what to do.
const { reason } = await plugin.video.upscaling.state();
// Advice for the codes this plugin knows; any other code shows the message.
const advice: Partial<Record<UpscalingReasonCode, string>> = {
driver: "Update the NVIDIA driver to 530 or newer.",
rendering: "Turn on Picture ▸ GPU Rendering and restart.",
};
if (reason) console.log(advice[reason.code] ?? reason.message);
Why the GPU's video upscaler does not work, as a stable kebab-case code. A newer player may add codes: compare with the ones you handle and show UpscalingReason.message for the rest. The codes, in the order the player checks them (the first that holds is reported):
platformno-gpudrivergpu-unsupportedrenderingadapterdecodinguncheckedset(false), which never starts the check;state()andset(true)always check first.decodingandrenderingwhile GPU rendering is still starting can pass during the run, soset(true)accepts them and keeps the request; every other reason holds until the player restarts, andset(true)rejects it. Turning upscaling off is always accepted.