From 20afeb9fa1f916bdd76b9ce9176bb4c99a7ed80f Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 14 May 2025 11:54:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eweb=E7=89=88=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Plugins/WebGLDownloadFile.jslib | 6 ++ .../WebGLDownLoadFile.cs | 10 +++ Assets/WebGLTemplates/MyIndex/index.html | 85 ++++++++++++++----- 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib index dcdfd155..74beea57 100644 --- a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib +++ b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib @@ -23,5 +23,11 @@ mergeInto(LibraryManager.library, { }); } else { } + }, + WebGLDownloadVideo: function(ptr,fileName) { + var url = UTF8ToString(ptr); + var name = UTF8ToString(fileName); + DownloadVideoFromUrl(url,name); + } }); diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs index c93c13bf..0cdb510f 100644 --- a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs @@ -16,6 +16,11 @@ public class WebGLDownLoadFile : MonoSingleton [DllImport("__Internal")] private static extern void WebGLDownloadWord(byte[] array, int size, string reportjson); + [DllImport("__Internal")] + private static extern void WebGLDownloadVideo(string url, string fileName = "实验视频.mp4"); + + + /// /// 下载Word 方法 /// @@ -63,4 +68,9 @@ public class WebGLDownLoadFile : MonoSingleton WebGLDownloadWord(bytes, bytes.Length, reportjson); } + public void DownloadVideo(string url, string fileName = "实验视频.mp4") + { + WebGLDownloadVideo(url, fileName); + } + } diff --git a/Assets/WebGLTemplates/MyIndex/index.html b/Assets/WebGLTemplates/MyIndex/index.html index 0be98416..911b47fe 100644 --- a/Assets/WebGLTemplates/MyIndex/index.html +++ b/Assets/WebGLTemplates/MyIndex/index.html @@ -1,30 +1,30 @@ - + 虚拟实验 | {{{ PRODUCT_NAME }}} - - - - - - - + + + + + + +
- -
-
-
+ +
+
+
+
+
+
+ -
-
-
- +