Migrating to THEOplayer Android SDK 11.x
This article will guide you through updating to THEOplayer Android SDK version 11 (from version 10), and the changes needed in your code.
Update THEOplayer
Update THEOplayer Android SDK to version 11 in your module-level build.gradle file:
dependencies {
implementation 'com.theoplayer.theoplayer-sdk-android:core:11.+'
}
If you're using the Open Video UI for Android or one of our connectors, make sure to update them to the latest version too to ensure proper support for THEOplayer version 11.
Player methods must be called from the main thread
All methods on Player and THEOplayerView must only be called from the main thread.
Calling these methods from a different thread will now throw an IllegalStateException.
These methods are now annotated with @MainThread,
which should help the Android build tools to catch potential threading issues at compile time.
Google IMA SDK integration requires core library desugaring
The Google IMA SDK integration now requires core library desugaring to be enabled.
android {
compileOptions {
coreLibraryDesugaringEnabled = true
}
}
dependencies {
implementation 'com.theoplayer.theoplayer-sdk-android:core:+'
implementation 'com.theoplayer.theoplayer-sdk-android:integration-ads-ima:+'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}
See our updated guide for Google IMA for more information.
Replace or remove usages of deprecated APIs
Some properties and methods that were previously deprecated have been removed from the API. Update your code to use the new APIs instead.
- Removed
preloadChannelsin THEOlive API. - Changed
MediaTailorAdAvail.idto return aStringinstead of anInt, to align withAdBreak.id. If you need the originalIntvalue, useAdBreak.id.toInt()instead. - Removed
TheoAdsErrorEvent, useAdErrorEventinstead. - Removed
TheoAdsEventTypes.THEOADS_ERROR, useAdsEventTypes.AD_ERRORinstead.