feat: update artplayerPluginWebsr to support async upscale initialization

- Changed the return function to be async for handling asynchronous operations.
- Updated the call to startRealtimeUpscale to await its completion, allowing for proper handling of the upscale process with the specified network size option.
This commit is contained in:
Harvey Zhao committed 2026-02-11 23:00:36 +08:00
1 parent 210eb94b75
commit 14807e2633
3 files changed
+9 -5

No files matched your search

+6 -2
View File
@@ -6,7 +6,7 @@ export default function artplayerPluginWebsr(
compare: false,
},
) {
return (art) => {
return async (art) => {
const { $video, $player } = art.template;
const $canvas = document.createElement("canvas");
@@ -21,7 +21,11 @@ export default function artplayerPluginWebsr(
const upscaler = new Upscaler(option);
upscaler.init();
upscaler.startRealtimeUpscale($video, $canvas);
await upscaler.startRealtimeUpscale(
$video,
$canvas,
option.networkSize,
);
// 对比模式
let comparePosition = 50;