# Upgrade Guides

## Changes in 4.2.4

Note

The OMA plugin has been deprecated and is no longer supported in the SDK as of this release.

This release adds support for 64bit native code to all plugins. That means you no longer need to split APKs when you are using 64bit native libraries.

## Changes in 4.2

The transition from version 4.1 to version 4.2 of the PRESTOplay SDK for Android involves some breaking API changes. We will highlight the changes here and describe the required changes that you might need to apply in your Application to upgrade to version 4.2.

### StreamingEventListener

The `StreamingEventListener` was used in version 4.1 to receive events about downloads triggered by the player library. In order to provide more information on these callbacks, we decided to change the method signatures slightly. Please check the API documentation for the `StreamingEventListener` interface and update your implementations accordingly. All information is still present, but we are exposing the underlying DataSpec as well, which allows you, for instance, to access the target URI of a given request.

Besides the changed order and the new parameter, the only parameter that was removed from the signature was the length. Please use the dataSpec.length property instead.

### AbstractStreamEventListener

The `AbstractStreamEventListener` is removed and `AbstractStreamingEventListener` shall be used instead.

### Downloader

#### Header and query parameters

The `DownloadServiceBinder.getDataSourceFactory()` is no longer public and when providing the downloader with the additional header and query parameters, the `SdkConsts.INTENT_HEADER_PARAMS_BUNDLE` and `SdkConsts.INTENT_QUERY_PARAMS_BUNDLE` shall be used as keys in the `Bundle` passed to `DownloadServiceBinder.prepareDownload(android.content.Context, android.os.Bundle, com.castlabs.sdk.downloader.Downloader$ModelReadyCallback)`.

#### Download size

The `Download#getTotalSize()` is replaced with `Download.getEstimatedSize()`

### DRM

The `Builder.Builder(java.lang.String, java.lang.String, java.lang.String, java.lang.String)` should now be created with explicitly set `assetId`.

### KeyStore

The `KeyStore` interface got promoted to an abstract class in 4.2. This is because some functionality was required to be implemented at this level, and shared across all KeyStore implementations.

The main motivation for this change was to perform serialization of the stored data before and after storing and reading the data.

In order to make transition easier we renamed the old interface methods, and expect the same behaviour from them. These correspond to the *internal named methods.

In addition new methods have been added; getAll, delete, deleteAll and getCount.

### KeyStore in PlayerController

The setKeyStore method in the `PlayerController` has been removed. The static DEFAULT_KEY_STORE field in the `PlayerSDK` class should be used from now on.

### Ads & IMA plugin

The IMA plugin is now based on the Exo Player’s ads interfaces and IMA extension. The change brings mainly performance benefits as all the ads are now played using the same `PlayerView` and Exo Player’s instance. The following client-facing ads interfaces have being updated as well:

> - `AdSessionProvider` is renamed to `AdProvider` and defines interface to create `AdLoader`. The implementation of this interface can be used for custom-based ads provider implementations.

> - `AdController` is removed and its APIs became part of `AdInterface` and `AdClientInterface` accessible via `PlayerController`

> - `SdkConsts.INTENT_WAIT_FOR_ADS_TO_LOAD` was removed

### SubtitlesViewComponent

The `SubtitlesViewComponent` `getView()` is deprecated and `componentView()` should be used instead.

### StreamingEventListener

#### Format

The `onVideoFormatChange()` and `onAudioFormatChange()` methods have been moved out of the `StreamingEventListener` interface to the new `FormatChangeListener` interface.

If you were using any of those methods, you should implement `FormatChangeListener`. Then you can add and remove the listener to the `PlayerController` with the `addFormatChangeListener()` and `removeFormatChangeListener()` methods respectively.

#### onLoadError

This new method will receive load error events. Note that retries will also be notified through this callback. Fatal load errors will still by reported by the `PlayerListener`, but now it won’t receive Warning retry calls anymore.

#### Retries

Now all the methods in the `StreamingEventListener` contain two extra params: currentAttempt and maxAttempts. You can use these params for instance in the error callback to check for a fatal error, or to know how many retries were required for successful loading.

### Image loader

The following methods are deprecated:

  - Use `LazyImageLoader.loadImage(java.lang.String, android.widget.ImageView, int)` instead of `LazyImageLoader#displayImage`

  - Use `LazyImageLoader.shutdown()` instead of `LazyImageLoader#stopThread`

### Playback configuration

The following playback configuration options are deprecated:

  - Initial video quality and keep flag: use `SdkConsts.INTENT_ABR_CONFIGURATION` instead of `SdkConsts#INTENT_INITIAL_VIDEO_QUALITY` and `SdkConsts#INTENT_INITIAL_VIDEO_QUALITY_KEEP`

  - `SdkConsts#INTENT_PROGRESSIVE_DOWNLOAD_ID` was removed

  - Language preferences: use `SdkConsts.INTENT_PREFERRED_AUDIO_LANGUAGE` and `SdkConsts.INTENT_PREFERRED_TEXT_LANGUAGE` instead of `SdkConsts#INTENT_PREFERRED_LANGUAGE`

  - Live edge latency: use `SdkConsts.INTENT_LIVE_CONFIGURATION` instead of `SdkConsts#INTENT_LIVE_EDGE_LATENCY_MS` and `PlayerController.setLiveConfiguration(com.castlabs.android.player.LiveConfiguration)` instead of `PlayerController.setLiveEdgeLatency()`