<?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: FlowPick Team</title>
    <description>The latest articles on DEV Community by FlowPick Team (@flowpick).</description>
    <link>https://dev.to/flowpick</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%2F3615810%2F7f28f90c-e5c9-4c10-b585-08348152cc9c.png</url>
      <title>DEV Community: FlowPick Team</title>
      <link>https://dev.to/flowpick</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/flowpick"/>
    <language>en</language>
    <item>
      <title>How to Trim a WAV File in Your Browser and Verify the Cut</title>
      <dc:creator>FlowPick Team</dc:creator>
      <pubDate>Fri, 13 Nov 2026 15:17:57 +0000</pubDate>
      <link>https://dev.to/flowpick/how-to-trim-a-wav-file-in-your-browser-and-verify-the-cut-3jlo</link>
      <guid>https://dev.to/flowpick/how-to-trim-a-wav-file-in-your-browser-and-verify-the-cut-3jlo</guid>
      <description>&lt;p&gt;If you need a short audio clip for a bug report or a demo, the waveform is a good place to find it. For a clip someone else needs to reproduce, write down the timestamps and check the exported file. A preview tells you how the cut sounds. The file itself tells you what you actually saved.&lt;/p&gt;

&lt;p&gt;This walkthrough uses a two-second test tone from FlowPick. The goal is to keep the middle second, from &lt;code&gt;0.500&lt;/code&gt; to &lt;code&gt;1.500&lt;/code&gt;, and export it as a mono WAV at &lt;code&gt;44100 Hz&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set the cut in FlowPick
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://flowpick.net/tools/audio-trimmer" rel="noopener noreferrer"&gt;FlowPick Audio Trimmer&lt;/a&gt; and load the &lt;code&gt;flowpick-tone.wav&lt;/code&gt; sample listed on the page. You can also choose a recording from your device.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;0:00.500&lt;/code&gt; in &lt;strong&gt;Start time&lt;/strong&gt; and &lt;code&gt;0:01.500&lt;/code&gt; in &lt;strong&gt;End time&lt;/strong&gt;. For speech, drag the waveform handles to find the rough boundaries first, then use the time fields to fine-tune them.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Keep selection&lt;/strong&gt;. The output duration should read one second. &lt;strong&gt;Remove selection&lt;/strong&gt; cuts out the highlighted section and joins the audio on either side. With this particular sample, both modes leave one second of audio, so the duration alone won't tell you if you picked the right mode.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Preview edit&lt;/strong&gt;. If you're cutting speech, listen for a clipped consonant at the start or the end of a word that disappears. A small adjustment to either timestamp is usually easier than fixing the cut after export.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;WAV&lt;/strong&gt; as the output format and keep the original sample rate. Run the trim, then download the result.&lt;/li&gt;
&lt;/ol&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%2Fmvcz7mf1o0vac7424r5i.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%2Fmvcz7mf1o0vac7424r5i.jpg" alt="FlowPick waveform with two selection handles, start and end fields, and Keep selection enabled" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The screenshot uses a different recording to show where the controls are. Use &lt;code&gt;0:00.500&lt;/code&gt; and &lt;code&gt;0:01.500&lt;/code&gt; for the test tone.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;FlowPick processes the selected recording in your browser. Large files can take longer to decode and may run into device memory limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the exported file with &lt;code&gt;ffprobe&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;If you have FFmpeg installed, run this against the downloaded file. Replace &lt;code&gt;trimmed.wav&lt;/code&gt; with its actual name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffprobe -v error -select_streams a:0 -show_entries &lt;span class="nv"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sample_rate,channels,duration -of json &lt;span class="s2"&gt;"trimmed.wav"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this example, expect &lt;code&gt;sample_rate&lt;/code&gt; to be &lt;code&gt;"44100"&lt;/code&gt;, &lt;code&gt;channels&lt;/code&gt; to be &lt;code&gt;1&lt;/code&gt;, and &lt;code&gt;duration&lt;/code&gt; to be &lt;code&gt;"1.000000"&lt;/code&gt;. If you see two seconds, check that you opened the export instead of the source file. If the duration is right but the edit sounds wrong, play the downloaded WAV and check which edit mode you used. &lt;code&gt;ffprobe&lt;/code&gt; can verify the file's properties, but it can't tell you whether the cut landed on the right word. &lt;a href="https://ffmpeg.org/ffprobe.html" rel="noopener noreferrer"&gt;FFprobe documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: This tutorial was drafted with AI using FlowPick's documented workflow and sample metadata.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>tools</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Passing Large Files Between Browser Tools Without Uploading Them</title>
      <dc:creator>FlowPick Team</dc:creator>
      <pubDate>Fri, 30 Oct 2026 03:38:06 +0000</pubDate>
      <link>https://dev.to/flowpick/passing-large-files-between-browser-tools-without-uploading-them-5a0j</link>
      <guid>https://dev.to/flowpick/passing-large-files-between-browser-tools-without-uploading-them-5a0j</guid>
      <description>&lt;p&gt;A video finishes downloading. The next step is to trim it, extract its audio, or generate a transcript.&lt;/p&gt;

&lt;p&gt;Making the user save the file, open another page, and select that same file again works. It also turns a connected workflow into a series of file-picker dialogs.&lt;/p&gt;

&lt;p&gt;In FlowPick, I wanted the next tool to open with the result already available.&lt;/p&gt;

