Skip to the content.



The Phoenix Media Provider allows an app to easily get Media Entries from the Kaltura Phoenix backend. The app just provides the required parameters and the provider fetches a MediaEntry object ready for use with the player.


Android (Java)

  // Create a session provider
  final SimpleSessionProvider sessionProvider = new SimpleSessionProvider(BASE_SERVER_URL, PARTNER_ID, KS);

  // Create the media provider
  final PhoenixMediaProvider phoenixMediaProvider = new PhoenixMediaProvider()
          .setAssetId(ASSET_ID) // Required

  // Load the media
  phoenixMediaProvider.load(new OnMediaLoadCompletion() {
    public void onComplete(final ResultElement<PKMediaEntry> response) {
      runOnUiThread(new Runnable() {
        public void run() {
          if (response.getResponse() != null) {
            final PKMediaConfig mediaConfig = new PKMediaConfig().setMediaEntry(response.getResponse());

iOS (Swift)

  // Create a session provider
  let sessionProvider = SimpleOVPSessionProvider(serverURL: BASE_SERVER_URL,
                                                 partnerId: PARTNER_ID,
                                                 ks: KS)

  // Create the media provider
  let phoenixMediaProvider = PhoenixMediaProvider()
      .set(assetId: ASSET_ID)
      .set(type: ASSET_TYPE)
      .set(playbackContextType: PLAYBACK_CONTEXT_TYPE)
      .set(formats: FORMAT_LIST)
      .set(fileIds: FILE_ID_LIST)
      .set(referrer: REFERRER)
      .set(sessionProvider: sessionProvider)
  // Load the media
  phoenixMediaProvider.loadMedia { (pkMediaEntry.set(refType: .media), error) in
      guard let mediaEntry = pkMediaEntry else { return }

      // Create media config
      let mediaConfig = MediaConfig(mediaEntry: mediaEntry)

      // Prepare the player

Required Arguments

Optional Arguments

Fine-grained Media Selection Arguments

Type Arguments

ASSET_TYPE and PLAYBACK_CONTEXT_TYPE depend on the requested use case.

The following are the valid argument combinations:

Linear Media Playback
VOD Media Playback/Trailer
StartOver EPG StartOver
Catchup EPG Catchup
Recording Recording Playback

To simplify application code, the provider selects the following defaults:

  1. If PLAYBACK_CONTEXT_TYPE is not selected, set it to Playback
  2. If ASSET_TYPE is not selected:
    • If PLAYBACK_CONTEXT_TYPE is Playback or Trailer, set ASSET_TYPE to Media
    • If PLAYBACK_CONTEXT_TYPE is StartOver or Catchup, set ASSET_TYPE to EPG

As a result, it’s normally enough to just specify PLAYBACK_CONTEXT_TYPE. Recording is the exception.

Note: in special situations an app may also have to set an additional field, assetReferenceType. It should only be used if instructed by Kaltura.


Error Handling

Following are some cases where client app can listen to the specific error codes and respond based on those. Here KS stands for ‘Kaltura Session’.

Case Error Code Error Message
Protected Content with Empty KS 404 Content can’t be played due to lack of sources
Requested Media file type is not present in manifest 404 no available sources for media
Concurrent play limitation 4001 Restricted due to concurrency limitation
KS Expired 601 session token has been expired
Wrong KS 500006 Missing configuration [Partner]
Unexpected Error “Unavailable” “unknown error”