diff --git a/public/pausio/capture.css b/public/pausio/capture.css index 08db02f5..e9b414ce 100644 --- a/public/pausio/capture.css +++ b/public/pausio/capture.css @@ -12,3 +12,66 @@ @media(max-width:850px){.layout{grid-template-columns:1fr;gap:20px}.camera{margin:auto}.transport{margin-left:auto;margin-right:auto}.settings{margin-top:5px}.heading{max-width:540px;margin-left:auto;margin-right:auto}.capture-column{max-width:640px;margin:auto;width:100%}} @media(max-width:440px){.shell{padding:0 14px}.topbar{height:59px}.brand{font-size:19px}.brand-page{font-size:11px}.privacy{font-size:10px}.layout{padding:23px 0}.heading{margin-bottom:14px}.heading h1{font-size:27px}.state-chip{padding:6px 8px;font-size:9px}.camera{max-height:min(67svh,690px);width:auto;max-width:100%;margin:auto;aspect-ratio:9/16}.transport{width:100%}.settings{padding:17px}.download-panel{padding:16px}.format-pill{font-size:9px}.prompter{left:5%;right:5%;top:4%}.prompter-scroll{height:calc(var(--font-size,26px) * 3.2)}footer span{display:none}} @media(prefers-reduced-motion:reduce){*{transition:none!important}} + +/* Mobile-first capture v2: show the ENTIRE camera frame, never enlarge/crop it + simply to fill a decorative 9:16 viewport. A wider camera source is preserved. */ +.camera video { object-fit: contain; object-position: center; } +.camera { background: #050a10; } +.prompter { left: 4%; right: 4%; top: 3%; padding: 10px 13px 12px; + background: linear-gradient(180deg, rgba(7,13,21,.84), rgba(7,13,21,.68)); +} +.prompter.middle { top: 34%; } +.prompter-scroll { + height: min(calc(var(--font-size, 26px) * 1.33 * var(--prompter-lines, 5)), 32svh); +} +.prompter-scroll > div { line-height: 1.33; text-align: center; } +.settings-summary { display: none; } +.settings-details, .settings details { display: block; } +.gobbo-quick { font-weight: 800; letter-spacing: -.5px; } +.settings .field small { color: #a6b9c9; line-height: 1.5; font-weight: 400; font-size: 11px; } +@media (max-width: 850px) { + .shell { padding: 0 14px; } + .topbar { height: 52px; } + .layout { grid-template-columns: 1fr; gap: 14px; padding: 12px 0 25px; } + .capture-column { max-width: 510px; } + .heading { min-height: 30px; align-items: center; margin-bottom: 9px; } + .heading h1 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; + overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; } + .heading .eyebrow { font-size: 11px; margin: 0; } + .camera { + width: min(100%, 460px); + height: clamp(300px, calc(100svh - 177px), 680px); + min-height: 300px; + max-width: none; + max-height: none; + aspect-ratio: auto; + margin-inline: auto; + border-radius: 15px; + } + .prompter { left: 3%; right: 3%; top: 2.5%; padding: 9px 12px 11px; } + .prompter.middle { top: 32%; } + .lens-hint { margin-bottom: 7px; } + .transport { margin: 9px auto 0; width: min(100%, 460px); gap: 8px; } + .transport .button { min-height: 51px; padding: 10px 13px; } + .transport .button.compact { width: 49px; flex: 0 0 49px; font-size: 20px; } + .camera-hud { bottom: 10px; left: 10px; right: 10px; } + .settings { padding: 0; margin-top: 2px; } + .settings-summary { display: flex; align-items: center; flex-wrap: wrap; + justify-content: space-between; column-gap: 12px; min-height: 53px; + padding: 14px 17px; font-size: 13px; font-weight: 750; cursor: pointer; + list-style-position: inside; } + .settings-summary span { color: #a8b8c8; font-weight: 450; font-size: 11px; } + .settings details[open] > .settings-summary { border-bottom: 1px solid #2d3d4f; } + .settings-head { padding-top: 18px; } + .settings details > :not(summary) { margin-left: 17px; margin-right: 17px; } + .settings details > input[type=range] { width: calc(100% - 34px); } + .settings details > :last-child { margin-bottom: 20px; } + .status { width: min(100%, 460px); margin: 5px auto 0; padding: 9px 0; } + .download-panel { margin-left: auto; margin-right: auto; } +} +@media (max-width: 360px) { + .privacy { font-size: 9px; } + .format-pill { font-size: 9px; padding: 7px 9px; } + .prompter-scroll { height: min(calc(var(--font-size, 26px) * 1.33 * var(--prompter-lines, 5)), 29svh); } + .settings-summary span { font-size: 10px; } +} diff --git a/public/pausio/capture.js b/public/pausio/capture.js index e1c2fbf6..7803b554 100644 --- a/public/pausio/capture.js +++ b/public/pausio/capture.js @@ -11,7 +11,9 @@ next: $("new-take"), flip: $("switch-camera"), pause: $("toggle-scroll"), countdown: $("countdown"), panel: $("download-panel"), download: $("download-video"), share: $("share-video"), details: $("file-details"), script: $("script-input"), - speed: $("speed"), font: $("font-size"), position: $("prompter-position"), + speed: $("speed"), font: $("font-size"), lines: $("gobbo-lines"), + position: $("prompter-position"), framing: $("framing-mode"), + details: $("gobbo-settings"), edit: $("edit-gobbo"), autoplay: $("auto-scroll") }; const STORE_KEY = "pausio-mobile-capture-v1"; @@ -33,6 +35,7 @@ els.next.hidden = next !== "finished"; els.flip.hidden = next !== "preview"; els.pause.hidden = next !== "preview" && next !== "recording"; + els.edit.hidden = ["countdown", "recording", "stopping", "finished"].includes(next); els.panel.hidden = next !== "finished"; els.placeholder.hidden = !["idle", "error", "starting"].includes(next); els.live.hidden = ["finished", "idle", "error", "starting"].includes(next); @@ -42,7 +45,7 @@ els.state.textContent = {idle:"PRONTO", error:"ERRORE", starting:"APERTURA…", preview:"CAMERA ATTIVA", countdown:"PREPARATI", recording:"REC", stopping:"SALVATAGGIO", finished:"TAKE PRONTO"}[next] || "PRONTO"; const locked = ["countdown","recording","stopping"].includes(next); - for (const el of [els.script,els.speed,els.font,els.position,els.autoplay]) el.disabled = locked; + for (const el of [els.script,els.speed,els.font,els.lines,els.position,els.framing,els.autoplay]) el.disabled = locked; els.pause.textContent = pausedScroll ? "▶" : "Ⅱ"; els.pause.setAttribute("aria-label", pausedScroll ? "Riprendi scorrimento" : "Pausa scorrimento"); } @@ -53,6 +56,8 @@ if (typeof data.script === "string") els.script.value = data.script.slice(0, 15000); if (Number.isFinite(data.speed)) els.speed.value = Math.max(50, Math.min(220, data.speed)); if (Number.isFinite(data.font)) els.font.value = Math.max(20, Math.min(44, data.font)); + if (Number.isFinite(data.lines)) els.lines.value = Math.max(3, Math.min(7, data.lines)); + if (["wide","social"].includes(data.framing)) els.framing.value = data.framing; if (["top","middle"].includes(data.position)) els.position.value = data.position; if (typeof data.autoplay === "boolean") els.autoplay.checked = data.autoplay; } catch (_) { /* Storage unavailable in private browsing. */ } @@ -61,15 +66,18 @@ try { localStorage.setItem(STORE_KEY, JSON.stringify({version:1, script:els.script.value.slice(0,15000), speed:+els.speed.value, font:+els.font.value, + lines:+els.lines.value, framing:els.framing.value, position:els.position.value, autoplay:els.autoplay.checked})); } catch (_) { /* Capture and downloads do not require localStorage. */ } } function refreshPrompter() { els.text.textContent = els.script.value.trim() || "Scrivi uno script nelle impostazioni."; els.prompter.style.setProperty("--font-size", els.font.value + "px"); + els.prompter.style.setProperty("--prompter-lines", els.lines.value); els.prompter.classList.toggle("middle", els.position.value === "middle"); $("speed-value").textContent = els.speed.value + " parole/min"; $("font-value").textContent = els.font.value + " px"; + $("lines-value").textContent = els.lines.value + " righe"; } function stopAnimation() { cancelAnimationFrame(raf); raf = 0; lastFrame = 0; } function tick(now) { @@ -124,11 +132,16 @@ els.camera.disabled = true; els.flip.disabled = true; await releaseCamera(); - const candidate = await navigator.mediaDevices.getUserMedia({ - video: {facingMode: {ideal:facing}, width:{ideal:1080}, height:{ideal:1920}, - aspectRatio:{ideal:9/16}, frameRate:{ideal:30}}, - audio: true - }); + // Default to a fuller 3:4 sensor frame rather than forcing a 9:16 + // acquisition crop (which can look digitally zoomed on Android). + // "Social" is an explicit user opt-in to tighter 9:16 capture. + const social = els.framing.value === "social"; + const video = social + ? {facingMode:{ideal:facing}, width:{ideal:1080}, height:{ideal:1920}, + aspectRatio:{ideal:9/16}, frameRate:{ideal:30}} + : {facingMode:{ideal:facing}, width:{ideal:960}, height:{ideal:1280}, + aspectRatio:{ideal:3/4}, frameRate:{ideal:30}}; + const candidate = await navigator.mediaDevices.getUserMedia({video, audio:true}); stream = candidate; els.live.srcObject = stream; els.live.classList.toggle("mirrored", facing === "user"); @@ -151,7 +164,8 @@ } const dimensions = candidate.getVideoTracks()[0]?.getSettings?.() || {}; const width = dimensions.width, height = dimensions.height; - els.format.textContent = width && height ? width + "×" + height + " · originale" : "Formato automatico"; + els.format.textContent = width && height ? width + "×" + height + " · originale" : + (social ? "9:16 richiesto" : "Campo ampio richiesto"); if (width && height && width >= height) { notice("La fotocamera registra in orizzontale (" + width + "×" + height + "). Ruota il telefono in verticale e riattiva la fotocamera prima del take.", true); } else { @@ -274,6 +288,17 @@ await activateCamera(); } els.camera.addEventListener("click", activateCamera); + els.edit.addEventListener("click", () => { + els.details.open = true; + els.details.scrollIntoView({behavior:"smooth", block:"start"}); + }); + els.framing.addEventListener("change", async () => { + remember(); + if (mode === "preview") { + notice("Aggiorno il campo visivo della fotocamera…"); + await activateCamera(); + } + }); els.live.addEventListener("click", () => { if (mode !== "preview") return; const pending = els.live.play(); @@ -288,9 +313,9 @@ els.pause.addEventListener("click", () => { pausedScroll = !pausedScroll; els.pause.textContent = pausedScroll ? "▶" : "Ⅱ"; els.pause.setAttribute("aria-label",pausedScroll ? "Riprendi scorrimento" : "Pausa scorrimento"); }); els.download.addEventListener("click", () => { savedAfterRecording = true; notice("Download richiesto. Verifica che il file sia realmente presente in Download o File prima di uscire."); }); els.share.addEventListener("click", shareRecording); - for (const el of [els.script,els.speed,els.font,els.position,els.autoplay]) { + for (const el of [els.script,els.speed,els.font,els.lines,els.position,els.autoplay]) { el.addEventListener(el === els.script ? "input" : "change", () => { refreshPrompter(); remember(); }); - if (el === els.speed || el === els.font) el.addEventListener("input", () => { refreshPrompter(); remember(); }); + if ([els.speed, els.font, els.lines].includes(el)) el.addEventListener("input", () => { refreshPrompter(); remember(); }); } document.addEventListener("visibilitychange", () => { if (document.hidden && (mode === "recording" || mode === "countdown")) { @@ -303,7 +328,10 @@ event.preventDefault(); event.returnValue = ""; } }); - prefs(); refreshPrompter(); setMode("idle"); + prefs(); + if (window.matchMedia("(max-width:850px)").matches) els.details.open = false; + refreshPrompter(); + setMode("idle"); notice("Pagina pronta. Tocca Attiva fotocamera e consenti l'accesso a fotocamera e microfono."); if (!window.isSecureContext && !["localhost","127.0.0.1"].includes(location.hostname)) { els.camera.disabled = true; diff --git a/public/pausio/index.html b/public/pausio/index.html index 7d4c862b..b8699239 100644 --- a/public/pausio/index.html +++ b/public/pausio/index.html @@ -7,8 +7,8 @@ Registra · Pausio - - + +
@@ -36,7 +36,7 @@
00:00 - 9:16 · formato automatico + Campo ampio · formato originale
@@ -47,6 +47,7 @@ +