import type { Attachment } from "../../../types/post";

export const mobilePreviewMediaQuery = "(max-width: 760px)";

export function videoPreviewSource(
  attachment: Attachment,
  useMobilePreview: boolean,
): string {
  if (useMobilePreview && attachment.mobileUrl) {
    return attachment.mobileUrl;
  }
  return attachment.desktopUrl || attachment.url;
}

export function videoMetadataPreviewSource(url: string): string {
  return url.includes("#") ? url : `${url}#t=0.1`;
}
