<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Limo</title>
    <description>The latest articles on DEV Community by Limo (@limo_b432649fb13e7b3).</description>
    <link>https://dev.to/limo_b432649fb13e7b3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4258122%2Fe31eea95-0dda-40f6-abca-b7c627f2e2d3.jpg</url>
      <title>DEV Community: Limo</title>
      <link>https://dev.to/limo_b432649fb13e7b3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/limo_b432649fb13e7b3"/>
    <language>en</language>
    <item>
      <title>Building a listening-practice video player: the design decisions that mattered</title>
      <dc:creator>Limo</dc:creator>
      <pubDate>Sun, 22 Nov 2026 01:30:48 +0000</pubDate>
      <link>https://dev.to/limo_b432649fb13e7b3/building-a-listening-practice-video-player-the-design-decisions-that-mattered-3aop</link>
      <guid>https://dev.to/limo_b432649fb13e7b3/building-a-listening-practice-video-player-the-design-decisions-that-mattered-3aop</guid>
      <description>&lt;p&gt;I'm the developer of Earu, a desktop video player for practicing listening in a second language. It started as a practice tool for my own kids and is meant for anyone learning a second language. This post is mostly about the engineering and design choices behind it: how subtitles get covered, how they get re-timed against the audio, how the exercises are generated and graded, and what I threw away. The product part is short and sits at the end.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi7py2rnyw8ox62bjnrtf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi7py2rnyw8ox62bjnrtf.jpg" alt="Earu desktop player: the Spanish subtitle is covered, the English one stays visible" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it came from
&lt;/h2&gt;

&lt;p&gt;I started by helping my kids practice listening with videos they already liked, no textbook: loop one line, put the heard words back in order, read along and get checked, re-test missed words a few days later. The numbers in the app were tuned during those sessions.&lt;/p&gt;

&lt;p&gt;The idea is simple. Listening and speaking are the fastest route to a second language, and without enough input you can't produce anything. Many learners can read subtitles fine and still can't hear the sentence. So the player makes you listen first and turns whatever you were going to watch anyway into practice. There is no fixed curriculum: Earu runs on your own interests, and only decides what to ask you about the video you picked.&lt;/p&gt;

&lt;p&gt;The name comes from a Chinese idiom about learning by soaking in something every day. "Earu" is a rough phonetic match.&lt;/p&gt;

&lt;h2&gt;
  
  
  Covering subtitles instead of hiding them
&lt;/h2&gt;

&lt;p&gt;The first design flip: subtitles in the language you're learning are covered by default, and your native-language subtitles are not. Each subtitle layer has three states: shown, hidden, covered.&lt;/p&gt;

&lt;p&gt;"Covered" is deliberately not "hidden". A covered subtitle is still there, blurred into a soft fog that keeps the original width and line count so the layout doesn't jump. Move the mouse across it and the fog parts under the cursor; stop, and after about a third of a second it drifts back over a few seconds. You glance when you're lost and return to listening, with no trip to settings.&lt;/p&gt;

&lt;p&gt;During an exercise the learning-language subtitle is always covered and hovering doesn't reveal it; a deliberate peek is a click and counts as a hint. Annotations like [music] are never covered.&lt;/p&gt;

&lt;p&gt;The implementation went through two versions, and the second is the interesting one. Each covered element is two stacked layers: the blurred text, and a crisp clone of the same text behind it. Every "gust" of the mouse is a soft-edged hole. The blurred layer's mask is "everything minus the gusts", and the clone's mask is "only the gusts".&lt;/p&gt;

&lt;p&gt;My first version drew each gust as its own radial gradient. A fast swipe produced over a hundred gradient layers per element, each repainted at full size every frame. The fix was to composite all gusts into one tiny alpha bitmap per frame and use it as the mask, stretched over the element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;every frame:
  alpha = small grid, size ~ element / (0.16 * font height)
  for gust in gusts: stamp soft circle into alpha
  blurredLayer.mask = everything minus alpha
  cloneLayer.mask   = alpha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the grid scales with font size, cost per gust stays roughly constant. WebKit engines load mask images asynchronously, so swapping one every frame made the line flicker out; there the next mask is decoded off-screen first. Where small masks aren't supported, it falls back to gradients.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4dxfdc6c12vgw7me8vht.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4dxfdc6c12vgw7me8vht.jpg" alt="A covered subtitle with part of the fog cleared under the mouse" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Re-timing subtitles against the audio
&lt;/h2&gt;

&lt;p&gt;Subtitles one or two seconds off are miserable for listening practice, and plenty of files are. So the player checks the audio itself.&lt;/p&gt;