&lt;p&gt;I’m the author of &lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;FlowPick&lt;/a&gt;, a browser extension and collection of audio and video tools. This article covers the file handoff implementation in its web tools: OPFS for media storage, IndexedDB for handoff records, and leases to coordinate file lifetime across tools and tabs.&lt;/p&gt;

&lt;p&gt;The interesting part is not writing a file. It is deciding when that file can safely be deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Separate the media from the handoff
&lt;/h2&gt;

&lt;p&gt;FlowPick keeps two different things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The media bytes, stored in the Origin Private File System.&lt;/li&gt;
&lt;li&gt;A small handoff record, stored in IndexedDB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The destination URL contains a randomly generated handoff ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/tools/video-trimmer?handoff=&amp;lt;random-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It does not contain the media, an encoded file, or a filesystem path.&lt;/p&gt;

&lt;p&gt;The destination uses that ID to look up the record and find the stored asset.&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%2Fgf66wwmci2pu4hg70frm.png" 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%2Fgf66wwmci2pu4hg70frm.png" alt="FlowPick file handoff: the source tool stores or retains an OPFS asset and creates an IndexedDB record. The destination receives a handoff ID, validates the record, and acquires its own asset lease." width="799" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system" rel="noopener noreferrer"&gt;Origin Private File System, or OPFS&lt;/a&gt;, is browser-managed storage associated with an origin. It is separate from the user-visible files selected through a directory picker.&lt;/p&gt;

&lt;p&gt;This design assumes the tools share the same origin and can access the same storage partition. It is not a mechanism for passing files to an unrelated website or another device.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two paths: copy a Blob or reuse an OPFS file
&lt;/h2&gt;

&lt;p&gt;Some tools produce a Blob. Others already have a completed result in OPFS.&lt;/p&gt;

&lt;p&gt;Those cases should not take the same path.&lt;/p&gt;

&lt;h3&gt;
  
  
  When the result is a Blob
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;createToolHandoff()&lt;/code&gt; creates a managed file in a handoff directory and streams the Blob into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fileHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;directory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getFileHandle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;storageFilename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;writable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fileHandle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createWritable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;pipeTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;writable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This avoids explicitly converting the complete result into another &lt;code&gt;ArrayBuffer&lt;/code&gt; in application code.&lt;/p&gt;

&lt;p&gt;It still writes a copy into OPFS. Streaming the write does not mean the Blob itself occupies no memory or that the browser performs no internal buffering.&lt;/p&gt;

&lt;h3&gt;
  
  
  When the result is already in OPFS
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;createToolHandoffFromOPFS()&lt;/code&gt; finds the existing file, registers a handoff lease, and writes a record pointing to that asset.&lt;/p&gt;

&lt;p&gt;It does not stream the media into a second handoff file.&lt;/p&gt;

&lt;p&gt;FlowPick records this distinction explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;storageMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;copied&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;shared&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Several downloader and recording paths can use the shared mode.&lt;/p&gt;

&lt;p&gt;I describe this as avoiding an additional media-file copy. Calling the whole workflow “zero-copy” would promise too much: reading the file, creating a &lt;code&gt;File&lt;/code&gt; wrapper, decoding media, or running another transformation can still involve allocations and additional storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the record useful but small
&lt;/h2&gt;

&lt;p&gt;Here is a shortened version of the handoff record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ToolHandoffRecord&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;sourceTool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;targetTool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;

  &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;mimeType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;

  &lt;span class="nx"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="nx"&gt;expiresAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;

  &lt;span class="nx"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;directoryName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="na"&gt;primaryFilename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="na"&gt;cleanupFilenames&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nl"&gt;managedAssetId&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;handoffLeaseId&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;storageMode&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;copied&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;shared&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The display filename and the internal storage filename serve different purposes.&lt;/p&gt;

&lt;p&gt;The user might see &lt;code&gt;interview.mp4&lt;/code&gt;, while the handoff directory contains a generated name. The record preserves the display name and MIME type for the receiving tool.&lt;/p&gt;

&lt;p&gt;The cleanup list also matters. A media job can own more than its final output: separate audio and video inputs, a merged file, and temporary files may belong to the same asset.&lt;/p&gt;

&lt;p&gt;FlowPick’s asset manager combines cleanup filenames when the same asset is retained again. That gives cleanup a view of the asset’s related files rather than just the filename currently shown in the UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Register ownership before writing bytes
&lt;/h2&gt;

&lt;p&gt;In the Blob path, FlowPick registers the managed asset and its first lease before creating and writing the file.&lt;/p&gt;

&lt;p&gt;The sequence is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Register asset and lease
        ↓
Write OPFS file
        ↓
Commit handoff record
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If writing or recording the handoff fails, the error path releases the lease and attempts to remove the file.&lt;/p&gt;

&lt;p&gt;Registering first also gives later cleanup something to reconcile if the page disappears during the write.&lt;/p&gt;

&lt;p&gt;There is no single transaction spanning IndexedDB and OPFS here. The implementation uses ordering, rollback attempts, and later garbage collection to handle incomplete work.&lt;/p&gt;

&lt;p&gt;That distinction is worth keeping explicit. An IndexedDB transaction can atomically register an asset and its lease; it cannot make an OPFS write part of that same transaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open the tab before awaiting storage work
&lt;/h2&gt;

&lt;p&gt;Preparing the handoff can take time, especially when a Blob must be written.&lt;/p&gt;

&lt;p&gt;Opening a new tab after that asynchronous work risks losing the original user activation and having the browser block the popup.&lt;/p&gt;

