Skip to main content

Precache

PrecachePreloading

The precache feature allows an application to prepare a session for playback at a later time. Once the application intends to use a fully precached session, the workflow for creating the session and fetching the manifest has already been completed. At this moment, the player only needs to start downloading chunks and initiate the playback. Implementing this approach results in a reduction in startup times.

1. Check your player compatibility

If you are implementing SmartLib with a player integration (Analytics integration, Analytics only integration and Ad insertion integration), refer to With player integration (official player) or With player integration (generic player).

For other cases, refer to Without player integration.

With player integration (official player)

Depending on the support of a "precache ended" event and the status of our integration on our end, an additional step may be necessary:

  • If both the player and the platform are supported, step 3 is not required
  • If either the player or the platform is not supported, step 3 is required
Name
Platforms
Status
castLabs PRESTOplay
Android, iOS, tvOS, Web
Supported
VOPlayer
Android, iOS
Supported
ExoPlayer
Android
In development
AVPlayer
iOS, tvOS
In development
Shaka Player
Web
In development
Other players
Ask Broadpeak

With player integration (generic player)

In case of a Generic player integration, an additional method needs to be invoked once the player starts buffering the content and initiate the playback (when the application intends to use the precached session).

// Notify the lib that the application intends to use the precached session
mYourPlayerApi.notifyPrecacheEnded();
info

In that case, step 3 is not required.

Without player integration

As there is no player to initiate the event, the application itself has to trigger it. In that case, step 3 is required.

2. Configure the streaming session

To enable the precache, set the SESSION_PRECACHE option to true. It has to be done before starting the session (i.e calling getURL).

// Create a new streaming session object (1 per video session) and store it
StreamingSession session = SmartLib.getInstance().createStreamingSession();

// Set the precache option to true
session.setOption(StreamingSessionOptions.SESSION_PRECACHE, true);

3. Notify about precache ended

caution

This step is necessary only if your player is not currently supported or is incompatible with the precache feature.

Once the application intends to use a precached session, call this method and resume the player buffering.

// Notify the lib that the application intends to use the precached session
session.precacheEnded();