<?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: CodeLit</title>
    <description>The latest articles on DEV Community by CodeLit (codelitdev).</description>
    <link>https://dev.to/codelitdev</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%2Forganization%2Fprofile_image%2F16754%2F2710e674-bca9-46e8-8d2d-88d7dff68226.png</url>
      <title>DEV Community: CodeLit</title>
      <link>https://dev.to/codelitdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codelitdev"/>
    <language>en</language>
    <item>
      <title>Video captions and transcripts in Node.js with WebVTT</title>
      <dc:creator>Varsha</dc:creator>
      <pubDate>Sat, 05 Dec 2026 10:27:55 +0000</pubDate>
      <link>https://dev.to/codelitdev/video-captions-and-transcripts-in-nodejs-with-webvtt-24b1</link>
      <guid>https://dev.to/codelitdev/video-captions-and-transcripts-in-nodejs-with-webvtt-24b1</guid>
      <description>&lt;p&gt;People who upload video eventually want two things: captions in the player, and a transcript they can sit beside the file or build on. We added both to MediaLit. This post is the engineering story: what a sealed upload actually gets, why captions stay off until you turn them on, and how a single seal can override the app's settings without turning HLS on for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a captioned upload gets
&lt;/h2&gt;

&lt;p&gt;MediaLit already treated video as something you process after you decide to keep the file. An upload starts temporary. You seal it when your app actually uses it, and that is when posters, an optional web MP4 or HLS, and now &lt;a href="https://medialit.cloud/docs/concepts#captions" rel="noopener noreferrer"&gt;captions&lt;/a&gt;, are queued.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;generateCaptions&lt;/code&gt; on, a sealed video or audio file gets a &lt;code&gt;captions&lt;/code&gt; derivative once the transcription worker finishes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;url&lt;/code&gt;, also &lt;code&gt;files.vtt&lt;/code&gt;: WebVTT captions for a &lt;code&gt;&amp;lt;track&amp;gt;&lt;/code&gt; element or any player. Each cue is at most two lines of 42 characters, and at most 7 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files.text&lt;/code&gt;: a plain transcript, with a new paragraph at a pause of two seconds or more.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files.json&lt;/code&gt;: the same text with times, as &lt;code&gt;{ version, language, durationSeconds, model, segments: [{ id, start, end, text }] }&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;language&lt;/code&gt;: the spoken language as an ISO 639-1 code, such as &lt;code&gt;en&lt;/code&gt; or &lt;code&gt;hi&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The captions and the transcripts are built from the same segments, so they agree. We don't edit them. The JSON file is enough to highlight the line being spoken and seek when a line is clicked: you need the segments and the video's &lt;code&gt;currentTime&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A file with no audio is not captioned. If seal already saw that there is no audio stream, there is no &lt;code&gt;captions&lt;/code&gt; derivative. If the audio can't be read later, the derivative fails with &lt;code&gt;no_audio_stream&lt;/code&gt;. Files over 1 GB or 2 hours are not captioned. A captions failure never marks the media itself as &lt;code&gt;failed&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why captions are opt-in
&lt;/h2&gt;

&lt;p&gt;Every app starts with &lt;code&gt;generateCaptions&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt;. That is deliberate.&lt;/p&gt;

&lt;p&gt;Transcription is a different kind of work from a poster or a remux. It needs a dedicated worker, from the &lt;code&gt;codelit/medialit-transcribe&lt;/code&gt; image: the API image plus faster-whisper and the &lt;code&gt;large-v3-turbo&lt;/code&gt; model. The image is about 3.3 GB, so in Docker Compose it sits behind a profile and is not pulled until you ask for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose --profile captions up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://medialit.cloud/docs/self-hosting#run-the-transcription-worker" rel="noopener noreferrer"&gt;self-hosting guide&lt;/a&gt; covers how to run that worker. One transcription runs at a time. On 2 CPUs, an hour of English audio takes about an hour; some languages take longer. Captions also count the file's whole length, silence included, toward processing minutes: a 10-minute video that is re-encoded and captioned uses 20 minutes.&lt;/p&gt;

&lt;p&gt;If we had turned captions on for every app, a self-hosted server without the worker would queue jobs that never start, and an app that only needed a poster would still spend minutes on speech-to-text. So the setting stays off, and &lt;code&gt;getSettings&lt;/code&gt; also returns &lt;code&gt;captionsAvailable&lt;/code&gt;. That flag is &lt;code&gt;false&lt;/code&gt; when no transcription worker is running. Jobs then wait in the queue; nothing else changes, and the file still becomes &lt;code&gt;ready&lt;/code&gt; without captions.&lt;/p&gt;

&lt;p&gt;Turning the setting on is one call, and it applies to files sealed afterwards:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;MediaLit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"medialit"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;medialit&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;MediaLit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;MEDIALIT_API_KEY&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;"YOUR_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;MEDIALIT_ENDPOINT&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;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;medialit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateSettings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;generateCaptions&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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same switch is in the dashboard under App settings, Media, and in the CLI as &lt;code&gt;medialit settings set --captions on&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Override processing for one upload
&lt;/h2&gt;