&lt;p&gt;FlowPick opens a blank tab synchronously from the click handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tab&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;about:blank&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;_blank&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opener&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the handoff is ready, the source navigates that tab to the tool URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;destination&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;searchParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;handoff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handoffId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file preparation remains asynchronous. The decision to open the tab stays attached to the user’s click.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate before loading
&lt;/h2&gt;

&lt;p&gt;The receiving tool does not treat every handoff ID as usable.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;loadToolHandoff()&lt;/code&gt; checks that the record exists, has not expired, and names the expected destination:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;record&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nx"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expiresAt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nx"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;targetTool&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;expectedTarget&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;handoff-not-found&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It then opens the stored file and acquires a consumer lease.&lt;/p&gt;

&lt;p&gt;The target check catches a handoff opened in the wrong tool. It is not an authorization boundary against arbitrary code running on the same origin. The random ID is a lookup key, not a replacement for the browser’s origin boundary or the application’s security controls.&lt;/p&gt;

&lt;p&gt;If the metadata exists but the file is missing, FlowPick removes the stale record and returns a handoff-not-found error.&lt;/p&gt;

&lt;h2&gt;
  
  
  File lifetime needs more than a reference in one tab
&lt;/h2&gt;

&lt;p&gt;Consider this sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A downloader owns a completed file.&lt;/li&gt;
&lt;li&gt;It creates a handoff to a trimmer.&lt;/li&gt;
&lt;li&gt;The trimmer starts reading.&lt;/li&gt;
&lt;li&gt;The downloader clears its result.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Deleting the file at step four would be premature.&lt;/p&gt;

&lt;p&gt;FlowPick tracks asset usage with leases. Roles include &lt;code&gt;source&lt;/code&gt;, &lt;code&gt;handoff&lt;/code&gt;, &lt;code&gt;preview&lt;/code&gt;, &lt;code&gt;conversion&lt;/code&gt;, &lt;code&gt;result&lt;/code&gt;, and &lt;code&gt;download&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A handoff lease and a receiving tool’s consumer lease represent different uses. Releasing one should not imply that every other use has finished.&lt;/p&gt;

&lt;p&gt;The current asset manager uses these timing values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LEASE_TTL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;HEARTBEAT_INTERVAL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Active leases refresh their expiry through a heartbeat.&lt;/p&gt;

&lt;p&gt;The handoff record has a separate one-hour validity window. These are different clocks: record validity tells the destination whether it may load a handoff; asset leases and locks help decide whether the stored files are still in use.&lt;/p&gt;

&lt;p&gt;A one-hour record expiry is not a guarantee that its file will remain available through every crash, storage eviction, or browser shutdown.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locks and expiry solve different problems
&lt;/h2&gt;

&lt;p&gt;Where available, FlowPick uses the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API" rel="noopener noreferrer"&gt;Web Locks API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An active asset holder keeps a shared lock. Garbage collection attempts to acquire an exclusive lock without waiting. If another holder still has the asset locked, that cleanup attempt skips it.&lt;/p&gt;

&lt;p&gt;This is coordination between cooperating parts of the application. A Web Lock does not independently prevent unrelated code from deleting an OPFS file.&lt;/p&gt;

&lt;p&gt;Without Web Locks, the collector relies on unexpired lease records. A separate IndexedDB lease coordinates garbage collectors across tabs.&lt;/p&gt;

&lt;p&gt;Some workflows also opt into &lt;code&gt;retainUntilExpiry&lt;/code&gt;. Their leases can be parked without immediately deleting the stored record, providing a bounded reload grace period. This is an explicit option, not a property of every handoff.&lt;/p&gt;

&lt;p&gt;The fallback behavior is useful, but it is not identical to live lock ownership. Suspended tabs, interrupted heartbeats, and browser storage policies still need to be considered.&lt;/p&gt;

&lt;h2&gt;
  
  
  A release message is a hint, not the source of truth
&lt;/h2&gt;

&lt;p&gt;FlowPick also uses &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API" rel="noopener noreferrer"&gt;BroadcastChannel&lt;/a&gt; to notify a still-open source tab when a handoff is released:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postMessage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;release&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;handoffId&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The message contains no media bytes.&lt;/p&gt;

&lt;p&gt;Why involve the source tab? A closing destination page may not finish asynchronous IndexedDB and OPFS cleanup. A source tab that remains open can help complete that work.&lt;/p&gt;

&lt;p&gt;The channel is optional. Its construction is guarded because an exposed API can still fail under a particular browser policy.&lt;/p&gt;

&lt;p&gt;There is no durable message queue or delivery acknowledgement here. File ownership is tracked through the asset-management logic, rather than inferred solely from receiving a broadcast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expiry does not run itself
&lt;/h2&gt;

&lt;p&gt;FlowPick checks for expired handoffs when creating new ones and rejects expired records when loading them. The source-side release watcher also schedules a cleanup attempt.&lt;/p&gt;

&lt;p&gt;The asset manager has a separate reconciliation pass for unregistered files in managed directories, with a grace period before removal.&lt;/p&gt;

&lt;p&gt;These are cleanup opportunities, not a background service that keeps running after the browser closes.&lt;/p&gt;

&lt;p&gt;Browser-managed storage can also be cleared or evicted. The relevant constraints are described in MDN’s &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria" rel="noopener noreferrer"&gt;storage quotas and eviction documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;OPFS is working storage in this design. A handoff is not a backup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would check before relying on this workflow
&lt;/h2&gt;

