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

@@ -217,7 +217,7 @@ function artplayerPluginWebsr(option = {
networkSize: "medium",
compare: false
}) {
return (art)=>{
return async (art)=>{
const { $video, $player } = art.template;
const $canvas = document.createElement("canvas");
$player.appendChild($canvas);
@@ -229,7 +229,7 @@ function artplayerPluginWebsr(option = {
$canvas.style.transform = "translate(-50%, -50%)";
const upscaler = new (0, _upscalerDefault.default)(option);
upscaler.init();
upscaler.startRealtimeUpscale($video, $canvas);
await upscaler.startRealtimeUpscale($video, $canvas, option.networkSize);
// 对比模式
let comparePosition = 50;
let isDragging = false;