&lt;p&gt;App settings are a default, not a floor. The seal call can pass a &lt;code&gt;processing&lt;/code&gt; object and change &lt;code&gt;generateCaptions&lt;/code&gt;, &lt;code&gt;videoStreaming&lt;/code&gt;, or both for that file only. A field you leave out uses the app's setting. Sealing a file that is already sealed returns it unchanged and ignores &lt;code&gt;processing&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is how you caption some uploads and not others, or skip encoding for a trial account, without changing the app for everyone. With the &lt;a href="https://medialit.cloud/docs/node-sdk" rel="noopener noreferrer"&gt;Node.js SDK&lt;/a&gt;:&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="c1"&gt;// Caption this talk, even if the app has captions off.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;talk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;medialit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;seal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mediaId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;processing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;generateCaptions&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="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Skip HLS and captions for this one file.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;trial&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;medialit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;seal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;otherId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;processing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;videoStreaming&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"off"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;generateCaptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;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 same override works on the REST API and the CLI (&lt;code&gt;--captions on|off&lt;/code&gt; and &lt;code&gt;--video-streaming&lt;/code&gt; on &lt;code&gt;upload&lt;/code&gt; or &lt;code&gt;seal&lt;/code&gt;). It is accepted only from your server, because a browser cannot seal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST &lt;span class="s2"&gt;"$MEDIALIT_ENDPOINT/media/seal/$MEDIA_ID"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"x-medialit-apikey: YOUR_API_KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"content-type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"processing":{"generateCaptions":true}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  HLS stays off until an app turns it on
&lt;/h2&gt;

&lt;p&gt;Video streaming is a separate setting, and it follows the same rule. &lt;code&gt;videoStreaming&lt;/code&gt; can be &lt;code&gt;"off"&lt;/code&gt;, &lt;code&gt;"mp4"&lt;/code&gt;, or &lt;code&gt;"hls"&lt;/code&gt;. Every app starts at &lt;code&gt;"off"&lt;/code&gt;, existing or new. There is no server-wide default. Until you choose a format for that app, a sealed video gets a poster and keeps the original file.&lt;/p&gt;

&lt;p&gt;We kept it that way because encoding is work you should opt into per app. HLS in particular makes several renditions and needs CORS on storage for players that read segments with &lt;code&gt;fetch&lt;/code&gt;. An app that only stores the original should not wake up one day with a queue of encodes.&lt;/p&gt;

&lt;p&gt;You turn it on the same way as captions, for one app:&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;await&lt;/span&gt; &lt;span class="n"&gt;medialit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;updateSettings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;videoStreaming&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"hls"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;hlsRenditions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"1080p"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"720p"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"480p"&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;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;And you can still override it on a single seal, as in the trial example above, in either direction: off in an app that has HLS on, or on in an app that has it off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Captions don't hold up playback
&lt;/h2&gt;

&lt;p&gt;A sealed video is &lt;code&gt;ready&lt;/code&gt; once its poster and its MP4 or HLS are done. Captions follow in the background. &lt;code&gt;derivatives.captions&lt;/code&gt; may still be &lt;code&gt;queued&lt;/code&gt; or &lt;code&gt;processing&lt;/code&gt; when the file is already playable.&lt;/p&gt;

&lt;p&gt;The usual &lt;code&gt;media.processing.ready&lt;/code&gt; &lt;a href="https://medialit.cloud/docs/webhooks" rel="noopener noreferrer"&gt;webhook&lt;/a&gt; is not delayed for that work. When you care about captions, you also subscribe to &lt;code&gt;media.captions.ready&lt;/code&gt;. That event is sent only to endpoints that list it; a new endpoint gets the two processing events and not the captions one, unless you pass &lt;code&gt;events&lt;/code&gt;:&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;await&lt;/span&gt; &lt;span class="n"&gt;medialit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createWebhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://example.com/hooks/medialit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"media.processing.ready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"media.processing.failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"media.captions.ready"&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;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;&lt;code&gt;media.captions.ready&lt;/code&gt; fires when captions finish or fail, with &lt;code&gt;derivatives.captions.status&lt;/code&gt; set to &lt;code&gt;ready&lt;/code&gt; or &lt;code&gt;failed&lt;/code&gt;. The two events can arrive in either order. The payload carries IDs and statuses, not URLs, so you fetch the file again with &lt;code&gt;get&lt;/code&gt; when you need the VTT or transcript links.&lt;/p&gt;

&lt;h2&gt;
  
  
  Playing the captions
&lt;/h2&gt;

&lt;p&gt;In a React app, &lt;code&gt;MediaLitVideo&lt;/code&gt; already plays the best source we made â€” HLS if it is ready, then the web MP4, then the original â€” and adds a &lt;code&gt;&amp;lt;track&amp;gt;&lt;/code&gt; once &lt;code&gt;derivatives.captions&lt;/code&gt; is ready. It sets &lt;code&gt;crossorigin="anonymous"&lt;/code&gt; for that track, because the VTT is served from storage.&lt;/p&gt;

