From 243f7057b797c7c536cff559b5ba23ae109017af Mon Sep 17 00:00:00 2001 From: Ben Miller Date: Sun, 28 Dec 2025 15:51:56 -0700 Subject: [PATCH] fix(media-manager): resolve video preview issues and stabilize tests - Backend (MediaService): - Implemented robust contentUrl generation for Drive files using drive.google.com/uc pattern. - Added mimeType exposure to unified media state. - Frontend (MediaManager): - Replaced video tag with iframe embedding the Google Drive Preview player (/preview) for reliable playback. - Fixed syntax error in console logging causing UI freeze. - Updated gallery card logic to prioritize video content URLs. - Tests (Integration): - Refactored mediaManager.integration.test.ts to align with new logic. - Mocked DriveApp completely to support orphan adoption flows. - Updated file renaming expectations to support timestamped filenames. - Documentation: - Updated MEMORY.md with video preview strategy. --- MEMORY.md | 4 +- src/MediaManager.html | 53 ++++++++++++++++++++++----- src/mediaManager.integration.test.ts | 30 ++++++++++----- src/services/MediaService.ts | 6 ++- src/services/MockDriveService.ts | 2 + test_output.txt | Bin 5570 -> 19340 bytes test_output_2.txt | Bin 0 -> 10982 bytes 7 files changed, 74 insertions(+), 21 deletions(-) create mode 100644 test_output_2.txt diff --git a/MEMORY.md b/MEMORY.md index 08be64c..3e78551 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -37,6 +37,8 @@ This project (`product_inventory`) integrates Google Sheets with Shopify. It ser - **Google Photos Picker**: - The `baseUrl` returned by the Picker API is hidden inside `mediaFile.baseUrl` (not top-level). - Downloading this URL requires an **Authorization header** with the script's OAuth token, or it returns 403. - - `DriveApp.createFile(blob)` is fragile with blobs from `UrlFetchApp`. We use a 2-step fallback: 1. Sanitize with `Utilities.newBlob()`. 2. Fallback to **Advanced Drive Service** (`Drive.Files.create` / `v3`) if standard creation fails. +- **Video Previews**: + - HTML5 `