about summary refs log tree commit diff
path: root/src/lib/strings/embed-player.ts
diff options
context:
space:
mode:
authorJan-Olof Eriksson <jan-olof.eriksson@iki.fi>2024-02-21 13:22:13 +0200
committerGitHub <noreply@github.com>2024-02-21 13:22:13 +0200
commit38fd4282f88ac020ee72d5a6324191ee80798450 (patch)
tree18f713fed78387f1cb83ac0818b4f1333fad6db8 /src/lib/strings/embed-player.ts
parent1269e76071ea7c79b93d1a58e80b74746c71ecd9 (diff)
parentf88b16525498584f81ea7f594a63623fc5dc7ce9 (diff)
downloadvoidsky-38fd4282f88ac020ee72d5a6324191ee80798450.tar.zst
Merge branch 'bluesky-social:main' into main
Diffstat (limited to 'src/lib/strings/embed-player.ts')
-rw-r--r--src/lib/strings/embed-player.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/strings/embed-player.ts b/src/lib/strings/embed-player.ts
index 21a575b91..1cf3b1293 100644
--- a/src/lib/strings/embed-player.ts
+++ b/src/lib/strings/embed-player.ts
@@ -343,45 +343,45 @@ export function parseEmbedPlayerFromUrl(
   }
 }
 
-export function getPlayerHeight({
+export function getPlayerAspect({
   type,
-  width,
   hasThumb,
+  width,
 }: {
   type: EmbedPlayerParams['type']
-  width: number
   hasThumb: boolean
-}) {
-  if (!hasThumb) return (width / 16) * 9
+  width: number
+}): {aspectRatio?: number; height?: number} {
+  if (!hasThumb) return {aspectRatio: 16 / 9}
 
   switch (type) {
     case 'youtube_video':
     case 'twitch_video':
     case 'vimeo_video':
-      return (width / 16) * 9
+      return {aspectRatio: 16 / 9}
     case 'youtube_short':
       if (SCREEN_HEIGHT < 600) {
-        return ((width / 9) * 16) / 1.75
+        return {aspectRatio: (9 / 16) * 1.75}
       } else {
-        return ((width / 9) * 16) / 1.5
+        return {aspectRatio: (9 / 16) * 1.5}
       }
     case 'spotify_album':
     case 'apple_music_album':
     case 'apple_music_playlist':
     case 'spotify_playlist':
     case 'soundcloud_set':
-      return 380
+      return {height: 380}
     case 'spotify_song':
       if (width <= 300) {
-        return 155
+        return {height: 155}
       }
-      return 232
+      return {height: 232}
     case 'soundcloud_track':
-      return 165
+      return {height: 165}
     case 'apple_music_song':
-      return 150
+      return {height: 150}
     default:
-      return width
+      return {aspectRatio: 16 / 9}
   }
 }