&lt;p&gt;A small voice-activity model runs in a Web Worker on 32 ms blocks of 16 kHz mono audio and outputs a "someone is speaking" probability for each block. The subtitle cues are also a speech/no-speech signal. The job is to find the straight line &lt;code&gt;real_time = k * subtitle_time + b&lt;/code&gt; that makes the two signals line up best.&lt;/p&gt;

&lt;p&gt;Some choices that made it reliable: the scale factor only tries values near common frame-rate mismatches (1, 23.976 vs 24, 23.976 vs 25 and inverses), because free search finds nonsense; the offset is searched within about 10 seconds, coarse then fine; and the result must agree with itself. The video is cut into up to five segments, and each segment's own best offset must sit within a quarter of a second of the global line, otherwise the answer is thrown away. Under ten minutes only the offset is fitted, since short clips produced fake scale values, and corrections smaller than roughly 0.15 to 0.2 seconds are ignored.&lt;/p&gt;

&lt;p&gt;In my tests on two real episodes, correct subtitles correlated with the audio at about 0.5 and subtitles from the wrong episode below 0.1; the thresholds are built on that gap. When confident, the player applies the corrected timing and shows a small icon with the maximum shift in seconds. Click it and you get the original timing back, because an automatic fix you can't undo is a bug waiting to happen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sort: pre-placing blocks so nobody gets stuck
&lt;/h2&gt;

&lt;p&gt;Sort splits the sentence you just heard into shuffled word blocks, and you put them back in order while it loops. Nobody can reliably hear every function word in a 20-word sentence, so long ones start with some blocks placed and locked, more at lower difficulty levels. On the default level, up to eight words get none, then one more per two extra words.&lt;/p&gt;

&lt;p&gt;Which blocks get placed matters more than how many. In order of preference: the first and last word (anchors); names (audible but unguessable spelling); words rarer than your difficulty level, rarest first (needs a word-frequency table, so only for languages that have one); then whatever is left, spread evenly by always picking the word farthest from those already chosen.&lt;/p&gt;

&lt;p&gt;The same sentence at the same level always gets the same pre-placed words, including after "shuffle again"; otherwise redoing a question would hand you a different question. The shuffle is a plain Fisher-Yates plus one rule: if it lands on the correct order, swap the first two blocks, so a two-word sentence always arrives reversed.&lt;/p&gt;

&lt;p&gt;Correctness is checked by text per position, not by block identity, so with two "the" in a sentence either can go in either slot. Sort and Dictation share the pre-placement code: I noticed the same sentence showed different fixed words in the two exercises, which felt wrong, so now there's one function both ask.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cvs8k4g3gtmwk391i1k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cvs8k4g3gtmwk391i1k.jpg" alt="Sort in progress: some chunks are already in place, the rest wait in the bank below" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Dictation: strict spelling, lenient formatting
&lt;/h2&gt;

&lt;p&gt;Dictation is one box per word. You type, press Enter, and everything is judged at once: correct boxes lock, wrong ones turn red.&lt;/p&gt;

&lt;p&gt;Spelling is strict. Everything that isn't spelling is forgiven:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Case doesn't matter.&lt;/li&gt;
&lt;li&gt;Straight and curly apostrophes are the same character.&lt;/li&gt;
&lt;li&gt;Numbers match in either form. A run of adjacent number words like "twenty five" or "one hundred and five" collapses into a single box that accepts both "25" and the spelled-out version. It doesn't merge "one two three", because that's counting, not a number. A lone "hundred" isn't treated as a number either.&lt;/li&gt;
&lt;li&gt;Spanish has its own rules: 1.000 equals 1000, a missing accent is accepted but marked yellow with the right spelling, and a wrong accent or missing ñ is an error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The boxes come from the same tokenizer used for Sort and scoring, so the box count can never exceed the word count the scoring side uses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read-aloud: score per word, and a pass mark the UI doesn't know
&lt;/h2&gt;

&lt;p&gt;For Read-aloud you listen to the original line, then read it into the microphone, and what you said is compared word by word with the original. Words come back green or red. The score is the share of scored words you got right, rounded down.&lt;/p&gt;

&lt;p&gt;Not every word is scored: names and a short list of throwaway words are skipped, since a recognizer is often wrong on exactly those. The pass mark defaults to 85 and can be moved between 70 and 100.&lt;/p&gt;

&lt;p&gt;The page does not know the pass mark. The UI never computes "did they pass"; it draws the verdict and per-word results it receives, stars included, so the screen and the scoring can't drift apart. Miss the same sentence five times in a row and the app offers another one. Silent or near-silent recordings don't count as an attempt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't let people farm points
&lt;/h2&gt;

&lt;p&gt;Points exist so a day's practice means something. Each sentence has a difficulty from L0 to L5. L0 sentences have no real content: interjections, forms of address, names, one-or-two-word lines. You can practice them, but a correct answer scores zero, otherwise "Oh" and "Hey" would be a points machine.&lt;/p&gt;

