forked from 77media/video-flow
Merge branch '20251014-fix-video-path' into dev
This commit is contained in:
commit
832703407d
@ -86,7 +86,15 @@ export const downloadVideo = async (url: string) => {
|
|||||||
const blobUrl = window.URL.createObjectURL(blob);
|
const blobUrl = window.URL.createObjectURL(blob);
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = blobUrl;
|
a.href = blobUrl;
|
||||||
a.download = modifyUrl.split('/').pop() || 'video.mp4';
|
let filename = 'video.mp4';
|
||||||
|
try {
|
||||||
|
const parsed = new URL(modifyUrl);
|
||||||
|
filename = parsed.pathname.split('/').pop() || 'video.mp4';
|
||||||
|
if (filename.includes('?')) filename = filename.split('?')[0];
|
||||||
|
if (filename.includes('#')) filename = filename.split('#')[0];
|
||||||
|
} catch {}
|
||||||
|
a.download = filename;
|
||||||
|
console.log(a.download);
|
||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user