diff --git a/src/lib/strings/embed-player.ts b/src/lib/strings/embed-player.ts index 307692935..8579c2e99 100644 --- a/src/lib/strings/embed-player.ts +++ b/src/lib/strings/embed-player.ts @@ -29,6 +29,7 @@ export const embedPlayerSources = [ 'flickr', 'bandcamp', 'streamplace', + 'plyr', ] as const export type EmbedPlayerSource = (typeof embedPlayerSources)[number] @@ -53,6 +54,7 @@ export type EmbedPlayerType = | 'bandcamp_album' | 'bandcamp_track' | 'streamplace_stream' + | 'plyr_track' export const externalEmbedLabels: Record = { youtube: 'YouTube', @@ -67,7 +69,8 @@ export const externalEmbedLabels: Record = { soundcloud: 'SoundCloud', flickr: 'Flickr', bandcamp: 'Bandcamp', - streamplace: 'Streamplace' + streamplace: 'Streamplace', + plyr: 'plyr.fm', } /** @@ -112,6 +115,19 @@ export function parseEmbedPlayerFromUrl( return undefined } + // plyr.fm + if (urlp.hostname === 'plyr.fm' || urlp.hostname === 'www.plyr.fm') { + const [__, type, id] = urlp.pathname.split('/') + + if (type === 'track' && id) { + return { + type: 'plyr_track', + source: 'plyr', + playerUri: `https://plyr.fm/embed/track/${id}?autoplay=1`, + } + } + } + // youtube if (urlp.hostname === 'youtu.be') { const videoId = urlp.pathname.split('/')[1] @@ -588,6 +604,8 @@ export function getPlayerAspect({ return {height: 232} case 'soundcloud_track': return {height: 165} + case 'plyr_track': + return {height: 165} case 'apple_music_song': return {height: 150} case 'bandcamp_album': diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts index 74c46c0fc..f52951b66 100644 --- a/src/state/persisted/schema.ts +++ b/src/state/persisted/schema.ts @@ -151,6 +151,7 @@ const schema = z.object({ flickr: z.enum(externalEmbedOptions).optional(), bandcamp: z.enum(externalEmbedOptions).optional(), streamplace: z.enum(externalEmbedOptions).optional(), + plyr: z.enum(externalEmbedOptions).optional(), }) .optional(), invites: z.object({