diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj
index d6d4478..26b3026 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj
+++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj
@@ -74,6 +74,7 @@
all
+
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/js/svga2html.js b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/js/svga2html.js
index 2c564a8..0745255 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/js/svga2html.js
+++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/js/svga2html.js
@@ -9,12 +9,13 @@
*
* Features:
* - Loads and plays SVGA animation files
- * - Uses SVGA.js library for parsing and playback
+ * - Uses svga or svgaplayerweb library for parsing and playback
* - Automatically starts playback after loading
* - Handles asynchronous loading and mounting of SVGA files
*/
class SvgaViewer {
constructor() {
+ this.useLite = false; // Use SVGA Lite version if true
}
/**
@@ -23,15 +24,32 @@ class SvgaViewer {
*/
async play() {
const path = await chrome.webview.hostObjects.external.GetPath();
- const parser = new SVGA.Parser(); // Only SVGA 2.x supported
- // Because the path is a local file, we need to convert it to a URL format
- parser.load('https://' + path).then(svga => {
- const player = new SVGA.Player(document.getElementById('canvas'));
- player.mount(svga).then(() => {
- player.start();
+ if (this.useLite) {
+ const parser = new SVGA.Parser(); // Only SVGA 2.x supported
+
+ // Because the path is a local file, we need to convert it to a URL format
+ parser.load('https://' + path).then(svga => {
+ const player = new SVGA.Player(document.getElementById('canvas'));
+ player.mount(svga).then(() => {
+ player.start();
+ });
});
- });
+ } else {
+ const size = JSON.parse(await chrome.webview.hostObjects.external.GetSize());
+ const parser = new SVGA.Parser('#canvas'); // Only SVGA 2.x supported
+ const player = new SVGA.Player('#canvas');
+ const canvas = document.getElementById('canvas');
+
+ canvas.width = size.width;
+ canvas.height = size.height;
+
+ // Because the path is a local file, we need to convert it to a URL format
+ parser.load('https://' + path, function (videoItem) {
+ player.setVideoItem(videoItem);
+ player.startAnimation();
+ });
+ }
}
}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/svga2html.html b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/svga2html.html
index 65e9176..79ef540 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/svga2html.html
+++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Resources/Web/svga2html.html
@@ -19,7 +19,9 @@
-
+
+
+