feat: 分享内容稿件

This commit is contained in:
rd
2025-08-01 15:03:16 +08:00
parent 568eeb33b4
commit a9bb9a45c0
11 changed files with 376 additions and 82 deletions

View File

@ -265,3 +265,19 @@ export const formatUploadSpeed = (bytesPerSecond: number): string => {
return `${(bytesPerSecond / (1024 * 1024)).toFixed(2)} MB/s`;
}
};
export function convertVideoUrlToCoverUrl(videoUrl: string): string {
if (!videoUrl || typeof videoUrl !== 'string') {
console.error('Invalid video URL');
return '';
}
const urlWithCovers = videoUrl.replace('/videos/', '/covers/');
const lastDotIndex = urlWithCovers.lastIndexOf('.');
if (lastDotIndex !== -1) {
return urlWithCovers.substring(0, lastDotIndex) + '.jpg';
}
return urlWithCovers + '.jpg';
}