Skip to content

3.12.0

Choose a tag to compare

@github-actions github-actions released this 11 Oct 20:23
· 88 commits to develop since this release

Notable changes:

  • Live audio stream support for WebSocket sources (see below)
  • Improved adaptive buffer algorithm for WebSocket sources (see below)
  • Fixed keyboard shortcuts issue (stopped working) caused by the new mute/unmute icon
  • Fixed seeking after playback ended (#282)

Live audio playback

The audioUrl option, introduced in v3.11, can now also be used with live (WebSocket) sources:

AsciinemaPlayer.create("ws://example.com/ws/stream", document.getElementById("demo"), {
  audioUrl: "http://example.com/icecast/stream.ogg"
});

The URL should be a live audio source - either a direct HTTP audio stream (.mp3, .aac, .ogg, etc) such as Icecast/Shoutcast endpoint, or HLS playlist (.m3u8).

Note that it's not recommended to use autoplay: true option together with audioUrl - browsers often require explicit user activity (click, tap) to enable sound, which in the player's case would be starting the playback by clicking on the play button. Without user click the autoplay will start the playback but the sound likely won't be there.

Also, for the audio playback to work a server that handles the audio URL (e.g. Icecast) must be configured to allow CORS requests from the page (URL) that hosts the player.

New adaptive buffering

The WebSocket driver uses adaptive buffer (expressed in time) to ensure smooth, stutter free playback of live sessions with minimal latency.

The previous algorithm used a moving average over a sliding window of N recent latencies. It did ok-ish job, but given the sparse nature of the event stream (no constant rate) it turned out to be not ideal. Here's how it performed. Red dots are measured latencies, green line is effective buffer time:

old

The new algorithm uses time based EMA (exponential moving average), which is much more relevant for sparse events, resulting in more stable and overall lower buffer size when applied to a wide spectrum of terminal activities (here applied to the same input latencies as the one above):

new