&lt;p&gt;I made L0 a plain rule set rather than asking AI "does this line have content?". Asked twice, the AI disagreed with itself, which makes it a bad judge for anything that touches scoring. Other limits: the same sentence scores once per 15 days across Sort and Dictation, very fast answers don't count, and short sentences are capped per day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Translating once for everyone
&lt;/h2&gt;

&lt;p&gt;Native-language subtitles come from AI translation, not from the video, so without care every user opening a popular video would repeat the same work. Translation is keyed by a fingerprint: SHA-256 over the normalized subtitle lines. The client asks whether a translation exists, uses it if so, and otherwise uploads the subtitle text (never the video) and polls.&lt;/p&gt;

&lt;p&gt;The fingerprint is versioned by the sentence-merging rules: when I improved how raw cues merge into sentences, every fingerprint would have changed, so the previous fingerprint can be computed too and unchanged sentences carry their translations over. Files on cloud drives and home media libraries get a cheap file fingerprint instead: a hash of the file size plus the first 64 KB.&lt;/p&gt;

&lt;h2&gt;
  
  
  One table of feature names, fourteen interface languages
&lt;/h2&gt;

&lt;p&gt;Earu has twelve languages you can learn and fourteen interface languages (Simplified and Traditional Chinese counted separately). Feature names like Sort, Dictation, Read-aloud, Daily Quiz, Word notebook, Cover, Study plan, Hint and Sentence breakdown appear in a great many strings.&lt;/p&gt;

&lt;p&gt;Renaming one used to mean a search through every locale file. So there's now a single table, one row per language, and every other string refers to a name with a token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Opens when today's {@sort} reaches {t} points"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Locale files are wrapped in a loader that substitutes the tokens when it loads. Everything downstream, including the lookup code and the tests, sees a normal finished sentence. A lint script fails the build if a locale file spells a feature name out directly, with a short allow-list for words that merely look the same.&lt;/p&gt;

&lt;p&gt;Languages with case or articles (German, French, Russian and others) carry extra forms per name, such as a lowercase form or a past participle for "covered". Renaming a feature is a one-row edit. Static pages like the privacy policy can't use tokens, so a snapshot test flags which ones to update.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it's a desktop app, and how it ships
&lt;/h2&gt;

&lt;p&gt;The first prototype lived in a browser tab. Then I wanted to play videos from a NAS at home and hit two walls: the page is HTTPS while most NAS endpoints are plain HTTP, so browsers block it as mixed content, and the NAS sends no cross-origin permissions, a second block behind the first. So Earu is a desktop app, for Windows and macOS.&lt;/p&gt;

&lt;p&gt;The architecture is thin on purpose. The desktop shell is an Electron window that loads the Earu website and injects a small bridge object into the page. The bridge exposes the few things only a native shell can do. The page is otherwise a normal web app that treats the bridge as optional: if a method isn't there, the feature counts as unavailable rather than crashing the screen. The rules that differ between store builds and direct downloads all hang off one "which build is this" field instead of being scattered through components.&lt;/p&gt;

&lt;p&gt;The practical effect is that interface changes ship as a normal web deploy, and users don't have to reinstall for them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I gave up
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A fixed curriculum.&lt;/strong&gt; Ordering lessons from easy to hard looks systematic, and I understand why people want that. But you can only keep going with videos you're happy to rewatch. Earu has no curriculum, and your own interests decide what you study. The Study plan sets how much you do per day, not what you learn. It's a workload, not a course.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CEFR levels for the built-in library.&lt;/strong&gt; In my first try a picture book came out as C1 and a video at 200 words per minute as A2, the opposite of how they sound. I replaced it with three coarse levels based mostly on speech rate, tuned against blind ratings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Letting AI fill the gaps.&lt;/strong&gt; If a word isn't in the dictionary, the word card says so. It doesn't ask AI to invent a definition. I would rather have a missing entry than a wrong one that ends up in someone's notebook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using it
&lt;/h2&gt;

&lt;p&gt;Earu plays videos from a built-in library, your computer, cloud drives and a home media server; files on your computer stay there. English is the most complete language, and twelve are supported in total.&lt;/p&gt;

&lt;p&gt;I'm the developer, and I'd like to hear how it works for you, especially where it feels off.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows: &lt;a href="https://apps.microsoft.com/detail/9N7CCF3JLGXH" rel="noopener noreferrer"&gt;Microsoft Store&lt;/a&gt;, or from &lt;a href="https://earu.ai" rel="noopener noreferrer"&gt;earu.ai&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;macOS: from &lt;a href="https://earu.ai" rel="noopener noreferrer"&gt;earu.ai&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>electron</category>
      <category>languagelearning</category>
    </item>
  </channel>
</rss>
