From ff51114aa187ed94ef6866e921e333b73ec2cfe0 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Fri, 10 May 2024 13:14:31 +0530 Subject: [PATCH] Don't try HEIC conversion when running on Chromecast It crashed the 2nd gen device when we tried... --- web/apps/cast/src/services/render.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web/apps/cast/src/services/render.ts b/web/apps/cast/src/services/render.ts index af31929f04..a304d2dc65 100644 --- a/web/apps/cast/src/services/render.ts +++ b/web/apps/cast/src/services/render.ts @@ -316,19 +316,22 @@ const renderableImageBlob = async (castToken: string, file: EnteFile) => { if (!mimeType) throw new Error(`Could not detect MIME type for file ${fileName}`); - if (mimeType == "image/heif" || mimeType == "image/heic") { - blob = await heicToJPEG(blob); + if (!isChromecast()) { + if (mimeType == "image/heif" || mimeType == "image/heic") { + blob = await heicToJPEG(blob); + } } return new Blob([blob], { type: mimeType }); }; const downloadFile = async (castToken: string, file: EnteFile) => { + const fileName = file.metadata.title; + if (!isImageOrLivePhoto(file)) throw new Error("Can only cast images and live photos"); - // TODO(MR): - const shouldUseThumbnail = false; + const shouldUseThumbnail = isChromecast() && isHEICExtension(fileName); const url = shouldUseThumbnail ? getCastThumbnailURL(file.id)