&lt;p&gt;This article describes the implementation. It does not establish a maximum supported file size, a storage-saving benchmark, or a complete browser compatibility matrix.&lt;/p&gt;

&lt;p&gt;The scenarios I would exercise include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a handoff from a Blob and from an existing OPFS result.&lt;/li&gt;
&lt;li&gt;Clearing the source result while the destination still holds a lease.&lt;/li&gt;
&lt;li&gt;Opening an expired handoff or one intended for another tool.&lt;/li&gt;
&lt;li&gt;Reloading or closing the destination during processing.&lt;/li&gt;
&lt;li&gt;Missing files, failed writes, and denied storage access.&lt;/li&gt;
&lt;li&gt;Concurrent consumers and cleanup attempts.&lt;/li&gt;
&lt;li&gt;Operation without Web Locks or BroadcastChannel.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The visible feature is a button that opens another tool with the file ready.&lt;/p&gt;

&lt;p&gt;Underneath it, the important contract is about ownership: which file the record refers to, who is still using it, and what evidence is sufficient to delete it.&lt;/p&gt;

&lt;p&gt;For FlowPick, keeping those questions separate from the media-processing code makes the handoff easier to reason about—and makes “continue in another tool” more than a shortcut to another file picker.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I’m the author of FlowPick. This article was drafted with AI assistance based on the project’s OPFS handoff and asset-management implementation. It does not report new performance measurements or cross-browser test results.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Building Browser-Based Transcription: Workers, Cancellation, and Honest Progress</title>
      <dc:creator>FlowPick Team</dc:creator>
      <pubDate>Fri, 30 Oct 2026 03:29:05 +0000</pubDate>
      <link>https://dev.to/flowpick/building-browser-based-transcription-workers-cancellation-and-honest-progress-4b3o</link>
      <guid>https://dev.to/flowpick/building-browser-based-transcription-workers-cancellation-and-honest-progress-4b3o</guid>
      <description>&lt;p&gt;A transcription demo can be surprisingly short: load a model, pass it some audio, display the text.&lt;/p&gt;

&lt;p&gt;A transcription tool needs to answer more awkward questions.&lt;/p&gt;

&lt;p&gt;Is it downloading the model or processing the recording? What happens when someone cancels halfway through? Does “local” mean it works without an internet connection? And what happens to a sentence that crosses the boundary between two audio windows?&lt;/p&gt;

&lt;p&gt;I’m the author of &lt;a href="https://flowpick.net/tools/audio-to-text" rel="noopener noreferrer"&gt;FlowPick&lt;/a&gt;, a browser extension and collection of audio and video tools. This article covers the local transcription implementation in its web tools: Transformers.js for recognition, Mediabunny for reading media, and a dedicated Web Worker for each task.&lt;/p&gt;

&lt;p&gt;It is an implementation walkthrough, not an accuracy or performance benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  The file stays local. The model still has to arrive.
&lt;/h2&gt;

&lt;p&gt;FlowPick’s local transcription path reads a user-selected file and runs recognition in the browser. It does not upload that media file for transcription.&lt;/p&gt;

&lt;p&gt;The application still downloads model and runtime files when needed. These are different kinds of network traffic, and the interface should explain the difference.&lt;/p&gt;

&lt;p&gt;The current implementation offers the multilingual Whisper Tiny and Base models through Transformers.js. Model and runtime assets are served from FlowPick’s static asset host.&lt;/p&gt;

&lt;p&gt;The processing path looks like this:&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%2Fbjq1ozgrdtpqwmi81xln.png" 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%2Fbjq1ozgrdtpqwmi81xln.png" alt="FlowPick local transcription pipeline: a selected file is decoded into 16 kHz mono audio, processed by Whisper in a Worker, and returned as editable timed segments. Model and runtime downloads are separate from media processing." width="800" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This diagram describes the transcription path. Website analytics and optional cloud services are separate concerns; running inference locally does not establish that an entire website makes no network requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give each task its own Worker
&lt;/h2&gt;

&lt;p&gt;FlowPick creates a new module Worker when transcription starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;worker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Worker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../workers/audio-to-text.worker.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;module&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;worker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postMessage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;settings&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Worker owns input inspection, model initialization, audio decoding, and inference. The main thread owns the interface.&lt;/p&gt;

&lt;p&gt;This keeps the processing loop away from UI work. It also gives the task a clear lifetime: one transcription task, one Worker.&lt;/p&gt;

&lt;p&gt;There is a cost. A new task initializes a recognizer again, even when its model files are already cached. A persistent Worker could reuse the model instance, but would need more lifecycle management around cancellation, stale messages, and concurrent requests.&lt;/p&gt;

&lt;p&gt;For this implementation, task isolation makes that ownership easier to follow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progress is several different measurements
&lt;/h2&gt;

&lt;p&gt;A single percentage cannot explain the whole job.&lt;/p&gt;

&lt;p&gt;Downloading a model has a byte count. Transcribing a recording has a position on the media timeline. Checking whether an audio track can be decoded has neither.&lt;/p&gt;

&lt;p&gt;FlowPick sends separate events for these:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;TranscriptionEvent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;checking&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;loading&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;decoding&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;detecting&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;transcribing&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;download&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
      &lt;span class="na"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
      &lt;span class="na"&gt;loaded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
      &lt;span class="na"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;segments&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="na"&gt;segments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;TranscriptSegment&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
      &lt;span class="na"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
      &lt;span class="na"&gt;processed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
      &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;language&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;language&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;complete&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During model loading, the UI can show the file being downloaded. When its total size is unavailable, progress remains indeterminate.&lt;/p&gt;

