Documentation

Media Preloading

Media preloading pros and cons

One way to achieve faster start-up time for your content is to enable media preloading in our player. This means that the player will start fetching content as soon as page loads (most of the time preloading is wanted at page load), more precisely with Radiant Media Player this happens when you call init method while using the preload setting.

However enabling media preloading comes at a price for both you and your viewers:

  • For your viewers: client-side bandwidth and resources (like battery & CPU) usage will be higher.
  • For you: your bandwidth cost for delivering media content may increase.

Media preloading player settings

preload: String

Radiant Media Player supports the HTML5 media preload attribute for MP4/WebM progressive download, HLS and DASH. Accepted values are 'smart', 'none', 'metadata' and 'auto'. Default: 'smart'.

  • 'none': means no media preloading happens. Media loading starts upon a valid user interaction.
  • 'metadata': means only a restricted chunk of content will be preloaded, generally to acquire information like duration, codec information and such.
  • 'auto': means media content will be preloaded as much as possible until the player buffer is full.
  • 'smart': this value lets the player decide based on device capabilities and network conditions what is the best preload configuration (between 'none', 'metadata', 'auto').

Media preloading on mobile devices

Media preloading is widely available on desktop browsers - for mobile devices however media preloading requires the following environments:

  • iOS 13.2+ Safari
  • Chrome 64+ for Android 5+
  • Samsung Internet 12+ for Android 5+

Media preloading support notes

Media preloading may not always be welcomed by an OS/device. For example on Chrome for Android media preloading is disabled by the OS when viewer is on a cellular network. Radiant Media Player enforces the following rules in order to follow best practices with media preloading:

  • When a mobile device is on cellular network and preload is set to 'smart', preload is forced to 'none'
  • When autoplay is requested preload setting is always set to 'auto'.
  • When using Apple FairPlay streaming preload setting is always set to 'auto'.
  • When using media preloading with Shaka Player (MPEG-DASH or HLS with hlsEngine setting set to 'shakaplayer') only the 'auto' and 'none' values are available. preload setting - 'metadata' value will behave like 'auto' value.

Start-up time verification

Radiant Media Player analytics API exposes a getStartUpTime method which can be used to track your average player start-up time for a given set up and content. This can be useful to best determine what preloading strategy works for you.

Player code example

<script src="https://cdn.radiantmediatechs.com/rmp/9.14.1/js/rmp.min.js"></script>
<div id="rmp"></div>
<script>
const src = {
  hls: 'https://your-hls-url.m3u8'
};
const settings = {
  licenseKey: 'your-license-key',
  src: src,
  width: 640,
  height: 360,
  // Here we enable preloading here
  preload: 'smart',
  contentMetadata: {
    poster: [
      'https://your-poster-url.jpg'
    ]
  }
};
const rmp = new RadiantMP('rmp');
rmp.init(settings);
</script>
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License.

©2015-2024 Radiant Media Player. All Rights Reserved.