# Getting Started

The Unified Plugin can be integrated with an Android or Android TV app using the following versions of ExoPlayer:

  • 2.18.0–2.18.7
  • 2.17.x
  • 2.16.x

# Install Unified Plugin

Add the following repository to your list of repositories in build.gradle or settings.gradle:

repositories {
    ...
    maven { url "https://artifact.plugin.npaw.com/artifactory/plugins/android" }
    ...
}
1
2
3
4
5

Declare the following dependencies:

...
implementation 'com.npaw.plugin:plugin:7.1.2'
...
1
2
3

OPTIONAL

To enable CDN Balancer support for P2P connections, add the following dependency:

...
implementation 'com.npaw.plugin:plugin-p2p:7.1.2'
...
1
2
3

CDN Balancer with P2P support can also be enabled at a later stage.

# Unified Plugin Lifecycle

To collect analytics from video plays, the plugin needs access to the player Activity (i.e., the activity where the player is running). As such, we recommend initializing the Unified Plugin instance during the creation of the player Activity.

To instantiate the plugin, you need the following parameters:

  1. Reference to Player Activity
  2. Account Code on the Codavel Panel

WARNING

To avoid memory leaks, make sure to destroy() the plugin instance when destroying the player activity onDestroy().

  • Java
  • Kotlin
public class PlayerActivity extends AppCompatActivity {
    private UnifiedPlugin unifiedPlugin;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        unifiedPlugin = new UnifiedPlugin.Builder(this, "yourAccountCode")
            .build();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();

        if (unifiedPlugin != null) {
            unifiedPlugin.destroy();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Next Steps

Now that the Unified Plugin is initialised, you need to integrate it with your video player library. Check out our list of integrations here.

Updated: 7/6/2023, 3:26:38 PM