Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

529 B
Raw Blame
import { formatSize } from '../format';

const VIDEO_SIZE_LIMIT = 100 * 1024 * 1024; // 100MB in bytes

export interface VideoValidationResult {
  actualSize?: string;
  isValid: boolean;
  maxSize?: string;
}

export const validateVideoFileSize = (file: File): VideoValidationResult => {
  if (!file.type.startsWith('video/')) {
    return { isValid: true };
  }

  const isValid = file.size <= VIDEO_SIZE_LIMIT;

  return {
    actualSize: formatSize(file.size),
    isValid,
    maxSize: formatSize(VIDEO_SIZE_LIMIT),
  };
};