&lt;p&gt;During recognition, progress comes from the end of the completed audio interval:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;coreEnd&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;duration&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That means “this much of the recording has been processed.” It is not an estimate of elapsed computing time.&lt;/p&gt;

&lt;p&gt;The distinction matters. Reaching 50% of the audio does not promise that the remaining work will take exactly as long as the first half.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decode manageable windows
&lt;/h2&gt;

&lt;p&gt;Before loading the recognizer, the Worker checks the input:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can the container be read?&lt;/li&gt;
&lt;li&gt;For the video tool, is there a video track?&lt;/li&gt;
&lt;li&gt;Is there an audio track?&lt;/li&gt;
&lt;li&gt;Can that audio track be decoded?&lt;/li&gt;
&lt;li&gt;Is its duration finite and greater than zero?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A file extension alone cannot answer these questions.&lt;/p&gt;

&lt;p&gt;The Worker then uses Mediabunny’s &lt;code&gt;AudioSampleSink&lt;/code&gt; to read audio over bounded intervals. Samples are downmixed and resampled into a 16 kHz mono &lt;code&gt;Float32Array&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;FlowPick uses 25-second core intervals with up to 2.5 seconds of context on either side:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;coreEnd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;2.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;coreEnd&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;2.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;audio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Float32Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;// Decode this interval, then run recognition.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The maximum interval is 30 seconds, matching Whisper’s audio-window design. OpenAI describes that design in the &lt;a href="https://github.com/openai/whisper" rel="noopener noreferrer"&gt;Whisper repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The mono input array for a full window occupies about 1.92 MB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;30 seconds × 16,000 samples/second × 4 bytes/sample
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is only the input array. It excludes model weights, inference tensors, decoder buffers, the selected file, and accumulated transcript data.&lt;/p&gt;

&lt;p&gt;Windowed decoding bounds this part of memory use. It does not make the whole application constant-memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overlap needs an ownership rule
&lt;/h2&gt;

&lt;p&gt;Context helps when a sentence crosses a window boundary. It can also produce duplicate text.&lt;/p&gt;

&lt;p&gt;FlowPick assigns each recognized segment to a core interval according to the midpoint of its timestamp range. Simplified from the implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;midpoint&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;segment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;midpoint&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;coreStart&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;midpoint&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nx"&gt;coreEnd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timestamps are first converted from window-relative positions to positions in the original recording.&lt;/p&gt;

&lt;p&gt;There is also a reconciliation step for a specific boundary case: a truncated cue at the end of one window followed by a fuller, overlapping recognition in the next. It compares normalized text prefixes before replacing the earlier cue.&lt;/p&gt;

&lt;p&gt;These are application heuristics. They do not guarantee perfect sentence boundaries or remove the need to review subtitles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto-detection should be allowed to say “uncertain”
&lt;/h2&gt;

&lt;p&gt;Automatic language selection needs more than leaving a setting blank.&lt;/p&gt;

&lt;p&gt;The implementation includes an explicit language-token prediction step. It passes the audio features and decoder start token to the model, then compares scores for the supported language tokens.&lt;/p&gt;

&lt;p&gt;FlowPick’s acceptance rule requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A normalized top score of at least 0.5.&lt;/li&gt;
&lt;li&gt;A margin of at least 0.15 over the next candidate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are application thresholds, not a published accuracy guarantee. The resulting “confidence” is a normalized score among language-token candidates, not a calibrated probability that the language is correct.&lt;/p&gt;

&lt;p&gt;If the result is too ambiguous, the Worker returns &lt;code&gt;language-uncertain&lt;/code&gt; so the user can choose a language.&lt;/p&gt;

&lt;p&gt;The detected language is reused for subsequent windows in the task. That also means this approach should not be presented as reliable language switching for multilingual conversations.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebGPU support is only the first check
&lt;/h2&gt;

&lt;p&gt;A browser exposing &lt;code&gt;navigator.gpu&lt;/code&gt; does not prove that GPU inference is the best default for that device.&lt;/p&gt;

&lt;p&gt;FlowPick uses a conservative recommendation function. It considers whether an adapter is available, reported memory, buffer limits, and adapter information. Unknown or integrated adapters generally receive the WASM recommendation.&lt;/p&gt;

&lt;p&gt;This is a product heuristic, not a hardware benchmark.&lt;/p&gt;

&lt;p&gt;The current recognizer configuration also differs by backend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dtype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;device&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webgpu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;encoder_model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fp32&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;decoder_model_merged&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;q4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;q8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The WASM runtime is configured for one thread in this path.&lt;/p&gt;

&lt;p&gt;In automatic mode, a WebGPU model-loading failure can trigger a retry using WASM. That retry is deliberately narrower than “retry every GPU error”: it applies to model initialization failures, rather than silently restarting every failed transcription.&lt;/p&gt;

&lt;p&gt;For the relevant API and quantization options, see the &lt;a href="https://huggingface.co/docs/transformers.js/v3.8.1/en/index" rel="noopener noreferrer"&gt;Transformers.js documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cancel must end the task
&lt;/h2&gt;

&lt;p&gt;Changing a button label to “Cancelled” is not sufficient if inference continues running.&lt;/p&gt;

