Skip to main content
Skip table of contents

Offline playback

Offline playback is only available for iOS, not for tvOS. To test this feature and view the example code, please see the Apple (FPS) SDK 5 Example Code Quick Start guide.

This feature enables you to store content and licenses for future playback. Offline, or persistent storage, is achieved using two classes. The OTVPersistenceManager object provides all the persistence operations required by the application. It maintains a list of OTVPersistenceAsset assets, either downloading or where the download has completed. The app can monitor the status of the various downloaded/downloading assets by setting up listeners (observers) for download progress events and changes in the download state.

Offline playback is enabled in the following stages:

  • Offline playback of clear content

  • Offline playback of FPS encrypted content

Due to how Apple handles background downloading tasks/processes, unexpected behaviour can occur when connected to the Xcode debugger when downloading offline content. If any unexpected behaviour occurs when connected to Xcode, re-test without connection to the Xcode debugger. 

Prerequisites

Clear content

  • The application is configured to play clear content.

  • A clear stream with download enabled is available for testing.

FPS encrypted content

  • The application is configured to play FPS encrypted content.

  • An encrypted stream with a download-enabled license is available for testing. This can either be one for which you have the content identifier already or one that has the content id embedded within the EXT-X-KEY or EXT-X-SESSION-KEY tag of the HLS playlists.

Background downloading

The SDK allows HLS video downloads to run in a background thread, even if an app is suspended or terminated under certain conditions.

After an app is terminated, the SDK can recover downloads in progress in the following cases:

  • App termination due to memory pressure in the foreground.

  • App termination due to high memory usage when the app is suspended.

  • App crashes (null pointers, exceptions, etc.).

  • App termination while suspended due to limited system resources.

  • Running with Xcode (when Xcode terminates the process).

  • Termination via the App Switcher (for example, on devices with a home button, a double-home-press and slide up).

  • Termination while the app is suspended and the device reboots.

Process

The full procedure comprises the following steps:

  • Initial persistency set-up
    The application gets access to OTVPersistenceManager and sets up the listeners.

  • Retrieving the licence (FPS encrypted content only)
    The application may have to request the licence ahead of the download being triggered.

  • Start the download
    The application triggers the effective download and persistency of the media data.

  • Play the download
    The application can playback the downloaded asset in a similar manner to streamed content.

  • Renewing a licence
    The application checks the licence duration and renews it when it expires.

  • Purging the download
    The application purges the asset and licence (if applicable) when the user no longer needs it.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.