forked from 77media/video-flow
Merge branch '20251014-fix-video-path' into dev
This commit is contained in:
commit
edb9f8c962
@ -80,15 +80,14 @@ export function createScreenAdapter(): void {
|
|||||||
|
|
||||||
export const downloadVideo = async (url: string) => {
|
export const downloadVideo = async (url: string) => {
|
||||||
try {
|
try {
|
||||||
const modifyUrl = decodeURIComponent(url);
|
const response = await fetch(url);
|
||||||
const response = await fetch(modifyUrl);
|
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
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;
|
||||||
let filename = 'video.mp4';
|
let filename = 'video.mp4';
|
||||||
try {
|
try {
|
||||||
const parsed = new URL(modifyUrl);
|
const parsed = new URL(decodeURIComponent(url));
|
||||||
filename = parsed.pathname.split('/').pop() || 'video.mp4';
|
filename = parsed.pathname.split('/').pop() || 'video.mp4';
|
||||||
if (filename.includes('?')) filename = filename.split('?')[0];
|
if (filename.includes('?')) filename = filename.split('?')[0];
|
||||||
if (filename.includes('#')) filename = filename.split('#')[0];
|
if (filename.includes('#')) filename = filename.split('#')[0];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user