&lt;p&gt;FlowPick’s task wrapper terminates the Worker and rejects the task promise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;settled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;

  &lt;span class="nf"&gt;finish&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// marks settled and calls worker.terminate()&lt;/span&gt;

  &lt;span class="nf"&gt;rejectTask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DOMException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cancelled&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;AbortError&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The UI treats &lt;code&gt;AbortError&lt;/code&gt; as cancellation rather than a processing failure. Segments already delivered to the main thread can remain available as a partial result.&lt;/p&gt;

&lt;p&gt;There is an important cleanup detail here. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Worker/terminate" rel="noopener noreferrer"&gt;&lt;code&gt;Worker.terminate()&lt;/code&gt;&lt;/a&gt; stops the Worker immediately; it does not wait for the Worker’s code to finish.&lt;/p&gt;

&lt;p&gt;The Worker’s normal path has a &lt;code&gt;finally&lt;/code&gt; block that disposes the media input and recognizer. Forced termination must not depend on that block running.&lt;/p&gt;

&lt;p&gt;This design uses the Worker lifetime as the cancellation boundary. It does not promise that every underlying resource is reclaimed synchronously at the moment the user clicks Cancel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Export is part of the implementation
&lt;/h2&gt;

&lt;p&gt;FlowPick returns editable segments with a small internal shape:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;TranscriptSegment&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exporter supports TXT, SRT, and WebVTT. Before formatting timed subtitles, it removes invalid or empty cues, sorts them, and clips an end time against the next cue’s start.&lt;/p&gt;

&lt;p&gt;It also prevents edited text containing blank lines or &lt;code&gt;--&amp;gt;&lt;/code&gt; from accidentally creating another cue structure.&lt;/p&gt;

&lt;p&gt;For WebVTT, the output includes the &lt;code&gt;WEBVTT&lt;/code&gt; header and dot-separated milliseconds. The format is defined in the &lt;a href="https://www.w3.org/TR/webvtt1/" rel="noopener noreferrer"&gt;W3C WebVTT specification&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Formatting valid subtitle text and recognizing speech accurately are separate jobs. Both need attention.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would verify before trusting a result
&lt;/h2&gt;

&lt;p&gt;This article does not establish a word error rate, cross-browser compatibility matrix, or real-time processing speed.&lt;/p&gt;

&lt;p&gt;For a particular recording and device, I would check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cold-cache and warm-cache model loading separately.&lt;/li&gt;
&lt;li&gt;Cancellation during loading, decoding, and recognition.&lt;/li&gt;
&lt;li&gt;Silent input and files with no decodable audio.&lt;/li&gt;
&lt;li&gt;Speech crossing the 25-second core boundaries.&lt;/li&gt;
&lt;li&gt;Ambiguous language detection and manually selected language.&lt;/li&gt;
&lt;li&gt;Exported subtitles in the player where they will be used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Names, technical vocabulary, overlapping speakers, and noisy recordings still deserve manual review.&lt;/p&gt;

&lt;p&gt;The model call is one part of this tool. Most of the surrounding implementation exists to make its behavior understandable: which stage is running, what has been processed, what failed, and whether the user can stop it.&lt;/p&gt;

&lt;p&gt;That is the part I would build early in another browser transcription project, before spending much time polishing the transcript screen.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I’m the author of FlowPick. This article was drafted with AI assistance based on the project’s implementation. It does not report new performance or accuracy measurements.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ai</category>
    </item>
    <item>
      <title>🛠️ How to Run a Privacy-First, Browser-Based Stream Downloader (FlowPick) — A Hands-On Tutorial</title>
      <dc:creator>FlowPick Team</dc:creator>
      <pubDate>Sun, 26 Jul 2026 12:34:56 +0000</pubDate>
      <link>https://dev.to/flowpick/how-to-run-a-privacy-first-browser-based-stream-downloader-flowpick-a-hands-on-tutorial-ljd</link>
      <guid>https://dev.to/flowpick/how-to-run-a-privacy-first-browser-based-stream-downloader-flowpick-a-hands-on-tutorial-ljd</guid>
      <description>&lt;p&gt;Hey folks 👋&lt;/p&gt;

&lt;p&gt;If you've ever wanted to save a video lecture, a livestream replay, or a podcast episode for offline listening, you've probably run into the usual options: sketchy "online video parser" websites that ask you to paste your link into &lt;em&gt;their&lt;/em&gt; server, or desktop apps that want you to sign up and upload stuff. Neither feels great when the whole point is &lt;em&gt;your&lt;/em&gt; content.&lt;/p&gt;

&lt;p&gt;I went looking for something better and ended up working with &lt;strong&gt;FlowPick&lt;/strong&gt; — an open-source, privacy-first media downloader that runs entirely in your browser. No uploads, no accounts, no telemetry. Everything (sniffing, downloading, merging, transcoding) happens client-side with FFmpeg compiled to WebAssembly.&lt;/p&gt;

&lt;p&gt;In this tutorial we'll:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone and run FlowPick locally&lt;/li&gt;
&lt;li&gt;Download our first HLS (&lt;code&gt;.m3u8&lt;/code&gt;) and DASH (&lt;code&gt;.mpd&lt;/code&gt;) stream&lt;/li&gt;
&lt;li&gt;Build and deploy it&lt;/li&gt;
&lt;li&gt;Poke at the internals so we can customize it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you just want to try it without installing anything, there's a hosted version at &lt;strong&gt;&lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;https://flowpick.net&lt;/a&gt;&lt;/strong&gt; (more below). The full source is on GitHub: &lt;strong&gt;&lt;a href="https://github.com/ezwebtools/flowpick" rel="noopener noreferrer"&gt;https://github.com/ezwebtools/flowpick&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔗 Repo: &lt;a href="https://github.com/ezwebtools/flowpick" rel="noopener noreferrer"&gt;https://github.com/ezwebtools/flowpick&lt;/a&gt; · Live tools: &lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;https://flowpick.net&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  A 30-second primer: what are HLS and DASH?
&lt;/h2&gt;

