Skip to content

Commit fe3e16d

Browse files
authored
Merge pull request #37 from newrelic/stable
Change video event type from MobileVideo -> VideoAction
2 parents c3e029a + 10ebcaf commit fe3e16d

File tree

15 files changed

+483
-98
lines changed

15 files changed

+483
-98
lines changed

DATAMODEL.md

Lines changed: 225 additions & 0 deletions
Large diffs are not rendered by default.

NRExoPlayerTracker/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ android {
1010
minSdkVersion 16
1111
targetSdkVersion 33
1212
versionCode 6
13-
versionName "1.0.6"
14-
13+
versionName "3.0.0"
1514
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1615
consumerProguardFiles "consumer-rules.pro"
1716
}
@@ -59,4 +58,5 @@ afterEvaluate {
5958
}
6059
}
6160
}
61+
6262
}

NRExoPlayerTracker/src/main/java/com/newrelic/videoagent/exoplayer/tracker/NRTrackerExoPlayer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.newrelic.videoagent.core.tracker.NRVideoTracker;
1717
import com.newrelic.videoagent.core.utils.NRLog;
1818
import com.newrelic.videoagent.exoplayer.BuildConfig;
19+
import static com.newrelic.videoagent.core.NRDef.*;
1920

2021
import java.io.IOException;
2122
import java.util.HashMap;
@@ -126,6 +127,15 @@ public String getTrackerVersion() {
126127
return BuildConfig.VERSION_NAME;
127128
}
128129

130+
/**
131+
* Get tracker src.
132+
*
133+
* @return Attribute.
134+
*/
135+
public String getTrackerSrc() {
136+
return SRC;
137+
}
138+
129139
/**
130140
* Get bitrate.
131141
*
@@ -354,11 +364,12 @@ public void sendDroppedFrame(int count, int elapsed) {
354364
Map<String, Object> attr = new HashMap<>();
355365
attr.put("lostFrames", count);
356366
attr.put("lostFramesDuration", elapsed);
367+
// generatePlayElapsedTime();
357368
if (getState().isAd) {
358-
sendEvent("AD_DROPPED_FRAMES", attr);
369+
sendVideoAdEvent("AD_DROPPED_FRAMES", attr);
359370
}
360371
else {
361-
sendEvent("CONTENT_DROPPED_FRAMES", attr);
372+
sendVideoEvent("CONTENT_DROPPED_FRAMES", attr);
362373
}
363374
}
364375

NRIMATracker/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ android {
1010
minSdkVersion 16
1111
targetSdkVersion 33
1212
versionCode 6
13-
versionName "1.0.6"
14-
13+
versionName "3.0.0"
1514
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1615
consumerProguardFiles "consumer-rules.pro"
1716
}

NRIMATracker/src/main/java/com/newrelic/videoagent/ima/tracker/NRTrackerIMA.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.newrelic.videoagent.core.tracker.NRVideoTracker;
77
import com.newrelic.videoagent.core.utils.NRLog;
88
import com.newrelic.videoagent.ima.BuildConfig;
9+
import static com.newrelic.videoagent.core.NRDef.*;
910

1011
public class NRTrackerIMA extends NRVideoTracker implements AdErrorEvent.AdErrorListener, AdEvent.AdEventListener {
1112

@@ -126,6 +127,15 @@ public String getTrackerVersion() {
126127
return BuildConfig.VERSION_NAME;
127128
}
128129

130+
/**
131+
* Get tracker src.
132+
*
133+
* @return Attribute.
134+
*/
135+
public String getTrackerSrc() {
136+
return SRC;
137+
}
138+
129139
/**
130140
* Get Ad Position.
131141
*

NewRelicVideoCore/build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ plugins {
22
id 'com.android.library'
33
id 'maven-publish'
44
}
5-
65
android {
76
compileSdkVersion 33
8-
97
defaultConfig {
108
minSdkVersion 16
119
targetSdkVersion 33
1210
versionCode 9
13-
versionName "1.0.6"
11+
versionName "3.0.0"
1412

1513
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1614
consumerProguardFiles "consumer-rules.pro"
@@ -38,15 +36,13 @@ android {
3836
}
3937

4038
dependencies {
41-
4239
implementation 'androidx.appcompat:appcompat:1.1.0'
4340
implementation 'com.google.android.material:material:1.1.0'
4441
implementation 'com.newrelic.agent.android:android-agent:7.0.0'
4542
testImplementation 'junit:junit:4.+'
4643
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
4744
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
4845
}
49-
5046
afterEvaluate {
5147
publishing {
5248
publications {

NewRelicVideoCore/src/main/java/com/newrelic/videoagent/core/NRDef.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ private NRDef() {
88

99
public static final String NRVIDEO_CORE_VERSION = VERSION_NAME;
1010

11-
public static final String NR_VIDEO_EVENT = "MobileVideo";
11+
public static final String NR_VIDEO_EVENT = "VideoAction";
12+
public static final String NR_VIDEO_AD_EVENT = "VideoAdAction";
13+
public static final String NR_VIDEO_ERROR_EVENT = "VideoErrorAction";
14+
public static final String NR_VIDEO_CUSTOM_EVENT = "VideoCustomAction";
15+
16+
public static final String SRC = "ANDROID";
1217

1318
public static final String TRACKER_READY = "TRACKER_READY";
1419
public static final String PLAYER_READY = "PLAYER_READY";
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.newrelic.videoagent.core.model;
2+
3+
public class NRChrono {
4+
5+
private long startTime;
6+
7+
// Constructor
8+
public NRChrono() {
9+
startTime = 0;
10+
}
11+
12+
// Start the timer
13+
public void start() {
14+
startTime = System.currentTimeMillis();
15+
}
16+
17+
// Get the delta time in milliseconds
18+
public long getDeltaTime() {
19+
if (startTime > 0) {
20+
return System.currentTimeMillis() - startTime;
21+
} else {
22+
return 0;
23+
}
24+
}
25+
}

NewRelicVideoCore/src/main/java/com/newrelic/videoagent/core/model/NREventAttributes.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
public class NREventAttributes {
1111

1212
private Map<String, Map<String, Object>> attributeBuckets;
13+
private String userId;
1314

1415
/**
1516
* Ïnit a new event attributes model.
@@ -39,6 +40,16 @@ public void setAttribute(String key, Object value, String filter) {
3940
attributeBuckets.get(filter).put(key, value);
4041
}
4142

43+
/**
44+
* Set userId.
45+
*
46+
* @param userId User Id.
47+
*/
48+
public void setUserId(String userId) {
49+
this.userId = userId;
50+
setAttribute("enduser.id", userId, null);
51+
}
52+
4253
/**
4354
* Generate list of attributes for a given action.
4455
*

NewRelicVideoCore/src/main/java/com/newrelic/videoagent/core/model/NRTimeSinceTable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void applyAttributes(String action, Map<String, Object> attributes) {
5050
attributes.put(ts.getAttribute(), ts.timeSince());
5151
}
5252
if (ts.isAction(action)) {
53+
// attributes.put("elapsedTime", ts.timeSince());
5354
ts.now();
5455
}
5556
}

0 commit comments

Comments
 (0)