forked from 77media/video-flow
新增 兼容encode过的下载url
This commit is contained in:
parent
4a1362d626
commit
7beab504af
@ -80,15 +80,14 @@ export function createScreenAdapter(): void {
|
||||
|
||||
export const downloadVideo = async (url: string) => {
|
||||
try {
|
||||
const modifyUrl = decodeURIComponent(url);
|
||||
const response = await fetch(modifyUrl);
|
||||
const response = await fetch(url);
|
||||
const blob = await response.blob();
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = blobUrl;
|
||||
let filename = 'video.mp4';
|
||||
try {
|
||||
const parsed = new URL(modifyUrl);
|
||||
const parsed = new URL(decodeURIComponent(url));
|
||||
filename = parsed.pathname.split('/').pop() || 'video.mp4';
|
||||
if (filename.includes('?')) filename = filename.split('?')[0];
|
||||
if (filename.includes('#')) filename = filename.split('#')[0];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user