Radiant Media Player

AC-3 & EC-3 support



Documentation sections


Scope of support

Dolby AC-3 audio codec is a popular codec generally used to convey multi-channels audio content with video content. It is possible to use AC-3 audio with H.264 or H.265 video in Radiant Media Player. In order to support AC-3 audio the targeted device must exhibit support for it either through native HTML5 video or Media Source Extension. As of June 2018, AC-3 audio with H.264 video is supported in:

  • MS Edge for Windows 10
  • macOS 8+ Safari
  • iOS 9+ Safari

Where H.264/AC-3 is not supported we must provide an H.264/AAC audio fallback for decent device coverage. AC-3 audio-only streaming to HTML5 audio may work but has not been tested and is thus not currently supported by Radiant Media Player.

A newer version of AC-3, called EC-3, is also available on the market and the player supports it as well but not all devices supporting AC-3 can support EC-3. To detect support for EC-3 use ec-3 MIME type instead of ac-3.

While this documentation focuses on H.264/AC-3 support it may also possible to use H.265/AC-3 where both H.265 and AC-3 are supported. See the H.265 docs for more information.


H.264/AC-3 with HLS or DASH

The best way to deliver H.264/AC-3 content with HLS or DASH is to use a mix of H.264/AC-3 content and H.264/AAC content directly referenced in the master HLS playlist or DASH manifest. The codecs information must be explicitly described in the playlist or manifest. An example of such stream can be found here:

https://www.radiantmediaplayer.com/media/hls/ac3/playlist.m3u8

With the above example, where AC-3 audio is supported the player will pick the H.264/AC-3 rendition and where AC-3 is not supported the player will the H.264/AAC rendition. This example is just a basic example of how to mix H.264/AC-3 and H.264/AAC content in a HLS master playlist, in real-life use-cases each pairs of codecs are likely to have several renditions each to enable ABR streaming and this will work with the player as well.


H.264/AC-3 with MP4 progressive download

Radiant Media Player can also support H.264/AC-3 with MP4 progressive download. As with HLS or DASH you will also need to prepare an H.264/AAC rendition as a fallback where H.264/AC-3 is not supported. To accomplish this will need to use a method from the getEnvironment API method. But let us run through an example to see how it works:

<script src="https://cdn.radiantmediatechs.com/rmp/5.0.6/js/rmp.min.js"></script>
<div id="rmpPlayer"></div>
<script>
  // First we create our Radiant Media Player instance
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  // We can then gain access to the getEnvironment API method
  var env = rmp.getEnvironment();
  // We define 2 source objects, one with H.264/AC-3 and the other with H.264/AAC
  var src;
  var avcaacBitrates = {
    mp4: [
      'https://your-mp4-h264-aac-url.mp4'
    ]
  };
  var avcac3Bitrates = {
    mp4: [
      'https://your-mp4-h264-ac3-url.mp4'
    ]
  };
  // Then we can use the canPlayType method from getEnvironment API to determine if H.264/AC-3 support is available
  // See next section for documentation on canPlayType method
  src = avcaacBitrates;
  if (env.canPlayType('native', 'video', 'mp4', 'avc1.42E01E', 'ac-3')) {
    src = avcac3Bitrates;
  }
  // Then we set our player settings using the selected src object
  var settings = {
    licenseKey: 'your-license-key',
    src: src,
    width: 640,
    height: 360,
    poster: 'https://your-poster-url.jpg'
  };
  var elementID = 'rmpPlayer';
  var rmp = new RadiantMP(elementID);
  rmp.init(settings);
</script>

canPlayType method

In the above example we used the canPlayType method from the getEnvironment API.

canPlayType(mode: String, type: String, container: String, videoCodec: String, audioCodec: String, eotf: String)

canPlayType returns a Boolean stating if the targeted device supports or not the combination of provided media data. Input variables are:

  • mode can be 'native' (for native HTML5 video/audio testing) or 'mse' (for Media Source Extensions testing)
  • type can be 'video' (for video + audio content) or 'audio' (for audio-only content)
  • container can be 'mp4', 'webm', 'mp3', 'm4a', 'ogg' or 'oga'
  • videoCodec (optional) can be any valid video codec MIME type string that needs to be tested - see below for a list of common values
  • audioCodec (required) can be any valid audio codec MIME type string that needs to be tested - see below for a list of common values
  • eotf (optional) can be any valid HDR MIME type string that needs to be tested - currently 'smpte2084' value seems to be the most commonly used

Common values for videoCodec:

  • H.264 baseline 3.0: 'avc1.42E01E'
  • H.264 main 4.0: 'avc1.4D4028'
  • H.264 high 5.0 (4K video generally): 'avc1.640032'
  • H.264 AVC3 baseline 3.0 (fMP4): 'avc3.42E01E' - avc3 is a container level box to record the H.264 codec extradata - avc3 was introduced for fragmented mp4 support
  • H.265 basic support: 'hev1.1.6.L93.90' or 'hvc1.1.6.L93.90' (we need to test for both to determine HEVC support)
  • H.265 with HDR support: 'hev1.2.4.L153.B0' with eotf 'smpte2084' or 'hvc1.2.4.L153.B0' with eotf 'smpte2084'
  • VP8: 'vp8'
  • VP9: 'vp9'
  • VP9 custom profile: 'vp09.00.10.08'

Common values for audioCodec:

  • AAC-LC: 'mp4a.40.2'
  • HE-AACv1: 'mp4a.40.5'
  • HE-AACv2: 'mp4a.40.29'
  • MP3: 'mp4a.40.34'
  • AC-3: 'ac-3'
  • EC-3: 'ec-3'
  • Vorbis: 'vorbis'
  • Opus: 'opus'
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.