Kotlin Example Code Quick Start
This guide enables you to demonstrate CONNECT Player features and view the Kotlin version of the example code.
Prerequisites
Make sure you have the latest Android Studio installed, including:
Android SDK - install the latest version from Android Studio when prompted.
Gradle - use the latest version as recommended by Android Studio.
JDK - use the version provided with Android Studio.
Download the Android SDK pack, which supplies all the files needed to launch the player and start streaming content.
- opy-sdk-android-5.16.x-example-kotlin.zip
This package demonstrates how to implement the same features in the Kotlin language. - opy-sdk-android-5.16.x-sdk-integration.aar
The SDK binary file used for integration purposes. - opy-sdk-android-5.16.x-sdk-prm-integration.aar
The PRM version of the SDK binary file used for integration purposes.
You will also need the PRM Operator Vault file opvault.json. - A device running Android 5.x (Lollipop) onwards with debugging enabled; the player cannot run on an Android Studio simulator.
Procedure
Save the SDK pack to your desktop and unzip it. The package contains a zipped set of example code; extract the contents of the example-code-kotlin.zip file to your desktop.
- Start Android Studio, select Open an existing Android Studio project and select the required project in the top-level directory of the extracted package; see the example projects below.
Copy the opy-sdk-android-5.16.x-sdk-integration.aar or opy-sdk-android-5.16.x-sdk-prm-integration.aar (for the PRM features) file to the common/libs/ directory.
Additional libraries may be required for some example projects; check the relevant README files for details.
- Connect an Android device to your development machine via USB, and build and run the application.
Example projects
Playback
- basic-playback-kt - Demonstrates playback of a clear stream with no additional functionality.
- resolution-capping-kt - Playback of clear streams with resolution capping.
- track-selection-kt - Playback of clear streams with multi-audio.
Offline playback
- offline-kt - Offline playback of Widevine encrypted content.
- offline-hls-kt - Offline playback of HLS streams.
- offline-service-kt - Downloading as a service for DASH streams.
- offline-service-prm-kt - Downloading as a service for DASH and HLS streams.
Encrypted playback
- encrypted-playback-kt - Playback of Widevine encrypted content.
- customised-encrypted-playback-kt - Demonstrates a non-default implementation of Widevine.
- prm-kt - Playback of PRM encrypted content (Software PRM).