Design an Armrest In-Flight Entertainment System
Medium · System Design · Software Engineer · Onsite
Prompt
Design the software architecture and user interface for an aircraft seat-armrest entertainment unit built around a compact, high-pixel-density 4-inch touch display. For its initial release, the unit provides two passenger-facing experiences: live flight progress (interactive route map, altitude, speed, and remaining flight time) and an onboard music player.
Your design should satisfy these operational and product constraints:
- Turbulent cabin ergonomics: Frequent cabin movement makes fine finger control difficult, requiring generous, forgiving touch targets and resilient interaction handling.
- Offline-first seat execution: Audio tracks and map assets reside on the seat unit's local storage, while live flight telemetry arrives from an onboard cabin server over an internal aircraft LAN/Wi-Fi link that can drop intermittently.
- Visual and motor accessibility: The interface must include high-contrast display modes and accessible navigation paths for passengers with low vision, tremors, or limited reach.
- Extensible module architecture: Future cabin capabilities—such as meal and beverage ordering or duty-free catalogs—must plug into the application without inflating boot payload size, startup latency, or baseline memory consumption.
Scope & Expectations
- Telemetry & media data design: Local data schemas and onboard API protocols for ingesting flight updates from the aircraft server, caching state during cabin network drops, and storing/updating curated and passenger playlists.
- Small-screen UX & input resilience: Screen layout, shallow tap navigation, accessibility controls, and input state management suited to a shaking 4-inch armrest display.
- Modular client runtime: Process boundaries and lazy module-loading mechanics that keep initial load fast and isolate faults as new features are added.
- Success & health KPIs: Three concrete metrics that track passenger engagement, UI interaction friction, and fleet-wide seat availability.
Step-by-step walkthrough
Clarify requirements and hardware constraints
Designing an armrest in-flight entertainment (IFE) interface is very different from designing a mobile app. Before drawing servers or screens, we must pin down the physical environment because turbulence, accidental elbow touches, and shaky cabin Wi-Fi shape every engineering decision.
Hardware and cabin assumptions
- Screen geometry: A 4.0-inch landscape capacitive touch panel at 1280 × 720 pixels. The diagonal is
sqrt(1280² + 720²) ≈ 1,469 px, giving ~367 pixels per inch (ppi), or ~14.5 pixels per millimeter. That means high pixel sharpness, but a tiny physical surface of only ~89 × 50 mm (roughly the size of a credit card). - Physical buttons: Four tactile hardware keys sit beside the screen:
Volume -,Volume +,Next(moves a highlight ring to the next item), andOK(activates the highlighted item). - Seat hardware: Each seat has a small embedded Linux computer (ARM processor, 2 GB RAM, 32 GB flash storage). Visual screens run inside a lightweight embedded browser engine so UI modules can load dynamically, while audio playback and networking run as separate native Linux processes.
- Cabin network: Roughly 300 seats connect to an onboard flight server at the front of the cabin. That flight server reads aircraft sensors through a one-way, read-only avionics gateway (so passenger software can never send commands back to flight controls). Cabin Wi-Fi or LAN links between the flight server and a seat can drop for seconds or minutes at a time.
- Content lifecycle: All music and map tiles live on the seat's local flash storage before takeoff. Nothing streams from the ground during flight; catalog updates happen at the gate between flights.
- Anonymous seat sessions: Passengers do not log in. A fresh seat session starts before each flight leg and is wiped automatically after landing.
Functional requirements
- Flight telemetry view: Live aircraft position on an offline map, altitude, ground speed, local time at destination, and estimated time remaining.
- Music player: Browse airline-curated playlists and genres, play/pause/skip tracks, adjust volume, and build a temporary
"My Playlist"for the current flight. - Accessibility and settings: High-contrast theme, enlarged text sizes, language switcher, slow-tap timing mode, and spoken audio labels (read-aloud) in the headphones.
- Modular extensibility: Support adding future modules such as food ordering and duty-free shopping without slowing startup time or increasing baseline memory use.
Non-functional requirements
- Turbulence-safe input: If a bump jolts the passenger's finger mid-tap, the UI must perform either the intended button's action or nothing at all—never an adjacent button's action.
- Snappy responsiveness: Visual press feedback within 100 ms; Home screen interactive within 2 s of UI process boot; opening a feature module within 500 ms.
- Offline-first operation: Music, playlists, and settings work with zero network connectivity; flight telemetry degrades smoothly when cabin packets drop.
- Fault isolation and availability: Usable for >= 99.5% of powered seat-minutes; a UI crash or freeze must never interrupt music playing in the headphones or block crew PA (public address) announcements.
- Strict privacy: No passenger-identifying touch histories leave the seat; telemetry uploaded for product metrics is aggregated into anonymous counters.
- Screen geometry: A 4.0-inch landscape capacitive touch panel at 1280 × 720 pixels. The diagonal is
Back-of-the-envelope sizing
Let us translate those physical and fleet numbers into concrete layout, bandwidth, storage, and memory budgets so we know where the real bottlenecks are.
SCREEN & TOUCH BUDGET Visible area 1280 x 720 px at ~14.5 px/mm -> ~89 mm wide x 50 mm tall Touch target sizes Standard phone minimum is 7-9 mm; for turbulence we use: Primary rail buttons: 15 x 15 mm (~217 px), gaps >= 2 mm Secondary list rows: 13 mm tall (~188 px), gaps >= 2 mm Remaining canvas 89 mm - 15 mm (left rail) - 15 mm (right rail) - 4 mm (gaps) = ~55 mm wide x 50 mm tall content area Fits either a 2 x 2 grid of ~26 x 24 mm tiles, OR 3 list rows/page CABIN NETWORK (300 seats per aircraft; 100 aircraft = 30,000 seats) Telemetry frame 1 update/s, ~200 bytes (lat, lon, altitude, speed, flags) UDP multicast 1 packet/s = 200 B/s total across the cabin LAN Unicast fallback 300 seats x 200 B/s = 60 KB/s (still tiny for LAN bandwidth) SEAT STORAGE (32 GB flash per seat) Music audio 2,000 tracks x 3.5 min (210 s) at 128 kbit/s (16 KB/s) = ~3.36 MB/track -> ~6.7 GB of audio + ~0.1 GB cover art/SQLite Offline map tiles World zoom 0-6 = (4^7 - 1)/3 = 5,461 tiles (~110 MB) + high-zoom flight-corridor tiles -> ~0.3 GB total Flash partition map OS + apps: 2 GB | Content Slot A: 7.5 GB | Content Slot B: 7.5 GB Seat session + event queue: 0.5 GB | Free headroom/wear-leveling: ~14.5 GB GATE CONTENT SYNC (over a 1 Gbit/s flight-server link, ~800 Mbit/s usable = 100 MB/s) Full unicast copy 7.1 GB x 300 seats = 2,130 GB -> ~21,300 s (~5.9 hours: too slow!) Monthly 15% delta ~1.05 GB x 300 seats = 315 GB -> ~3,150 s (~53 min on the ground) MEMORY & ANALYTICS RAM (2 GB total) OS + services: ~500 MB | Audio process: ~50 MB | UI budget: <= 400 MB Analytics volume Raw touches (~1 per 10 s on a 10 h flight) = 3,600/seat -> ~216 MB/plane On-seat KPI counters = ~4 KB/seat/flight -> ~1.2 MB/planeThree takeaways that drive the design:
- Screen real estate is the tightest constraint: An 89 × 50 mm surface with turbulence-sized targets fits only about 9 touchable items at once (five persistent rail buttons plus a 2 × 2 grid or 3 paged rows). Every screen must focus on a single task with zero tiny icons or keyboards.
- Cabin bandwidth is tiny, so availability—not throughput—is the network problem: 200 bytes per second is effortless to transmit; what matters is keeping the UI calm and responsive when Wi-Fi drops for two minutes.
- Gate updates must be incremental: Copying 7 GB to 300 seats one by one takes nearly six hours, which exceeds typical gate turnarounds. Storing files by cryptographic hash (so seats download only changed tracks into a second storage slot) shrinks monthly updates under an hour.
High-level architecture: isolating UI, audio, and network
A naive design runs one browser app that streams telemetry over cabin Wi-Fi and plays
<audio>tags directly inside the web page. If cabin Wi-Fi stalls, screens hang; if a new shopping module leaks memory and crashes the page, the passenger's music cuts out mid-song.Instead, we split the seat software into three independent local processes connected over
localhost(loopback communication inside the same Linux device, which never drops even when cabin Wi-Fi is completely offline):Ground (Airline Cloud) Aircraft Head-End +----------------------+ at the gate +---------------------------------------------+ | Content & bundle |-------------->| Flight Server | | builder (signed) | | - Read-only avionics gateway | | | post-flight | - Telemetry publisher (1 Hz UDP multicast) | | Fleet KPI warehouse |<--------------| - Content blob server & module registry | +----------------------+ | - Anonymous KPI collector & crew panel | +----------------------+----------------------+ | Cabin Wi-Fi / LAN (intermittent) +---------------------------------------v----------------------+ | Armrest Seat Unit (Linux, 2 GB RAM, 32 GB Flash) | | | | +------------------------+ local IPC +----------+ | | | Seat Agent (native) |<------------------->| Audio | | | | - Telemetry cache & | | Service | | | | dead-reckoning | | (native) | | | | - A/B content sync | | - Decode | | | | - SQLite catalog/state | | - Queue | | | | - Local event counters | | - PA mute| | | | - Process watchdog | +----------+ | | +-----------+------------+ | | | localhost HTTP + WebSocket (always up) | | +-----------v---------------------------------------------+ | | | UI Runtime (embedded browser engine, <= 400 MB RAM) | | | | Core Shell: TapRecognizer, Screen State Machine, | | | | Design Tokens, i18n, Module Loader | | | | Lazy Modules: [Flight Map] [Music] [Food*] [DutyFree*] | | | +---------------------------------------------------------+ | | Hardware: 4-inch Touch Panel + Keys (Vol-, Vol+, Next, OK) | +--------------------------------------------------------------+- Seat Agent (native daemon): The only process allowed to touch the cabin network. It listens for flight telemetry, serves cached data to the UI over
localhost, manages SQLite databases, queues analytics counters, and runs a watchdog (a health monitor that restarts the UI if the UI misses three 1-second heartbeats). - Audio Service (native daemon): Decodes AAC audio files from local flash, manages the active play queue, and listens directly to hardware volume keys and crew PA mute signals via IPC (Inter-Process Communication, a fast local message channel between processes on the same machine). Even if the UI restarts, the song never skips.
- UI Runtime (embedded browser): Renders screens, processes touch and button focus, and dynamically loads feature modules from flash storage.
- Seat Agent (native daemon): The only process allowed to touch the cabin network. It listens for flight telemetry, serves cached data to the UI over
API contracts: cabin network vs. localhost
Because the Seat Agent sits between the cabin network and the UI, we have two clean API boundaries: an intermittent network API (Flight Server <-> Seat Agent) and an instant local API (Seat Agent <-> UI).
1. FLIGHT SERVER <-> SEAT AGENT (over intermittent cabin LAN / Wi-Fi) UDP Multicast 239.10.0.1:5000 Push TelemetryFrame every 1 s (~200 B) to all 300 seats GET /v1/telemetry/latest HTTP fallback snapshot at boot or if multicast is silent >= 3 s GET /v1/flight Static route & airport metadata (cached via ETag version header) GET /v1/content/manifest Signed list of {path, sha256, size_bytes} for the active cycle GET /v1/blobs/{sha256} Content-addressed file download (supports HTTP Range resume) POST /v1/events:batch {session_id, from_seq, counters[]} -> {acked_through_seq} POST /v1/health:batch {seat_unit_id, from_seq, diagnostics[]} -> {acked_through_seq} 2. SEAT AGENT <-> UI RUNTIME (over localhost HTTP + WebSocket, < 5 ms latency) GET /local/v1/bootstrap {flight, telemetry, freshness, player, settings, saved_screen, modules[]} WS /local/v1/stream Pushes 1 Hz telemetry, freshness state, PA/seatbelt flags, track changes POST /local/v1/player {action: "play" | "pause" | "next" | "prev", playlist_id?, index?} GET /local/v1/playlists List curated playlists + current flight's "My Playlist" GET /local/v1/playlists/{id}?page=1&page_size=3 Returns exactly 1 screen page (3 tracks) POST /local/v1/my-playlist {track_id} (and DELETE /local/v1/my-playlist/{track_id}) PUT /local/v1/settings {contrast, text_size, locale, read_aloud, slow_tap} PUT /local/v1/nav-state {screen, params} (persisted on every screen transition) POST /local/v1/kpi-events {kind, screen, target_id} (incremented in local counters)Why each API choice fits the cabin constraints:
- UDP multicast + HTTP fallback for telemetry: UDP multicast broadcasts one 200-byte packet on the network so all 300 seats receive it simultaneously without the server tracking 300 open connections. Because Wi-Fi multicast packets are not acknowledged by receivers, bursts of interference can drop packets; if a seat sees 3 seconds of silence, the Seat Agent polls
GET /v1/telemetry/latestonce per second until multicast resumes. - Content-addressed blobs (
sha256): Naming every audio file, cover image, and module bundle by its SHA-256 cryptographic hash means a seat never re-downloads unchanged songs, can resume interrupted downloads with HTTPRangeheaders, and detects corrupted bytes immediately. - Separate
events:batchandhealth:batchendpoints: Behavioral KPI counters carry only a random per-flightsession_id(never the physical seat number, sinceseat + flight + datecan identify a real passenger on the airline's manifest). Hardware crash logs carryseat_unit_idwith zero user interaction data so maintenance crews still know which armrest needs repair. - Page-sized playlist responses (
page_size=3): Pagination matches the physical 3-row screen height so the embedded browser never renders or scrolls long DOM lists.
- UDP multicast + HTTP fallback for telemetry: UDP multicast broadcasts one 200-byte packet on the network so all 300 seats receive it simultaneously without the server tracking 300 open connections. Because Wi-Fi multicast packets are not acknowledged by receivers, bursts of interference can drop packets; if a seat sees 3 seconds of silence, the Seat Agent polls
Data model: flight telemetry, music catalog, and seat sessions
We separate read-only airline content from ephemeral passenger state in two distinct SQLite database files on local flash so wiping a seat between flights is instant and safe.
1. IN-MEMORY TELEMETRY CACHE (updated at 1 Hz in Seat Agent) TelemetryFrame: flight_id, seq, received_at_monotonic_ms lat_deg, lon_deg, altitude_ft, ground_speed_kt, track_deg time_to_dest_s, distance_to_dest_km, outside_temp_c phase: "GROUND" | "CLIMB" | "CRUISE" | "DESCENT" seatbelt_on: bool, pa_active: bool, ife_enabled: bool, flight_info_version: int FlightInfo (fetched once per flight_info_version): flight_id, origin {code, city_key, tz, lat, lon}, destination {code, city_key, tz, lat, lon} route_polyline: [(lat, lon), ...] (~200 simplified coordinates) 2. READ-ONLY CATALOG DB (catalog.sqlite inside active Content Slot A or B) tracks(track_id PK, title, artist, album_id, genre_id, duration_s, audio_sha256) albums(album_id PK, title, cover_sha256) playlists(playlist_id PK, title_key, genre_id, cover_sha256, sort_order) playlist_tracks(playlist_id, position, track_id, PRIMARY KEY (playlist_id, position)) translations(string_key, locale, translated_text, PRIMARY KEY (string_key, locale)) 3. EPHEMERAL SESSION DB (session.sqlite, wiped whenever flight_id changes) seat_session(session_id UUID PK, flight_id, started_at_monotonic_ms) my_playlist_items(session_id, position, track_id, PRIMARY KEY (session_id, position)) player_state(session_id PK, source_type, playlist_id, track_index, position_ms, volume_step) ui_settings(session_id PK, high_contrast, text_size, locale, read_aloud, slow_tap) nav_state(session_id PK, current_screen, screen_params_json) kpi_counters(session_id, metric_name, screen, count, PRIMARY KEY (session_id, metric_name, screen)) outbound_batches(seq PK, payload_json, created_at_ms)How playlists are stored and synced:
- Airline-curated playlists are built and digitally signed on the ground, pushed to the plane's flight server at the gate, and synced into the seat's inactive content slot (
Slot B) while passengers useSlot A. OnceSlot Bpasses signature checks and the plane is between flights (phase == "GROUND"), the Seat Agent atomically flips a symlink fromSlot AtoSlot B. "My Playlist"lives strictly insidesession.sqliteon that single seat. Because passengers are anonymous, syncing it elsewhere is unnecessary, and deletingsession.sqlitewhenever the flight server announces a newflight_idguarantees the next passenger starts clean.- Playback resilience: The Audio Service writes
player_state(track_indexandposition_msevery 5 seconds, plus on every skip or volume press) so if the Audio Service ever restarts, playback resumes smoothly from the same track and timestamp.
- Airline-curated playlists are built and digitally signed on the ground, pushed to the plane's flight server at the gate, and synced into the seat's inactive content slot (
Deep dive 1: Turbulence-proof input and UI state machines
When an air pocket hits, a passenger's hand can bounce, slide off a button onto its neighbor, or rest heavily on the armrest. We solve this with two explicit state machines: a low-level Tap Recognizer for finger contacts and a high-level Screen State Machine for navigation.
1. Touch state machine (
TapRecognizer)- Activate on finger lift, never on touch-down: Highlighting a button on touch-down gives instant (< 100 ms) visual feedback, while waiting for finger release lets a jolted finger slide away without triggering the wrong button.
- 3 mm slop margin, dead zone between neighbors: If a finger presses
Playand turbulence nudges it 2 mm past the edge, lifting inside a 3 mm forgiveness ring still counts. If it slides all the way ontoBack,Backwas not the button originally pressed, so nothing fires.
+-------------------+ 2 mm gap +-------------------+ | [ Play ] | | [ Next ] | | 15 x 15 mm | | 15 x 15 mm | +-------------------+ +-------------------+ \-- 3 mm slop ring around Play: - Down on Play, lift inside ring -> fires Play - Down on Play, jolt onto Next -> fires NOTHING (safe cancel!)- Palm and elbow rejection + bounce guard: Any multi-finger touch, wide palm contact, or hold longer than
1.5 s(an arm resting on the armrest) transitions toIGNORINGuntil all contacts lift. A0.4 srepeat guard prevents a double-bounce in turbulence from skipping two tracks at once. - Zero delicate gestures: No swipes, flick-scrolls, pinch-zoom, double-taps, or long-presses exist anywhere in the UI.
class TapRecognizer: """State machine turning raw jittery touches into at most one clean button activation.""" SLOP_MM = 3.0 # Forgiveness margin around the originally pressed button MAX_HOLD_S = 1.5 # Longer holds are a resting forearm/elbow, not a tap REPEAT_GUARD_S = 0.4 # Prevents a turbulence finger-bounce from firing twice def __init__(self): # States: "IDLE" | "PRESSED" | "IGNORING" self.state = "IDLE" self.target = None self.down_time = 0.0 # Maps target_id -> monotonic timestamp of its last successful activation self.last_fired_at = {} def _clear_active_press(self): if self.target is not None: self.target.clear_pressed() self.target = None def on_touch_down(self, target, contact_count, is_palm, now_s): # Multi-touch, wide palm contact, or touching empty space cancels any active press if contact_count > 1 or is_palm or target is None: self._clear_active_press() self.state = "IGNORING" return self.state = "PRESSED" self.target = target self.down_time = now_s target.show_pressed() # Visual feedback within 100 ms def on_cancel(self): """Called when a crew PA overlay or screen dim interrupts a touch mid-press.""" self._clear_active_press() self.state = "IDLE" def on_all_lifted(self, lift_x_mm, lift_y_mm, now_s, slow_tap=False): max_hold = 4.0 if slow_tap else self.MAX_HOLD_S repeat_guard = 1.0 if slow_tap else self.REPEAT_GUARD_S activated_target = None if self.state == "PRESSED" and self.target is not None: held_duration = now_s - self.down_time still_near_target = self.target.contains(lift_x_mm, lift_y_mm, margin_mm=self.SLOP_MM) recently_fired = (now_s - self.last_fired_at.get(self.target.id, -10.0)) < repeat_guard # Fire ONLY if lifted near the same button, within hold limit, and not a bounce if still_near_target and held_duration <= max_hold and not recently_fired: activated_target = self.target self.last_fired_at[self.target.id] = now_s self._clear_active_press() self.state = "IDLE" return activated_target2. Screen state machine
Every screen and system interrupt is an explicit state in a transition table, persisted to
nav_stateon every move so a crashed UI reopens right where the passenger was:CURRENT STATE EVENT NEXT STATE & SIDE EFFECT BOOT bootstrap loaded saved nav_state (or HOME if fresh session) DIMMED any touch or hardware key previous screen (wake touch is swallowed!) HOME tap Flight / Music / Settings FLIGHT_MAP / MUSIC_HOME / SETTINGS MUSIC_HOME tap Playlists / Genres / My PLAYLISTS / GENRES / MY_PLAYLIST PLAYLISTS tap a playlist row NOW_PLAYING (starts track 1 immediately) any screen tap Back deterministic parent screen (HOME -> HOME) any != FLIGHT_MAP 60 s of no input DIMMED (FLIGHT_MAP stays awake for passive viewing) SYSTEM OVERLAYS (preempt any screen and call TapRecognizer.on_cancel()): PA_ACTIVE pa_active == true audio muted/paused; touch locked; Vol keys work IFE_DISABLED ife_enabled == false cabin crew message shown; state preserved underneathSwallowing the wake touch from
DIMMEDis critical on an armrest: when a sleeping passenger shifts their arm and wakes the display, it never switches their song. Whenseatbelt_onturns true, Turbulence Mode automatically widensSLOP_MMfrom3 mmto5 mmand switches 2 × 2 tile grids into extra-large 1 × 2 tiles.Deep dive 2: Tiny-screen navigation, accessibility, and local-first sync
1. Fixed-rail layout and shallow paging
On an 89 × 50 mm screen, hunting for moving buttons causes constant mis-taps. Every screen shares the exact same outer frame:
+----------+-----------------------------------+----------+ | Home | | Up | +----------+ 55 x 50 mm Content Canvas +----------+ | Back | - 2 x 2 large feature tiles, OR | Page | +----------+ - 3 paged list rows (no scroll) | 2/7 | | Play / | - Map with [+] [-] zoom buttons +----------+ | Pause | | Down | +----------+-----------------------------------+----------+ 15 mm ~55 mm 15 mm- Zero flick-scrolling and zero virtual keyboards: Passengers step through playlists 3 items at a time using
UpandDownbuttons. Every curated playlist is at most 3 taps from Home (Music->Playlists->Acoustic), andPlay/Pausesits permanently in the bottom-left corner of every screen.
2. Motor and visual accessibility
- Two-key switch navigation: Pressing the physical
Nextkey moves a thick, high-contrast focus ring through all ~9 on-screen targets in predictable order, andOKactivates it—requiring zero touch dexterity. An accessibility shortcut sits right on the wake screen so passengers never have to navigate small text to turn help on. - High contrast, scalable text, and read-aloud: Colors come from semantic design tokens (
>= 7:1contrast ratio in high-contrast mode). Large-text mode switches 2 × 2 grids to 1 × 2 and 3-row pages to 2-row pages so labels never clip. Turning on Read-Aloud instructs the Audio Service to speak focused button labels and track titles into the headphones using pre-recorded UI clips plus a lightweight offline text-to-speech engine.
3. Local-first telemetry freshness and dead-reckoning
Music, playlists, and settings read strictly from local SQLite, so cabin network drops never affect them. Flight telemetry is the only live network input, so the Seat Agent tracks packet age using its monotonic clock (a local stopwatch counting milliseconds since boot, immune to clock skew between the plane and the seat):
Telemetry age = now_monotonic - received_at_monotonic 0 to 5 s [ LIVE ] Render exact aircraft coordinates from UDP multicast 5 s to 5 min [ ESTIMATED ] Extrapolate along last heading & ground speed; show badge > 5 min [ FROZEN ] Freeze aircraft icon; show "Position last updated 14:02"At cruising speed (~486 knots ≈ 900 km/h), 5 minutes covers ~75 km—accurate enough on a continent-scale map during straight cruise, while honest if the plane turns. We compute the extrapolated position along a great circle (the shortest curved path over Earth's sphere), clamping
asininputs to[-1.0, 1.0]so polar routes never trigger floating-point domain errors:import math EARTH_RADIUS_KM = 6371.0 def extrapolate_position(lat_deg, lon_deg, track_deg, ground_speed_kt, elapsed_s): """Dead-reckon aircraft (lat, lon) along its last heading over a spherical Earth.""" # 1 knot = 1.852 km/h; convert elapsed seconds into angular distance in radians distance_km = ground_speed_kt * 1.852 * (elapsed_s / 3600.0) angular_dist = distance_km / EARTH_RADIUS_KM lat1 = math.radians(lat_deg) lon1 = math.radians(lon_deg) bearing = math.radians(track_deg) # Clamp to [-1, 1] so rounding near +/-90 deg poles never raises ValueError sin_lat2 = ( math.sin(lat1) * math.cos(angular_dist) + math.cos(lat1) * math.sin(angular_dist) * math.cos(bearing) ) lat2 = math.asin(max(-1.0, min(1.0, sin_lat2))) lon2 = lon1 + math.atan2( math.sin(bearing) * math.sin(angular_dist) * math.cos(lat1), math.cos(angular_dist) - math.sin(lat1) * math.sin(lat2), ) # Normalize longitude cleanly into [-180, 180) across the international date line lon_wrapped = (math.degrees(lon2) + 540.0) % 360.0 - 180.0 return math.degrees(lat2), lon_wrapped- Zero flick-scrolling and zero virtual keyboards: Passengers step through playlists 3 items at a time using
Deep dive 3: Lazy-loaded modules without startup bloat
To add food ordering or duty-free shopping later without slowing down boot or blowing past our 400 MB UI RAM ceiling, the startup path loads only a tiny Core Shell (<= 500 KB minified JS). Remember that on local flash, "load time" is dominated by JavaScript parsing, compilation, and RAM allocation on a modest ARM CPU—not network download speed.
How the module loader works:
- Manifest-driven Home screen: Each feature ships on flash as an isolated bundle with a small JSON manifest (
id,version,entry,sha256,core_api: ">=2.0 <3.0",enabled_when: "phase == CRUISE",home_tile). At boot, the Core Shell reads only these tiny JSON manifests to draw the Home tiles in under 2 seconds. - Dynamic
import()+ idle prefetch: Tapping a tile loads that module's JavaScript bundle on demand viaimport(). OnceHOMEis interactive and idle, the shell prefetchesflight-mapandmusicin the background so opening either takes< 100 ms, whilefood-orderingandduty-freeconsume zero RAM until tapped. - Automatic eviction: When a passenger leaves a heavy module (such as a photo-rich duty-free catalog) unused for 5 minutes, the loader calls
module.unmount()and releases its DOM tree and image caches so memory never creeps upward across a 12-hour flight. - Error boundaries and sandboxing: Every module renders inside an error boundary (a UI wrapper that catches runtime crashes inside one module and replaces just that pane with
"Feature temporarily unavailable — Go Home"while the shell and music keep working). First-party airline modules run in the main browser context behind a strictmount(container, coreApi)contract and a Content-Security-Policy blocking direct network calls. Untrusted third-party partner modules (such as an external duty-free vendor) run inside a sandboxed<iframe>communicating only via structuredpostMessageevents, paying the extra ~30 MB iframe memory cost only while open.
- Manifest-driven Home screen: Each feature ships on flash as an isolated bundle with a small JSON manifest (
Metrics (3 KPIs), failure handling, and key trade-offs
All three KPIs are aggregated into integer counters inside
session.sqliteand uploaded every 60 seconds with monotonic sequence numbers (from_seq -> acked_through_seq) so dropped cabin links never lose or double-count batches.1. Content Reach Rate (User Satisfaction)
Content Reach Rate = sessions reaching meaningful use within 60 s of wake / total sessions with >= 1 wake interaction Meaningful use = >= 30 s of music playback OR >= 15 s on Flight Map Target >= 90% (paired with median taps-to-content <= 3)2. Input Friction Rate (UX & Accessibility Health)
Input Friction Rate = (mis-taps + rage-tap bursts) per 100 button activations Mis-tap = an activation followed by tapping Back within 2.0 s Rage-tap burst = >= 3 touch-downs within 1.0 s inside a 10 mm radius that resulted in <= 1 activation (signals a dead/confusing area) Target < 5 per 100 activations in calm air; sliced by screen & turbulence mode3. Healthy Seat Availability (System Reliability)
Seat Availability = healthy powered seat-minutes / total powered seat-minutes Healthy minute = UI heartbeat <= 2 s AND Audio Service responsive AND telemetry age <= 5 min (showing LIVE or ESTIMATED accurately) Target >= 99.5% across the fleet; sliced by aircraft, OS build, and hardware revFailure modes and fleet operations
FAILURE SCENARIO PASSENGER IMPACT & AUTOMATIC RECOVERY Flight server / Wi-Fi drops Music & playlists unaffected; map shifts LIVE -> ESTIMATED -> FROZEN cleanly; KPI counters buffer in SQLite up to 50 MB UI process crashes or freezes Music keeps playing in Audio Service; Seat Agent restarts UI after 3 missed 1 s heartbeats directly onto saved nav_state Audio Service crashes Seat Agent restarts it; resumes track & timestamp within ~1 s Corrupted gate content download SHA-256 or package signature fails; seat stays on Slot A Physical touch panel ghosts/dies Hardware keys (Next / OK / Vol) operate every screen Bad software update pushed Canary rollout (1 plane -> 5% -> fleet); 2 boot failures trigger automatic local rollback to the previous slotSummary of key architectural trade-offs
- Native Seat Agent + separate Audio Service vs. single browser app: Adds local IPC and process supervision, but eliminates network spinners from the UI and keeps music + PA muting alive during UI crashes.
- Release-triggered taps + 3 mm slop + zero gestures vs. smartphone UX: Slightly slower than flick-scrolling a 2,000-song list, but guarantees predictable, error-free control on a shaking 89 × 50 mm armrest.
- A/B content slots with SHA-256 delta sync vs. in-place file overwrites: Costs 2× flash capacity (~15 GB of 32 GB), but prevents half-updated catalogs when ground power disconnects mid-turnaround and cuts monthly syncs under an hour.
Intuition & how it works
Think of an armrest in-flight entertainment (IFE) unit as a car dashboard stereo paired with an offline GPS, rather than a miniature smartphone. Your forearm rests inches from the display, turbulence shakes your hand mid-press, and the wireless link to the cabin's front server drops out whenever there is interference. Because of those physical realities, every song and map tile lives on flash storage inside the seat itself, a local background service shields the screen from network hiccups, and every control behaves like a large, forgiving push-button rather than a delicate swipe gesture.
If you instead shrink a standard mobile web app onto a 4-inch (89 × 50 mm) screen and talk directly to the plane's server, three things break right away. First, phone-sized buttons (7–9 mm) and swipe lists trigger constant accidental taps when the cabin bumps or an elbow brushes the armrest. Second, fetching data directly from the UI freezes screens whenever cabin Wi-Fi drops, and running audio inside the UI process means any UI crash cuts off the passenger's music. Third, bundling future features like food ordering and duty-free shopping into one startup file slows boot time and exhausts the small embedded processor's 2 GB of RAM.
Walk through four concrete events on Seat 22F during a bumpy climb to see how the design works end to end:
- Accidental elbow wake: The passenger's arm brushes the sleeping display. The screen state machine (an explicit table of allowed screens and transitions) moves from
DIMMEDtoHOMEand deliberately swallows that first touch so nothing starts or stops by mistake. - Starting music offline: The passenger taps
Music->Playlists->Acousticon 15 mm+ targets. Even though a bump nudges their finger 2 mm before lift-off, the tap recognizer sees the finger lift inside its 3 mm forgiveness ring and fires once, calling a local Seat Agent overlocalhost(an internal loopback connection on the same device that never goes offline) to start the separate Audio Service from local flash in under 100 ms. - Cabin Wi-Fi drop: Interference blocks UDP multicast packets (one-to-many network broadcasts sent once per second to all 300 seats) for 45 seconds while the passenger views
Flight. Instead of showing a loading spinner, the Seat Agent projects the plane forward along its last heading and speed using a monotonic clock (a stopwatch counting time since boot that never jumps backward) and badges the map"Estimated". - Crew PA interrupt: The captain speaks on the intercom (
pa_active = true). The Audio Service immediately pauses playback via IPC (Inter-Process Communication, a direct local message channel between programs on the same machine), while a system overlay cancels any half-finished touch so no stray button fires afterward.
Key trade-offs
- Local Seat Agent between the UI and cabin network vs. direct UI network calls. Routing everything through a native Seat Agent means the UI only talks to
localhost, never blocks on dropped cabin Wi-Fi, and automatically gets cached state and extrapolated flight positions. The trade-off is maintaining and supervising an extra native daemon alongside the UI. - Separate UI, Audio, and Agent processes vs. one monolithic app. Isolating audio in its own native process guarantees that a UI crash or slow module load never interrupts music or blocks mandatory PA muting. The trade-off is building local IPC synchronization and a watchdog (an automated health check that restarts a hung process after missed heartbeats).
- Activate-on-release with a 3 mm slop margin vs. activate-on-touch-down. Firing on finger release lets passengers slide off a button to cancel and turns turbulence jolts into safe no-ops instead of neighboring button presses. Touch-down activation feels ~50 ms snappier in calm air, but turns every cabin bump or resting elbow into an unintended action.
- Fixed-rail paging with zero gestures vs. scrolling lists and search keyboards. Paging 3 items at a time with
Up/Downbuttons and hardware keys (Next/OK) makes every screen 100% operable in severe turbulence or with limited motor control. The trade-off is that finding one specific song out of 2,000 takes more taps than typing into a search bar. - UDP multicast telemetry + dead-reckoning vs. per-seat TCP/WebSocket streams. Multicast sends one 200-byte packet per second for the entire 300-seat cabin with zero per-seat connection state on the flight server, while dead-reckoning (estimating current position from the last known coordinates, heading, and ground speed) masks short Wi-Fi outages. Because dead-reckoning cannot predict a sudden turn, we cap it at 5 minutes and label it
"Estimated". - A/B content slots with SHA-256 delta sync vs. updating files in place. Keeping two 7.5 GB content partitions (
Slot Aactive,Slot Bstaging) and identifying files by SHA-256 content hashes (unique digital fingerprints computed from a file's bytes) gives atomic upgrades, instant rollback, and sub-hour monthly delta syncs at the gate, at the cost of doubling flash storage used for media. - Lazy-loaded modules in one JS context vs.
<iframe>micro-frontends everywhere. Loading first-party modules dynamically viaimport()into a shared browser context keeps startup under 2 seconds and UI RAM under 400 MB, whereas error boundaries (wrappers that isolate component crashes to a single pane) contain bugs. Full sandboxed<iframe>isolation (running a module in its own separate browser document and memory heap) costs ~30 MB of extra RAM per frame, so we reserve it strictly for untrusted third-party partner modules like external duty-free shops. - On-seat KPI counter aggregation vs. raw touch event streaming. Summarizing interactions into per-flight counters on the seat shrinks analytics from ~216 MB to ~1.2 MB per flight and prevents reconstructing passenger behavior, at the cost of losing raw touch-by-touch replay logs when debugging subtle UX edge cases.
Common mistakes
- Shrinking a smartphone UI onto an armrest. Standard 7–9 mm touch targets, flick-scrolling lists, pinch-to-zoom maps, and virtual keyboards become frustratingly error-prone on an 89 × 50 mm screen during turbulence.
- Firing actions on initial touch-down or failing to swallow the wake tap. On an armrest, elbows and forearms brush the screen constantly; waking from a dimmed state must consume that first touch rather than pressing whatever button sat underneath.
- Coupling non-telemetry screens to cabin Wi-Fi. Fetching playlists, translations, or user settings over the aircraft LAN causes spinners and broken screens during routine cabin Wi-Fi drops.
- Computing telemetry staleness by subtracting aircraft wall-clock timestamps from seat wall-clock time. If the seat's system clock drifts by 20 seconds relative to the avionics clock, live data looks stale (or stale data looks fresh); always measure elapsed age with the seat's local monotonic clock from the moment the packet arrived.
- Bundling every feature module into the boot payload. Eagerly parsing food ordering, shopping, and map engines at startup degrades boot latency and memory linearly as new teams add features.
- Treating accessibility as just a color toggle. High contrast helps low-vision users, but passengers with tremors or limited reach also need physical two-key scanning (
Next/OK), adjustable slow-tap thresholds, large-text grid reflow (2 × 2 to 1 × 2), and headphone read-aloud. - Uploading interaction logs tagged with
seat_unit_idand timestamps. Combining seat22F, flight number, and date links straight back to a named passenger in the airline's reservation system; behavioral counters must use an ephemeral randomsession_idseparated from hardware health diagnostics.
Follow-up questions
- How would you support dozens of passenger languages across international routes while keeping the core boot bundle below 50 MB? Separate core application assets (code, UI strings, and base fonts, budgeted under 45 MB enforced in CI) from airline media metadata and recorded voice prompts (which live in the 7.5 GB content slot). Store UI translations as one lazy-loaded JSON file per locale using ICU MessageFormat (a standard syntax for handling plurals and word order across languages, ~3.6 MB total across 40 languages), mirror layouts automatically for right-to-left scripts like Arabic and Hebrew with CSS logical properties, and format dates/times via the browser engine's built-in
IntlAPI. Because full Chinese, Japanese, and Korean fonts easily exceed 10–15 MB per weight, subset the core fonts at build time (stripping unused glyphs so the font file keeps only UI characters plus ~3,500 common everyday characters per script) and compress them as WOFF2 (a compact web font format), shipping rare characters needed by specific song titles as a tiny supplemental font inside each monthly content package (~18–23 MB total core package). - What hardware and software fallbacks would keep the unit usable if the capacitive panel freezes or registers phantom touches in heavy turbulence? First separate a hung UI process from a dead or noisy touch sensor: if touch events still reach the OS kernel but frames stop rendering, the Seat Agent's watchdog restarts the UI within 3 seconds right back onto the saved
nav_statescreen while music keeps playing. If the UI is healthy but the capacitive panel stops responding or floods the system with ghost touches (false rapid signals caused by moisture or electrical noise, detected when a contact stays held > 10 s or fires > 20 separate touch-downs/s on one spot), the Seat Agent temporarily disables touch input, resets the touch controller driver, and displays"Touch paused — use side buttons". Throughout this fallback, the four physical keys (Nextto cycle focus,OKto select,Vol -/+wired directly to the Audio Service) keep 100% of screens operable, verified automatically in CI by a keyboard-only end-to-end test. - How can you measure repeated frustrated taps and accessibility barriers on the device without collecting passenger-identifiable interaction logs? Run detection entirely in memory inside the UI and persist only anonymous aggregate counters in SQLite—never raw
(x, y)coordinates, timestamps, or click sequences. Specifically, count a rage-tap burst whenever>= 3touch-downs land within1.0 sand10 mmwith<= 1successful activation, and count accessibility friction signals such as mid-flight switches to large text/high contrast/key navigation or immediateBacktaps within2.0 sof opening a screen, bucketed only by(screen_name, target_id, turbulence_mode). Upload these counters over the separateevents:batchchannel keyed solely by a random per-flightsession_id(stripping IP and physical seat number), roll them up to the aircraft/route level on the flight server, and suppress reporting for any screen bucket with fewer than 10 contributing sessions (k-anonymity) so no individual passenger's session can ever be singled out.
Follow-up questions
- How would you support dozens of passenger languages across international routes while keeping the core boot bundle below 50 MB?
- What hardware and software fallbacks would keep the unit usable if the capacitive panel freezes or registers phantom touches in heavy turbulence?
- How can you measure repeated frustrated taps and accessibility barriers on the device without collecting passenger-identifiable interaction logs?
Similar questions
- Design an Offline-First Note Sync Application
- Global Live Video Streaming Platform
- Multi-User Collaborative Document Editor
- Burst-Resilient Multi-Channel Notification Platform
- Prior Authorization Status Engine, Clinical Worklists, and Digests
- Diagnosing and Optimizing Full-Stack Web Request Latency