&lt;p&gt;If you render your own &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt;, the media response has everything you need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;video&lt;/span&gt; &lt;span class="n"&gt;controls&lt;/span&gt; &lt;span class="n"&gt;crossOrigin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"anonymous"&lt;/span&gt; &lt;span class="n"&gt;poster&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;thumbnail&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;derivatives&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;captions&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;track&lt;/span&gt;
      &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"captions"&lt;/span&gt;
      &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;derivatives&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;captions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;srcLang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;derivatives&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;captions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Captions"&lt;/span&gt;
      &lt;span class="k"&gt;default&lt;/span&gt;
    &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;video&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same &lt;code&gt;&amp;lt;track&amp;gt;&lt;/code&gt; works when the source is an HLS player that attaches to the element, such as hls.js. Captions are a WebVTT file next to the video, not a subtitle track baked into the HLS playlist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it together
&lt;/h2&gt;

&lt;p&gt;The shape we landed on is consistent: heavy work is off per app, a seal can override it for one file, and a slow step is not allowed to block a faster one. You can leave captions and HLS off, turn them on for a production app, and still skip them for a single upload.&lt;/p&gt;

&lt;p&gt;The code is in the &lt;a href="https://github.com/codelitdev/medialit" rel="noopener noreferrer"&gt;MediaLit repo&lt;/a&gt;. Docs and product pages are at &lt;a href="https://medialit.cloud" rel="noopener noreferrer"&gt;medialit.cloud&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>video</category>
      <category>node</category>
    </item>
    <item>
      <title>Not every user is a subscriber</title>
      <dc:creator>Varsha</dc:creator>
      <pubDate>Sat, 05 Dec 2026 10:27:32 +0000</pubDate>
      <link>https://dev.to/codelitdev/not-every-user-is-a-subscriber-5n</link>
      <guid>https://dev.to/codelitdev/not-every-user-is-a-subscriber-5n</guid>
      <description>&lt;p&gt;We run CourseLit, an open-source platform for selling courses. Every learner who signs in becomes a contact in our email tool. Their profile lives there, in custom fields.&lt;/p&gt;

&lt;p&gt;But signing in to a course isn't the same as opting into marketing email. Neither is a teammate getting invited to a school.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;SendLit, the email platform we build and run CourseLit on, treated every new contact as a subscriber. For a newsletter that's the right default. For a platform it isn't.&lt;/p&gt;

&lt;p&gt;Once we added per-contact consent history, the gap got sharper. A contact created through the API would start its history with an opt-in, when the person had only signed in.&lt;/p&gt;

&lt;p&gt;So we split the two.&lt;/p&gt;

&lt;p&gt;If you build a platform, you probably have the same shape of problem. You want every user in your email system - for receipts, onboarding, account mail - but only some of them want your newsletter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we changed
&lt;/h2&gt;

&lt;p&gt;Creating a contact now takes an optional &lt;code&gt;subscribed&lt;/code&gt; flag. It works the same in the REST API, the &lt;a href="https://sendlit.app/docs/developers/sdk" rel="noopener noreferrer"&gt;SDK&lt;/a&gt; and the MCP tool.&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;SendLit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"sendlit"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sendlit&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;SendLit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SENDLIT_API_KEY&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;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;sendlit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contacts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;learner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;subscribed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;subscribed: false&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The contact starts unsubscribed.&lt;/li&gt;
&lt;li&gt;No consent event is written.&lt;/li&gt;
&lt;li&gt;It doesn't count as a subscribed contact.&lt;/li&gt;
&lt;li&gt;Sequences don't enroll it, so a "subscriber added" welcome flow never fires.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Leave the flag out and you get the old behaviour - a subscribed contact. So nothing breaks for existing callers.&lt;/p&gt;

&lt;h2&gt;
  
  
  When they do opt in
&lt;/h2&gt;

&lt;p&gt;Later, if the learner ticks "send me updates", you update the contact with &lt;code&gt;subscribed: true&lt;/code&gt; and the consent details. That becomes their first consent record. A real one. The &lt;a href="https://sendlit.app/docs/email-marketing/contacts" rel="noopener noreferrer"&gt;contacts docs&lt;/a&gt; cover the details.&lt;/p&gt;

&lt;p&gt;So the history reads the way it happened: added as a user, opted in on a date, from a form.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters more than it looks
&lt;/h2&gt;

&lt;p&gt;Most email tools assume a contact is a subscriber. That's fine for a newsletter. It's wrong for a platform, where your user list and your marketing list are different things.&lt;/p&gt;

&lt;p&gt;Treating them as one list leaves you two bad options: keep users out of your email tool, or treat every user as a subscriber.&lt;/p&gt;

&lt;p&gt;We wanted neither for CourseLit, so we changed the tool we build.&lt;/p&gt;

&lt;p&gt;It ships in the SendLit SDK 0.9.0. SendLit is open source and you can self-host it, or use the hosted version with your own email provider.&lt;/p&gt;

</description>
      <category>email</category>
      <category>saas</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
