Skip to content

wabiloo/vscode-m3u8-language

Repository files navigation

M3U8 / HLS Language Support

Visual Studio Code extension providing support for M3U8 (HLS) files and streams.

Features

HLS syntax

Syntax highlighting

  • HLS tags, attributes and their values
  • URIs and URLs
  • Attribute types: numbers, dates, etc
  • Comments
  • Unknown (or invalid) tags and attributes (as per the RFC8216 specification)

Visual cues

Additional visual cues can be turned on/off through configuration:

  • Folding support for segments and associated tags
  • Colour banding of segments for easier reading
    • Including specific colors for segments with user-defined tags
  • Segment number decoration on each line, with running duration and (where applicable) program date time
  • Gutter icons for specific tags (in multivariant playlists and for cues and signals)

Syntax Highlighting

Inline documentation

Documentation for spec-compliant tags (and some other common ones) on hover, with links to the relevant sections of the RFC8216 specification

Tag Documentation

SCTE-35

  • Parse SCTE-35 strings (base64 or hex) directly from HLS tags (code lens)
  • Parse SCTE-35 strings (base64 or hex) (via palette command Parse SCTE-35 Data)
  • Display the results in a new tab, formatted or as JSON

SCTE-35 Parsing

This functionality is powered by the scte35-js library

Working with HLS streams

Remote playlists

All the functionality above is available for local files, but the extensions also make it possible to work with HTTP streams.

  • Open and view M3U8 playlists served over HTTP or HTTPS (via palette command Open Remote Playlist)
  • Auto-refresh support for live playlists with configurable interval (defaulting to #EXT-X-TARGETDURATION) (via status bar button, or palette command Toggle Auto-Refresh)
  • Manual refresh option for on-demand updates (command Refresh Current Playlist)

Remote Playlist Support

From within a multi-variant playlist, you can also with a simple click open and navigate to any of the variants.

Play and download segments

From within a media playlist, you can play and/or download segments with a simple click.

When the semgents require an initialization segment, the extension will automatically download and concatenate it with the segment.

Play and download segments

Browser monitoring

Ever tried debugging HLS streams in a browser? I find it is a major pain...

So, this extension also makes it possible to work with streams being played in a web player (via palette command Open Network Inspector). It leverages the Chrome DevTools Protocol, and exposes within a table all requests for M3U8 playlists (on-demand or live).

  • Monitor multiple browser tabs, and easily identify what M3U8 requests are made by which tab.
  • Refresh the tab content from within VS Code.
  • For live playlists, columns show the media sequence and discontinuity sequence tag values.
  • Filter the table for any string in the URL
  • Highlight in the table any request whose body contains a specific string.
  • Click on any row to show the HLS body in a tab. Ctrl/Cmd+click on multiple to open them in separate tabs (ideal to compare them using the standard VS Code diff tool).

Network Inspector

This feature should work with any web player that uses the Chrome DevTools Protocol, including Chrome, Edge and any Chromium-based browser.

Start your browser with the remote debugging port enabled, which usually involves executing it with the command line argument --remote-debugging-port=9222. If the extension can't detect it, it will offer to (re)start your browser with the correct argument.

Extension Settings

This extension contributes the following settings:

  • m3u8.features.colorBanding: Enable color banding of segments for easier reading (default: true)
  • m3u8.features.segmentNumbering: Show segment numbers in the right margin (default: true)
  • m3u8.features.folding: Enable folding support for segments and associated tags (default: true)
  • m3u8.features.gutterIcons: Show gutter icons for playlist pointers in multivariant playlists (default: true)
  • m3u8.features.showRunningDuration: Show running duration for each segment (default: true)
  • m3u8.features.showProgramDateTime: Show effective timestamp for each segment (default: true)
  • m3u8.features.clickableLinks: Enable clickable links for URIs in playlists (default: true)
  • m3u8.features.tagColors: List of tag colors in format "TAG,borderColor,backgroundColor" (default: [])
  • m3u8.features.defaultColors: Default colors for odd/even segments when no tag colors match (see below)
  • m3u8.features.showTagDocumentation: Show documentation tooltips for HLS tags (default: true)

Default Colors

The m3u8.features.defaultColors setting allows you to customize the colors used for alternating segments when no tag colors match. The default values are:

{
    "odd": {
        "backgroundColor": "rgba(25, 35, 50, 0.35)",
        "borderColor": "rgba(50, 120, 220, 0.8)"
    },
    "even": {
        "backgroundColor": "rgba(40, 55, 75, 0.25)",
        "borderColor": "rgba(100, 160, 255, 0.6)"
    }
}

Settings

Commands

The extension provides the following commands:

  • M3U8 / HLS: Open Remote Playlist: Open a remote M3U8 playlist by entering its URL
  • M3U8 / HLS: Refresh Current Playlist: Manually refresh the current remote playlist
  • M3U8 / HLS: Toggle Auto-Refresh: Enable or disable automatic refreshing of the current remote playlist (not available for multi-variant playlists)
  • M3U8 / HLS: Parse SCTE-35 Payload: Parse a SCTE-35 payload and display the results in a new tab
  • M3U8 / HLS: Open Network Inspector: Hook onto a web browser to monitor HLS streams

Examples

The extension includes example files in the examples directory demonstrating some of the features.

Contributing

Found a bug or have a feature request? Please open an issue on GitHub.

License

This extension is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published