&lt;p&gt;Before we touch code, two words you'll see everywhere in this space:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HLS (HTTP Live Streaming)&lt;/strong&gt; uses a &lt;code&gt;.m3u8&lt;/code&gt; &lt;em&gt;manifest&lt;/em&gt; that lists small &lt;code&gt;.ts&lt;/code&gt; (or fMP4) segments. Common for live streams and a lot of video platforms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DASH (Dynamic Adaptive Streaming over HTTP)&lt;/strong&gt; uses a &lt;code&gt;.mpd&lt;/code&gt; manifest; video and audio usually travel as separate &lt;code&gt;.m4s&lt;/code&gt; tracks. YouTube and Bilibili lean on this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key idea: the "video" isn't one file. It's a playlist pointing at dozens (sometimes hundreds) of tiny segments. A downloader's job is to fetch all the segments, decrypt them if needed, and stitch them back into one playable file. That's exactly what FlowPick does — in the browser.&lt;/p&gt;




&lt;h2&gt;
  
  
  What FlowPick is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;FlowPick is a Nuxt 4 app that ships in two shapes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;browser extension&lt;/strong&gt; that sniffs media from the current tab's network requests.&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;online tool website&lt;/strong&gt; with dedicated M3U8 and DASH downloaders.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both share the same core download engine (a couple of Vue composables). It handles HLS, DASH, plain video/audio files, and images. Encrypted HLS (AES-128) is decrypted in-browser via the Web Crypto API — the key never leaves your machine.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node.js 20 LTS&lt;/strong&gt; or newer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pnpm&lt;/strong&gt; (the repo scripts assume it; npm/yarn work if you align the lockfile)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;   &lt;span class="c"&gt;# should be v20.x or higher&lt;/span&gt;
pnpm &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 1 — Clone and install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/ezwebtools/flowpick.git
&lt;span class="nb"&gt;cd &lt;/span&gt;flowpick
pnpm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Heads up: the &lt;code&gt;postinstall&lt;/code&gt; script runs &lt;code&gt;nuxt prepare&lt;/code&gt; automatically, which generates type declarations and the route manifest. The first install takes a bit longer — that's expected. If it ever gets interrupted, just run &lt;code&gt;pnpm exec nuxt prepare&lt;/code&gt; to catch up.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2 — Run it locally
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;strong&gt;&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;/strong&gt;. The pages you care about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/m3u8-downloader&lt;/code&gt; — for HLS streams&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/dash-downloader&lt;/code&gt; — for DASH streams&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/docs&lt;/code&gt; — full documentation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/blog&lt;/code&gt; — tutorials and deep dives&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prefer not to install anything? The same tools are live at &lt;strong&gt;&lt;a href="https://flowpick.net/m3u8-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/m3u8-downloader&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://flowpick.net/dash-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/dash-downloader&lt;/a&gt;&lt;/strong&gt;. That's the fastest way to test the workflow before you self-host.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔗 Try it now: &lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;https://flowpick.net&lt;/a&gt; · M3U8 tool: &lt;a href="https://flowpick.net/m3u8-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/m3u8-downloader&lt;/a&gt; · DASH tool: &lt;a href="https://flowpick.net/dash-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/dash-downloader&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 3 — Download your first stream
&lt;/h2&gt;

&lt;h3&gt;
  
  
  HLS example
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Find a page that serves an &lt;code&gt;.m3u8&lt;/code&gt; stream. Open DevTools (F12) → &lt;strong&gt;Network&lt;/strong&gt; → filter &lt;code&gt;m3u8&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Play the video for a few seconds so the manifest actually gets requested.&lt;/li&gt;
&lt;li&gt;Right-click the &lt;code&gt;.m3u8&lt;/code&gt; request → &lt;strong&gt;Copy link address&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Paste it into the M3U8 Downloader (localhost or the hosted one).&lt;/li&gt;
&lt;li&gt;Hit &lt;strong&gt;Parse&lt;/strong&gt;. FlowPick reads the manifest and lists available qualities.&lt;/li&gt;
&lt;li&gt;Pick a quality, hit &lt;strong&gt;Start Download&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Under the hood FlowPick downloads every segment, decrypts if needed (AES-128), and merges them. For MP4 output it runs a remux —&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; input.ts &lt;span class="nt"&gt;-c&lt;/span&gt; copy output.mp4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;— entirely in the browser. No re-encoding, no quality loss, and your file never touches a server.&lt;/p&gt;

&lt;h3&gt;
  
  
  DASH example
&lt;/h3&gt;

&lt;p&gt;Paste the &lt;code&gt;.mpd&lt;/code&gt; URL into the DASH Downloader, choose your video and audio tracks, and FlowPick auto-merges A/V for you. Because DASH keeps video and audio in separate streams, this merge step is what turns it into a single watchable file.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 The hosted tools at &lt;strong&gt;&lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;https://flowpick.net&lt;/a&gt;&lt;/strong&gt; are perfect when you're on a machine where you can't install the extension.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 4 — Build and deploy
&lt;/h2&gt;

