Android SDK 5 Example Code Quick Start
This guide enables you to demonstrate the CONNECT Player features and view the example code.
- To demonstrate the CONNECT Player PRM features and view the example code, see PRM Example Code Quick Start.
- To demonstrate the CONNECT Player features and view the Kotlin version of the example code, see Kotlin Example Code Quick Start.
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-code.zip
This package contains the application projects which demonstrate how to use the player features. - opy-sdk-android-5.16.x-sdk-integration.aar
The SDK binary file used for integration purposes. - 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 opy-sdk-android-5.16.x-example-code.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 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 - Demonstrates playback of a clear stream with no additional functionality.
- bookmarks - Shows how to capture bookmark details when stopping playback and how to restore them when resuming.
- controlbar - Shows how to create a bespoke control bar in the application to control the player.
- multi-instance - Provides multiple instances of the player.
- lowlatency - Playback of a low-latency DASH stream, including configuration of low-latency parameters.
- output-control - Playback of clear streams with output control.
- resolution-capping - Playback of clear streams with resolution capping.
- thumbnails - Playback of clear streams with DASH-IF thumbnail previews.
- harmonicthumbnails - Playback of clear streams with Harmonic WebVTT thumbnail previews.
- track-selection - Playback of clear streams with multi-audio.
Offline playback
- offline - Offline playback of clear and encrypted content.
- offline-service - Offline playback with downloading as a service.
Encrypted playback
- encrypted-playback - Playback of Widevine encrypted content.
- customised-encrypted-playback - Demonstrates a non-default implementation of Widevine.
- encrypted-playback-playready - Playback of PlayReady encrypted content.
- single-ssm-workflow - Shows how to create a customised OTVCustomerSSMCallback to work with your own Secure Session Management (SSM) server.
Content security
- watermark-pull-mode - Demonstrates QuickMark forensic watermarking in pull mode.
- watermark-push-mode - Demonstrates QuickMark forensic watermarking in push mode.
Advertising
- dynamic-ads-ima - Playback of clear streams with Google IMA adverts.
- server-side-ad-insertion - Demonstrates use of adverts within streams with Server-Side Ad Insertion.
- yospace - Demonstrates the integration of the Yospace user interface handling of streams with Server-Side Ad Insertion.
Statistics and analytics
- event-timeline - Playback of clear streams with feedback and analysis of performance tracking or playback issues.
- insight - Sends playback metrics and statistics to an Insight analytics server.
- error-reporting - Demonstrates error handling in the example code; see also Android SDK 5 Error Codes.
Hardware support
- chromecast - Playback of clear streams with support for Chromecast
- connect-dash - Playback of CONNECT-encrypted DASH streams with NAGRA CONNECT.
- connect-prm - Playback of CONNECT-encrypted HLS streams with NAGRA CONNECT.
- smartbeam - Shows how an application can playback streams in conjunction with Broadpeak SmartBeam set-top box.
For full details on integrating the SDK with your application, see the Android SDK 5 Integration Guide. See also the API reference guide provided in the Android SDK pack.