What are the options for the mediaelement player's "preload" setting?

David picture David · Mar 11, 2011 · Viewed 8.3k times · Source

The only setting I've come across for "preload" is "none" - what are the alternetives?

I have a long-ish movie that takes a while to start (because of the size, I assume) and I'd like to be able to get it to play more quickly. I reckon that making the video start loading immediately the page loads would give the viewer a quicker response...

Answer

rwc9u picture rwc9u · Dec 13, 2013

The preload attribute is part of the HTML 5 spec. Steve Souders blog post discusses the allowable values and explains how each browser handles the attribute.

  • no preload attribute - Preload is not specified.
  • preload='none' - From the spec, “Hints to the UA that the user is not expected to need the video, or that minimizing unnecessary traffic is desirable.”
  • preload='metadata' - “Hints to the UA that the user is not expected to need the video, but that fetching its metadata (dimensions, first frame, track list, duration, and so on) is desirable.”
  • preload='auto' -“Hints to the UA that optimistically downloading the entire video is considered desirable.”
  • preload or preload='' - The preload attribute is specified but no value is given. Specifying the empty string is the same as specifying “auto”.

With regard to the mediaelement player, it's going to depend on whether you are using the default or fallback player. However, in order to preload some amount of your video with the default player, you don't want the value set to 'none'.