&lt;p&gt;Production build:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm build
pnpm preview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The default Nitro preset is &lt;code&gt;cloudflare-pages-static&lt;/code&gt;, so &lt;code&gt;pnpm build&lt;/code&gt; emits static assets in &lt;code&gt;.output/&lt;/code&gt;. You can drop that on any static host — Cloudflare Pages, Netlify, Vercel, or your own cloud. Want a Node server instead? Switch &lt;code&gt;nitro.preset&lt;/code&gt; to &lt;code&gt;node-server&lt;/code&gt;, rebuild, and run &lt;code&gt;node .output/server/index.mjs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One thing you must keep:&lt;/strong&gt; the downloader routes set two response headers —&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These enable &lt;strong&gt;cross-origin isolation&lt;/strong&gt;, which is what lets FFmpeg WASM use multiple threads (via &lt;code&gt;SharedArrayBuffer&lt;/code&gt;) and lets large files stream to disk via StreamSaver. Drop them and big downloads silently degrade.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5 — Customize it
&lt;/h2&gt;

&lt;p&gt;Low-effort tweaks that go a long way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Edit docs / copy&lt;/strong&gt;: everything in &lt;code&gt;content/&lt;/code&gt; is Markdown or YAML, validated by a Zod schema. Change text or add a page; it's live on reload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tune the engine&lt;/strong&gt;: open &lt;code&gt;app/composables/useStreamMerge.ts&lt;/code&gt;. Default concurrency is &lt;code&gt;2&lt;/code&gt; (range &lt;code&gt;1–8&lt;/code&gt;); retries use exponential backoff (max &lt;code&gt;3&lt;/code&gt;); writes fall back &lt;code&gt;FSA → StreamSaver → Blob&lt;/code&gt; automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Config&lt;/strong&gt;: &lt;code&gt;nuxt.config.ts&lt;/code&gt; holds i18n (en / zh-Hans / zh-Hant / ja / ko), runtime config for analytics (&lt;code&gt;NUXT_PUBLIC_GA_ID&lt;/code&gt;, &lt;code&gt;NUXT_PUBLIC_CLARITY_ID&lt;/code&gt;), and the route headers above.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A concrete example — bump the default concurrency for fast broadband by tweaking the settings defaults in the extension/online tool UI, or change the write buffer by editing &lt;code&gt;useStreamMerge.ts&lt;/code&gt;. The composable's input shape is clean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;StreamMergeOptions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;segments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;ArrayBuffer&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nx"&gt;AsyncGenerator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;ArrayBuffer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;totalSegments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
  &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;outputFormat&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mp4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="nx"&gt;onProgress&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;StreamMergeProgress&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;
  &lt;span class="nx"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;AbortSignal&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How it actually works (the fun part)
&lt;/h2&gt;

&lt;p&gt;The engine is two composables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useStreamMerge.ts&lt;/code&gt; — downloads segments with a &lt;strong&gt;Worker Pool&lt;/strong&gt; (shared counter, so no worker sits idle), decrypts AES-128 with Web Crypto, concatenates (TS) or remuxes (MP4) via FFmpeg, then writes using the best available strategy.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useFFmpeg.ts&lt;/code&gt; — loads &lt;code&gt;@ffmpeg/ffmpeg&lt;/code&gt; (WASM), detects multithreading support, and runs merge/remux commands.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The write strategy is the clever bit:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;FSA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Chrome/Edge 86+&lt;/td&gt;
&lt;td&gt;Streaming write, any size, constant memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;StreamSaver&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Wide compatibility&lt;/td&gt;
&lt;td&gt;Service Worker proxy, supports large files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Blob&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fallback&lt;/td&gt;
&lt;td&gt;Memory-limited; files over ~1.5 GB rejected&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Caveats — read before you ship
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DRM-protected content (Widevine, etc.) can't be decoded.&lt;/strong&gt; By design.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The web tool is subject to CORS.&lt;/strong&gt; If the stream server doesn't send cross-origin headers, use the extension instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FFmpeg WASM is ~8 MB on first load&lt;/strong&gt; (cached afterward).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Big-file experience is best on Chrome/Edge&lt;/strong&gt;; Safari falls back to Blob mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also: only download content you're allowed to. Respect each platform's terms and your local laws — keep downloads for personal/offline use, don't redistribute.&lt;/p&gt;




&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;That's the whole loop: clone → run → download your first stream → build → deploy → customize. FlowPick is open source on &lt;strong&gt;&lt;a href="https://github.com/ezwebtools/flowpick" rel="noopener noreferrer"&gt;https://github.com/ezwebtools/flowpick&lt;/a&gt;&lt;/strong&gt;, and you can try the hosted tools right now at &lt;strong&gt;&lt;a href="https://flowpick.net" rel="noopener noreferrer"&gt;https://flowpick.net&lt;/a&gt;&lt;/strong&gt; (M3U8: &lt;strong&gt;&lt;a href="https://flowpick.net/m3u8-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/m3u8-downloader&lt;/a&gt;&lt;/strong&gt;, DASH: &lt;strong&gt;&lt;a href="https://flowpick.net/dash-downloader" rel="noopener noreferrer"&gt;https://flowpick.net/dash-downloader&lt;/a&gt;&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;If this was useful, drop a ❤️ or a comment, and tell me what you'd build on top of it. Happy hacking!&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>opensource</category>
      <category>ffmpeg</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
