The New Relic Video Agent for Android contains multiple modules necessary to instrument video players and send data to New Relic.
There are three modules available:
Contains all the base classes necessary to create trackers and send data to New Relic. It depends on the New Relic Agent.
The video tracker for ExoPlayer2 player. It depends on NewRelicVideoCore.
The video tracker for Google IMA Ads library. It depends on NewRelicVideoCore.
Install the New Relic Android Agent, and any other needed dependency, like ExoPlayer or Google IMA.
Add the following line inside your root build.gradle:
allprojects {
repositories {
...
// Add this line at the end of your repositories
maven { url 'https://jitpack.io' }
}
}
And inside your app's build.gradle, add the following dependencies:
dependencies {
...
// Add this to install the NewRelicVideoCore (required)
implementation 'com.github.newrelic.video-agent-android:NewRelicVideoCore:master-SNAPSHOT'
// Add this to install the ExoPlayer tracker
implementation 'com.github.newrelic.video-agent-android:NRExoPlayerTracker:master-SNAPSHOT'
// Add this to install the Google IMA library tracker
implementation 'com.github.newrelic.video-agent-android:NRIMATracker:master-SNAPSHOT'
}
To install an specific version, replace the master-SNAPSHOT
by a version tag.
- Clone this repo.
- Open it with Android Studio.
- Click on View > Tool Windows > Gradle to open the gradle tool window.
- In there, unfold NRVideoProject > Tasks > build and double-click on assemble. This will generate the AAR libraries inside the module's folder build > outputs > aar.
- In your project, click on File > New > New Module, Import .JAR/.AAR Package and then Next.
- Enter the location of the generated AAR file then click Finish.
- Repeat steps 5 and 6 with all the AAR files you want to include.
- In you app module's build.gradle file, add the following:
dependencies {
...
implementation project(":NewRelicVideoCore")
implementation project(":NRExoPlayerTracker")
implementation project(':NRIMATracker')
}
- Clone this repo.
- In your project, click File > New > Import Module.
- Enter the location of the library module directory (located in the repo you just cloned) then click Finish.
- Repeat steps 2 and 3 with all the modules you want to include.
- In you app module's build.gradle file, add the following:
dependencies {
...
implementation project(":NewRelicVideoCore")
implementation project(":NRExoPlayerTracker")
implementation project(':NRIMATracker')
}
To start the video agent with ExoPlayer tracker only:
Java
Integer trackerId = NewRelicVideoAgent.getInstance().start(new NRTrackerExoPlayer(player));
Kotlin
val trackerId = NewRelicVideoAgent.getInstance().start(NRTrackerExoPlayer(player))
To start the video agent with ExoPlayer and IMA trackers:
Java
Integer trackerId = NewRelicVideoAgent.getInstance().start(new NRTrackerExoPlayer(player), new NRTrackerIMA());
Kotlin
val trackerId = NewRelicVideoAgent.getInstance().start(NRTrackerExoPlayer(player), NRTrackerIMA())
To generate the javadocs, open the project in Android Studio and then go to Tools > Generate JavaDoc...
, select Whole Project
, then select the Output directory
and click OK
.
For more detail on the Events and Data Model generated by Video Agent for Android and for advanced concepts such as creating custom trackers, reference the Advanced Topics manual.
The app
folder contains a usage example that shows the basics of video tracking using ExoPlayer.
The Test
folder contains the test apps.
New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub.
We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.
We encourage your contributions to improve New Relic Video Agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at [email protected].
A note about vulnerabilities
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.
New Relic Video Agent is licensed under the Apache 2.0 License.