انتقل إلى المحتوى

Frontend

The interface is plain HTML, CSS and JavaScript ES modules:

  • no framework;
  • no bundler;
  • no npm packages;
  • no build step.

Each page is a static file in web/, and its script is loaded with <script type="module" src="/assets/…">. Nothing is loaded from another website: no CDNs and no web fonts. The Content-Security-Policy enforces this.

Pages

URL File Purpose
/ index.html Landing page, sign in, create a workspace (with the emailed code step), forgot password.
/app app.html The library: teams, collections, search, selection, upload, activity bell.
/record record.html The recorder.
/call, /call/{id} call.html Video calls with screen sharing: /call starts one (signed in) and moves to its own address; the waiting room, then the call.
/v/{id} watch.html Video page: player, comments, transcript, summary, sharing, insights, video replies.
/s/{token} share.html Public share page for guests.
/settings settings.html People, invites, account, AI provider, new team.
/join/{token} join.html Accept an invitation.
/reset/{token} reset.html Choose a new password.
/tour tour.html "How Vistilla works": a 10-chapter hands-on tour.

Modules (web/assets)

Module Purpose
api.js Same-origin fetch wrapper (api.get/post/patch/put/del). Throws ApiError with the server's message. Every request has a time limit (45 s, or 180 s when sending a file part), so nothing waits for ever on a lost request. putBlob uses XHR for upload progress, and gives up when an upload stops moving for 90 s.
ui.js Shared helpers: the el() element builder, avatar() (a photo when the person has one, else initials on their colour), toast, confirmDialog, formDialog, avatars, time formatting, reply boxes, and the Track timeline with comment markers.
select.js Draws a styled dropdown over a native <select>, which stays the source of truth. Supports icons (used for provider logos).
player.js Player pieces: control bar, speed, resume position, stall recovery, keyboard shortcuts, the viewer link buttons (each with its site's logo from /media/favicon/{host}).
vreply.js The video reply card in the comment thread: its own frosted controls and progress line.
moments.js The emoji reaction row under the player, with a count per emoji.
record.js The recorder: capture, compositing, blur, mixing, live upload, trim, publish.
call.js Video calls (WebRTC, up to 4 people, each browser sending to every other one; or up to 12 through the server's LiveKit relay, with livekit-client loaded only then from assets/vendor/livekit: each browser publishes "mic", "main" (camera or screen, swapped in place) and "cam" (the camera beside a screen), pictures as copies of the track, and each received track lands on the tile of the participant whose identity is their number in the call). The server only relays the browsers' messages over a WebSocket (/api/calls/{id}/ws). The person arriving offers to each one already there; each connection keeps one sound and one picture slot, and the camera, camera off and a shared screen are swapped into the picture slot with replaceTrack, so nothing is negotiated twice. Reconnects by itself when the socket drops (a server restart). The page is always dark; tiles are sized to fill the room (the column count that gives the biggest 16:9 tiles), and a Web Audio analyser on each voice lights a teal ring on whoever is talking, counts talk time and picks who speaker view shows big (a new voice takes over after 1.5 s). Opus is asked for at up to 128 kb/s with FEC and no DTX (SDP fmtp), cameras at up to 1080p30, and each sender's bitrate is capped by setParameters (divided by √peers; a shared screen keeps its resolution, a camera its frame rate: maintain-framerate). Through the relay the main picture's top simulcast layer gets the chosen quality's full bitrate (2.6 Mb/s for HD), set again by relayTune() when the quality is changed; a shared screen (captured at its own size up to 2560×1440) is published anew as one full-size VP9 layer with L1T3 temporal layers at up to 8 Mb/s, so a slow viewer gets fewer frames, never a smaller screen. Recording draws speaker view onto a 1920×1080 canvas (a shared screen big, the others in a strip of 15 % of the width) (a Web Worker timer keeps it going in a background tab), mixes every voice in Web Audio, and sends VP8/Opus WebM (6 Mb/s) in 5 MiB parts while recording, as the recorder does; a poll on show is drawn over it as a card. Chat and reactions travel as say messages, as do captions (Web Speech API in each speaker's browser; translation with the browser's Translator, else POST /api/calls/translate a few lines at a time), the agenda, polls, whiteboard strokes and screen ink (points normalised to the picture, so they land in the same place for everyone). A newcomer sends sync-req; whoever has the lowest id answers with one signal holding the shared state and the captions so far (kept under 56 KB), which Catch me up summarises with the browser's Summarizer, else POST /api/calls/catchup. Rewind keeps five 10-second Opus pieces of everyone else's mixed voices (each piece its own MediaRecorder, so each plays alone). Recording also sends who-spoke-when to PUT /api/videos/{id}/speakers, the agenda and polls as the description, and a share link to everyone.
ticker-worker.js A Web Worker "clock" so the canvas keeps drawing while the tab is in the background.
call-background.js Background blur and pictures for the camera in a call, on the person's device (MediaPipe, in assets/vendor/mediapipe). Wherever there is a real graphics card, pictures are drawn on it (cardTrack), and the page never waits for the card: it only sends work there (the camera frame as a VideoFrame, then the drawing), and a fence (fenceSync) tells, without waiting, when the card is done. The models' answers have to be read back from the card, which in today's browsers always waits (getBufferSubData is a round trip to the graphics process); that waiting is done in mask-worker.js. At most one picture is having its mask made and one being drawn, so nothing piles up: a busy card means fewer pictures a second, each still the newest, and the page stays free (about 1 ms of its time a picture, against 30 ms and more when all of this ran on the page). Without a real graphics card the older way is used (canvasTrack): everything on the page, drawn on canvases, with the light model alone. stats can be read in the console: pictures shown a second beside what the camera itself gives (in a dim room a camera slows down, and no more can be shown than it takes), what one picture takes, the page's and the worker's time for it, how it is drawn (card or canvas), and what the hand model is doing (hands: how many it sees, how many are drawn, how often it looks). backgroundDebug(view) (or Alt+Shift+M on the call page) switches the card way's debug view: the picture, the raw mask, the smoothed mask, or the three side by side (what is shown is also sent: for testing only).
call-background-gl.js The drawing on the graphics card (WebGL 2), as the big meeting apps do it, in five steps: (1) the 256-wide mask smoothed at its own size; (2) fitted to the picture at half size by joint bilateral upsampling, guided by the camera frame (5×5 reads two half-size spots apart, distance and colour weights), so it follows a shoulder or a finger where the colours change (reaching further, the wall's answer seeped into a pale hand before a white wall); (3) blended with the last picture's mask by motion: the frames now and before are compared at quarter size, and the new mask counts still (0.8) where nothing moved and fully where something did (the thresholds low, 0.012 to 0.05: a pale hand over a white wall changes the picture little, and higher ones left grey trails behind it) (no flicker from the camera's noise, no ghost behind a moving hand); (4) the wall averaged at quarter size counting only what is not the person (normalized blur, blur(frame·(1−m)) / blur(1−m)): widely for the blurred background, closely (σ 8) for the wall's colour beside each edge spot; (5) the person laid over the background with a = smoothstep(0.5, 0.85, mask) for blur and (0.35, 0.85) for pictures, each edge spot's wall colour taken back out ("decontamination", F = clamp((I − (1−a)·B) / max(a, 0.05)), so no pale halo round hair, glasses or fingers against a bright wall), by at most maxChange a channel, which is 0 (off) for now: the mask is only a guess at how much of a spot is wall, and unbounded it drew black streaks along fingers and a dark rim round the hair, and even at 0.25 it darkened fingertips. Every number is in the exported TUNING object (read on every picture, so it can be changed in a running call from the console); DEBUG.view shows the raw mask, the smoothed one, or the three side by side. Measured on an AMD Renoir laptop for a 1280×720 picture: 1.4 ms with blur, 1.0 ms with a picture.
call-background-join.js Who is the person, spot by spot: the light "selfie segmenter" model's answer for each picture, with the hands drawn in, small holes filled, and the whole blended over time. The light model loses a hand held away from the body, and loses it entirely before something dark; so Google's hand model finds the 21 points of each hand, and the hand is drawn into the mask from them: the palm filled, each finger and the thumb a thick line (as thick as a share of the palm's width, so it fits at any distance), the fingertips carried a little past their last point, and the forearm from the wrist back to the body the light model sees (a dark sleeve before something dark is lost too, and the hand hung in the air). A hand whose points are a guess (moved on from an earlier look) is drawn thinner by half of how far off it may be. Around a hand, the person behind it is kept as last seen (the light model loses a face a hand is held over): each spot that had been the person for about half a second (12 pictures) keeps its earlier mask only while it still has the same colour (the worker reads the picture's colours at the mask's size), so the head beside the hand stays and a spot a hand has just left, where the wall shows again, is let go at once; what is kept fades by 1 % a picture. Small holes in the mask are filled (a speck the model left in a shoulder), but not one beside a hand: the gap between a thumb and the fingers is real wall. The card's fitting step then shapes it to the picture's own edges. A bigger segmentation model ("multiclass") was tried for this first and given up: it saw an open palm before a dark door only faintly, its answers came late, and patching them up with guesses about what had moved left sharp patches of wall. Used on the page (canvas way, no hands, blended over time here) and in the mask worker (card way: blended gently here too, as a hand's shape changes between the hand model's looks, and the card's motion blend alone let a moving hand break into pieces).
mask-worker.js The Web Worker that makes each picture's mask for the card way: it is sent a small copy of the camera frame (an ImageBitmap, 256 wide), runs the light model on the graphics card and reads its answer (the wait of each picture, here where it holds nothing up), runs the hand model (HandLandmarker, up to two hands) on the same copy, and answers with the mask. The hand model looks at every picture while a hand is up, where there is time for it (it weighs its own cost against the rest of the work: about 27 pictures a second with each hand drawn from its own picture are preferred to 30 with every other one guessed), at every second picture while there is none, and less often on a busy device, but at every fifth at least while a hand is up (looking more often there made the whole picture slow). Between two looks a hand is moved on as it was moving and drawn thinner the further it was moved (fingers go first, the middle of the palm last); one that moves fast is left out till the next look, and no shape is kept longer than 350 ms: a hand drawn in the wrong place shows a patch of sharp wall. Both models make their first, slow looks while loading (the hand model on a drawn hand too, since the model that finds a hand's points only works once there is a hand), so neither the first camera frames nor the first raised hand hold the picture up. The hand model's file (8 MB) is not waited for longer than 12 seconds: the effect then starts without the hands, and they join in when it has come; if it cannot start at all, pictures go on without it.
i18n.js English or Arabic. In Arabic it swaps every piece of text shown, as it appears (a MutationObserver), for its Arabic from assets/i18n/ar.json: whole strings by exact match, text built from parts by the list's patterns ({0}, {1} are the parts, looked up in turn), and the attributes people read (placeholder, title, aria-label, alt). People's own words (titles, comments, transcripts, summaries) are skipped. theme-boot.js sets <html lang="ar" dir="rtl"> before the first paint and hides the page until the words are in; ?lang=ar in a link chooses. The EN | ع switch sits beside the theme button. Arabic text is set in Cairo (fonts/cairo-arabic.woff2, SIL OFL). ar.json is shared with the Android app.
tvrange.js Turns the compositor's canvas into a limited-range (BT.709 "TV") I420 video track on the GPU (WebGL2, then VideoFrames into a MediaStreamTrackGenerator). A canvas's own stream is full range and looked washed out, light tints going white, in players that take every video for limited range; screen-only recordings are limited range already. Falls back to canvas.captureStream where the browser lacks a part (Firefox).
app.js Library page, including the Storage card (GET /api/orgs/{id}/storage) and uploads from a file (in 16 MiB parts above 64 MiB).
upload-meter.js The upload meter (percentage, bar, speed, time left) shared by the recorder's Publish and the library's file upload.
watch.js Video page, including the video-reply studio.
share.js Share page.
settings.js Settings page. Your account is read-only until Edit; Save is enabled only once something differs. A new photo is cropped in the browser to the middle square, drawn at 256 × 256 and sent as a JPEG (PUT /api/me/avatar) on Save.
index.js, join.js, reset.js, tour.js The other pages.
palette.js Ctrl+K quick search and navigation.
guide.js Hands-on guided tours. Four dark panels frame one real control, which stays clickable: a click step moves on when the control is used, a go step hands over to the next page's tour (through sessionStorage), and a look step has a Next button. A tour never starts by itself: the page's ? button plays it (the library's also from ?guide=1), and only a tour handed over from the page before carries on unasked. Used by the library, recorder, video, settings and share pages.
theme-boot.js Sets light or dark before the first paint, to avoid a flash.
theme.js The light/dark toggle, synced across tabs.
no-autofill.js Turns browser autofill off on every field, including fields added later.
app-shell.js Registers the service worker and the install button on the welcome tour page.
vendor-marks.js Simple SVG marks for the AI providers.

Stylesheets:

  • base.css: the design system and most components;
  • player.css, watch.css, tour.css.

Theming

  • Colours are CSS custom properties on :root. The dark theme redefines them under :root[data-theme="dark"].
  • The brand colour is teal, --brand: #2a7d94.
  • Neutrals are slightly teal-tinted greys, and the video stage is always black.
  • The chosen theme is stored in localStorage["vistilla.theme"]. Without a choice, the system preference is used.
  • Fonts are system stacks. Inter and JetBrains Mono are used only if installed locally.
  • Glass is blurred (backdrop-filter) only where something moves behind it: over a video, or a bar that content scrolls under. Over a still page (the language switch, pills, the Meetings cards, the library's view and sort pills) it is a translucent fill only: a blur there shows nothing, and Chromium redrew it in part when something near it changed, leaving a lighter strip.

Recording in the browser (record.js)

getDisplayMedia -+                       +- mic (getUserMedia)
getUserMedia ----+                       +- tab / loopback audio
 (camera)        v                       v
         canvas compositor          Web Audio mixer
   (screen + blur boxes +           (AudioContext >
    round camera bubble)             MediaStreamDestination)
         | captureStream(30)              |
         +--------------+-----------------+
                        v
                  MediaRecorder  (VP9/Opus WebM preferred)
                        | 1-second chunks
                        v
           5 MiB parts > PUT /api/videos/{id}/parts/{n}
  • Codec: the first one the browser supports from video/webm;codecs=vp9,opus, then vp8,opus, then video/webm, then video/mp4.
  • Bitrate: width × height × fps × 0.04, kept between 1 and 4 Mbit/s (2.5 Mbit/s asked of a 1080p screen, and VP9 spends less on a mostly still one), with Opus audio at 64 kbit/s. That is about a gigabyte for a two-hour meeting.
  • Keyframes every second, so the server can trim without re-encoding.
  • Camera bubble: a circle 26% of the frame height in the bottom-right corner, with a white ring.
  • Blur: every frame, each box is shrunk to about 45 cells per frame height and stretched back smoothly, which smears it beyond reading. The blur is part of the recorded pixels.
  • Live upload:
    • When recording starts, the page reserves a video with POST /api/videos (live: true).
    • Chunks are collected into 5 MiB parts and uploaded as they fill. A failed part is retried up to 3 times, after 1, 2 and 4 seconds (not for errors like 4xx that would fail again).
    • If that fails, Publish sends the rest of the file, from the first piece that did not arrive, in 5 MiB pieces again (a proxy in front refuses one big request). Only a store that cannot take pieces gets the whole file with PUT /api/videos/{id}/blob.
    • Each piece goes through putBlob, so the upload meter counts bytes as they leave: percentage, size sent, speed over the last 8 seconds, and time left.
  • Publish:
    • The poster is a frame from the preview, taken inside the kept range, drawn at most 1280 px wide as a JPEG (quality 0.78), and sent with PUT …/thumbnail.
    • Then POST …/complete sends the length, size and trim.
    • The browser opens /v/{id}.
  • If the page is closed before publishing, a keepalive DELETE removes the reservation.

Video replies

The video-reply studio in watch.js records the camera, or the screen if chosen, with a plain MediaRecorder at 2.5 Mbit/s. It uploads with the same POST /api/videos (with reply_to_comment_id) → PUT …/blob → POST …/complete flow.

A rounded light-teal tile with a dark teal screen and a pale play triangle on it, and under it a progress bar played up to an orange knob.

  • assets/logo.svg is the drawing. Every other copy is made from it:
    • the mark beside the word Vistilla in the top bar (.brand-mark) and the tab icon;
    • assets/icons/: favicon-32.png, apple-touch-icon.png (180 px, square, the phone rounds it), icon-192.png and icon-512.png, and icon-maskable-512.png (square, the artwork shrunk into the circle every mask keeps); logo-1024.png is the original artwork;
    • the server's inline /favicon.svg (web.rs), the docs' logo (docs/assets/logo.svg) and the Android vectors.

Installable app (PWA)

  • manifest.webmanifest:
    • starts at /app in its own window;
    • theme colour teal;
    • icons, plus shortcuts to Record and Library.
  • sw.js:
    • caches nothing;
    • its only job is to show a friendly "You are offline" page when a navigation fails, which reloads itself when the connection returns.