Support .gif, .webm, and .mp4 files in the embed player

This commit is contained in:
Paul Frazee
2023-12-23 21:06:22 -08:00
parent 64bad57eb3
commit ec4f0e467a
+13
View File
@@ -10,6 +10,7 @@ export type EmbedPlayerParams =
| {type: 'spotify_song'; songId: string; playerUri: string} | {type: 'spotify_song'; songId: string; playerUri: string}
| {type: 'soundcloud_track'; user: string; track: string; playerUri: string} | {type: 'soundcloud_track'; user: string; track: string; playerUri: string}
| {type: 'soundcloud_set'; user: string; set: string; playerUri: string} | {type: 'soundcloud_set'; user: string; set: string; playerUri: string}
| {type: 'gif'; playerUri: string}
export function parseEmbedPlayerFromUrl( export function parseEmbedPlayerFromUrl(
url: string, url: string,
@@ -111,6 +112,18 @@ export function parseEmbedPlayerFromUrl(
} }
} }
} }
// gifs
if (
urlp.pathname.endsWith('.gif') ||
urlp.pathname.endsWith('.webm') ||
urlp.pathname.endsWith('.mp4')
) {
return {
type: 'gif',
playerUri: url,
}
}
} }
export function getPlayerHeight({ export function getPlayerHeight({