Skip to content

Conversation

@nsprenkle
Copy link
Member

Deploy of openedx#37525

Description

Some HLS video sources, when performing a level switch from default starting bitrate to a different bitrate encounter an error which causes garbled audio.

Defining a default audio codec seems to reduce this occurrence. See the docs which note that omitting a default value can cause issues.

NOTE that the real fix is probably to update our now five years out-of-date HLS library version but that is a whole other conversation for a different day and can probably just be deferred to extraction of the video block.

Testing instructions

  1. Load a known broken video. These are often from outside sources like private YouTube videos or CloudFront hosted files.
  2. Before fix, at the 10 second mark the video should perform a level switch and cause broken audio.
  3. After fix, there should be no breakage to audio.

This seems to reduce instances of audio garbling when switching levels during HLS video streaming.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a default audio codec configuration for the HLS video player to help reduce audio issues when HLS videos perform bitrate level switches during playback. According to the PR description, this addresses garbled audio problems that occur when videos switch from the default starting bitrate to a different bitrate, particularly for content from external sources.

Key changes:

  • Sets a default audio codec value (mp4a.40.5) in the HLS video player configuration if one is not already provided

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +33
if (!this.config.defaultAudioCodec) {
this.config.defaultAudioCodec = "mp4a.40.5";
}
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaultAudioCodec configuration is set on this.config but is never passed to the HLS constructor. Lines 54 and 56 instantiate HLS with only {autoStartLoad: true/false}. To fix this, include defaultAudioCodec in the HLS configuration object: this.hls = new HLS({autoStartLoad: true, defaultAudioCodec: this.config.defaultAudioCodec});

Copilot uses AI. Check for mistakes.
@nsprenkle nsprenkle merged commit 68322bc into release-ulmo Oct 30, 2025
70 checks passed
@nsprenkle nsprenkle deleted the nsprenkle/video-default-audio-codec-cherry-pick branch October 30, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants