aboutsummaryrefslogtreecommitdiffstats
path: root/tools/feed-video-aspect-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 16:33:09 -0700
committerAdam Soltys <[email protected]>2026-10-07 16:33:09 -0700
commit6dfb59316865093eda01307ee3c95f87511cdf56 (patch)
treebfe60d7eebe74eb00324b92af690942fa061038a /tools/feed-video-aspect-test.js
parent738bace91bcd17c0ab8ba920fe2f0765f6504fc8 (diff)
downloadcoinosv3-6dfb59316865093eda01307ee3c95f87511cdf56.tar.gz
coinosv3-6dfb59316865093eda01307ee3c95f87511cdf56.zip
Feed videos before they play: the picture fills the box with only the play button and size (no seek bar or sound button until playing); hovering the cover no longer paints it over with the app's button grey; upright phone clips (stored sideways with a quarter-turn matrix) paint upright, v1 size caches dropped; a clip the probe found HEVC switches to the copy before fetching the original
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/feed-video-aspect-test.js')
-rw-r--r--tools/feed-video-aspect-test.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/feed-video-aspect-test.js b/tools/feed-video-aspect-test.js
index d052b33..84c0568 100644
--- a/tools/feed-video-aspect-test.js
+++ b/tools/feed-video-aspect-test.js
@@ -20,6 +20,9 @@ const clip = (name, size) => {
if (p.exitCode !== 0) throw new Error('ffmpeg failed');
};
clip('tall.mp4', '360x480'); clip('wide.mp4', '640x360'); clip('told.mp4', '360x640');
+// a phone held upright: the picture stored sideways, with a quarter-turn matrix
+clip('side.mp4', '640x352');
+if (Bun.spawnSync(['ffmpeg', '-y', '-loglevel', 'error', '-i', `${dir}/side.mp4`, '-c', 'copy', '-metadata:s:v:0', 'rotate=90', '-movflags', '+faststart', `${dir}/turned.mp4`]).exitCode !== 0) throw new Error('ffmpeg failed');
// photos: a camera-sized one (painted from a column-sized copy) and a small one
const photo = (name, size) => {
const p = Bun.spawnSync(['ffmpeg', '-y', '-loglevel', 'error', '-f', 'lavfi', '-i', `testsrc=size=${size}`, '-frames:v', '1', `${dir}/${name}`]);
@@ -47,6 +50,7 @@ const notes = [
post(1, 'wide clip ' + base + '/v/wide.mp4'),
// imeta says 9:16; the file is too, but the probe must not be needed
post(2, 'told clip ' + base + '/v/told.mp4', [['imeta', 'url ' + base + '/v/told.mp4', 'm video/mp4', 'dim 1080x1920']]),
+ post(6, 'turned clip ' + base + '/v/turned.mp4'),
post(3, 'broken clip ' + base + '/broken.mp4'),
post(4, 'big photo ' + base + '/i/big.jpg'),
post(5, 'small photo ' + base + '/i/small.jpg'),
@@ -114,6 +118,7 @@ try {
check('a 16:9 clip stays 16:9', Math.abs(ratio(b['wide.mp4']) - 1.78) < 0.02 && /aspect-ratio:640\/360/.test(b['wide.mp4'].style || ''), JSON.stringify(b['wide.mp4']));
check('a clip whose post gives imeta dim paints at that shape, without waiting on the file', Math.abs(ratio(b['told.mp4']) - 0.56) < 0.02 && /aspect-ratio:1080\/1920/.test(b['told.mp4'].style || ''), JSON.stringify(b['told.mp4']));
check('...full width, no taller than the screen', b['told.mp4'] && b['told.mp4'].w > 300 && b['told.mp4'].h <= 845, JSON.stringify(b['told.mp4']));
+ check('an upright phone clip, stored sideways, paints upright', /aspect-ratio:352\/640/.test(b['turned.mp4']?.style || ''), JSON.stringify(b['turned.mp4']));
check('a clip that will not load keeps the 16:9 box', /aspect-ratio:16\/9/.test(b['broken.mp4']?.style || ''), JSON.stringify(b['broken.mp4']));
// a camera-sized photo paints from a column-sized copy, decoded with the page
const imgs = await page.evaluate(() => Object.fromEntries([...document.querySelectorAll('.notes-feed img.note-img')].map((i) => [
@@ -123,7 +128,7 @@ try {
check('a small photo is its own original', imgs.small && imgs.small.src === 'http:' && imgs.small.nw === 800, JSON.stringify(imgs.small));
check('the copy is kept on disk for the next visit', await page.evaluate(async () => !!(await (await caches.open('coinos-media-thumbs-v1')).match(location.origin + '/i/big.jpg'))));
await sleep(1500);
- check('shapes are remembered on the device', await page.evaluate(() => (JSON.parse((window.coinosCache || localStorage).getItem('coinos-video-dims') || '[]')).length >= 3));
+ check('shapes are remembered on the device', await page.evaluate(() => (JSON.parse((window.coinosCache || localStorage).getItem('coinos-video-dims-v2') || '[]')).length >= 3));
check('no page errors', errs.length === 0, errs.join('; ').slice(0, 300));
} catch (e) {
console.log('✗ threw', e.stack); ok = false;