Skip to main content
Version: 11.8.0

Preloading on Android

The aim of preloading is to improve the user experience by loading parts of the video before the play button is hit, when the user is likely to play the video.

Choosing to preload your video content reduces the start-up time of your videos. It also makes some data regarding the current source (video duration, timeline thumbnails, etc.) available before the user initiates playback. On the other hand, when the video is less likely to be played, or when it is less beneficial (live video, autoplay), you can configure the player to not preload it and save bandwidth.

Preloading settings

ValueDescription
noneDo not preload anything. After setting the source, the player does not load the manifest nor any media files until the play method is invoked on the player.
metadataPreload the metadata of the video. After setting the source, the player automatically loads the manifest file and waits for loading media files until the play method is invoked on the player. For static videos (e.g. MP4 files), this translates to preloading data from the start of the video in order to acquire e.g. the video's width and height and the initial video frames.
autoPreload enough data to allow for smooth initial playback. After setting the source, the player loads both the manifest files and enough media files until a sufficient playback buffer has been obtained.

Usage

In this example, we are preloading metadata only.

import com.theoplayer.android.api.player.PreloadType

theoPlayerView.player.preload = PreloadType.METADATA

Remarks

  • THEOplayer always prefers downloading data for the currently playing video over downloading data for a preloading video. Only when the currently playing video has enough data to play to the end of the video, does the player start preloading other videos.
  • When preloading the first segment(s) (preload auto), the first frame of the video is shown under the big play button, if there is no poster.

Resources