From 877fc29e681b7862ef18c65cd6df2640adbcf94a Mon Sep 17 00:00:00 2001 From: Fath11 Date: Wed, 15 Jan 2025 14:51:56 +0800 Subject: [PATCH] Lily/Video: pause videos when project paused (#1871) Fixes #1671 --- extensions/Lily/Video.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/Lily/Video.js b/extensions/Lily/Video.js index 879625c06a..63a92a6275 100644 --- a/extensions/Lily/Video.js +++ b/extensions/Lily/Video.js @@ -144,6 +144,24 @@ } } }); + + runtime.on("RUNTIME_PAUSED", () => { + for (const skin of renderer._allSkins) { + if (skin instanceof VideoSkin) { + skin.videoElement.pause(); + skin.markVideoDirty(); + } + } + }); + + runtime.on("RUNTIME_UNPAUSED", () => { + for (const skin of renderer._allSkins) { + if (skin instanceof VideoSkin) { + skin.videoElement.play(); + skin.markVideoDirty(); + } + } + }); } getInfo() {