diff --git a/index/videos/template-video.html b/index/videos/template-video.html
index 5b25188b..e06c8108 100644
--- a/index/videos/template-video.html
+++ b/index/videos/template-video.html
@@ -98,12 +98,18 @@
});
function downloadVideo() {
- var link = document.createElement('a');
- link.href = videoUrl;
- link.download = videoUrl.split('/').pop();
+ fetch(videoUrl)
+ .then(response => response.blob())
+ .then(blob => {
+ const link = document.createElement('a');
+ link.href = URL.createObjectURL(blob);
+ link.download = videoTitle + '.mp4'; // 设置下载文件名
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
+ URL.revokeObjectURL(link.href);
+ })
+ .catch(error => console.error('Error downloading the video:', error));
}