feat: add basic video support

This commit is contained in:
Xyphyn committed 2023-08-03 11:26:16 -07:00
1 parent ce59f413a0
commit 4bb6f67e52
2 files changed
+11 -9

No files matched your search

+5 -3
View File
@@ -4,8 +4,10 @@ export const isImage = (url: string | undefined) => {
return /\.(jpeg|jpg|gif|png|svg|bmp|webp)$/i.test(new URL(url).pathname)
}
export const isVideo = (url: string | undefined) => {
if (!url) return false
export const isVideo = (inputUrl: string | undefined) => {
if (!inputUrl) return false
return new URL(url).pathname.toLowerCase().endsWith('.mp4')
const url = new URL(inputUrl).pathname.toLowerCase()
return url.endsWith('mp4') || url.endsWith('webm') || url.endsWith('mov')
}