From 6b0af9066498bfb88a353aa2ba2ca1bb77521492 Mon Sep 17 00:00:00 2001 From: Nathan Sprenkle Date: Wed, 29 Oct 2025 15:24:33 -0400 Subject: [PATCH] feat: add a default audio codec for the HLS video player (#37525) This seems to reduce instances of audio garbling when switching levels during HLS video streaming. --- xmodule/assets/video/public/js/02_html5_hls_video.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xmodule/assets/video/public/js/02_html5_hls_video.js b/xmodule/assets/video/public/js/02_html5_hls_video.js index ddc198bc72..094b6d87c6 100644 --- a/xmodule/assets/video/public/js/02_html5_hls_video.js +++ b/xmodule/assets/video/public/js/02_html5_hls_video.js @@ -27,6 +27,12 @@ HLSVideo.Player = (function() { // do common initialization independent of player type this.init(el, config); + // set a default audio codec if not provided, this helps reduce issues + // switching audio codecs during playback + if (!this.config.defaultAudioCodec) { + this.config.defaultAudioCodec = "mp4a.40.5"; + } + _.bindAll(this, 'playVideo', 'pauseVideo', 'onReady'); // If we have only HLS sources and browser doesn't support HLS then show error message.