Skip to content

Commit

Permalink
Merge pull request #27 from petersanta/dev/nrtracker-exo-updates
Browse files Browse the repository at this point in the history
NrTrackerExoPlayer updates
  • Loading branch information
asllop authored Sep 4, 2024
2 parents 8800c7f + fc40671 commit 89def72
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.DS_Store
.externalNativeBuild
.cxx
.idea
local.properties
docs
binaries
build
4 changes: 2 additions & 2 deletions NRExoPlayerTracker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
versionCode 4
versionName "1.0.4"
versionCode 5
versionName "1.0.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.net.Uri;

import androidx.media3.common.MediaLibraryInfo;
import androidx.media3.common.MediaMetadata;
import androidx.media3.common.PlaybackException;
import androidx.media3.common.Player;
import androidx.media3.common.Tracks;
Expand Down Expand Up @@ -29,12 +31,12 @@ public class NRTrackerExoPlayer extends NRVideoTracker implements Player.Listene

protected ExoPlayer player;

private long bitrateEstimate;
private int lastHeight;
private int lastWidth;
private List<Uri> playlist;
private int lastWindow;
private String renditionChangeShift;
protected long bitrateEstimate;
protected int lastHeight;
protected int lastWidth;
protected List<Uri> playlist;
protected int lastWindow;
protected String renditionChangeShift;

/**
* Init a new ExoPlayer tracker.
Expand Down Expand Up @@ -91,25 +93,25 @@ public Map<String, Object> getAttributes(String action, Map<String, Object> attr
/**
* Get player name.
*
* @return Attribute.
* @return Player name from Media3 library.
*/
public String getPlayerName() {
return "ExoPlayer2";
return MediaLibraryInfo.TAG;
}

/**
* Get player version.
*
* @return Attribute.
* @return Player version from Media3 library.
*/
public String getPlayerVersion() {
return "2.x";
return MediaLibraryInfo.VERSION;
}

/**
* Get tracker name.
*
* @return Atribute.
* @return The simple class name of this tracker.
*/
public String getTrackerName() {
return "ExoPlayer2Tracker";
Expand Down Expand Up @@ -250,12 +252,30 @@ public Boolean getIsMuted() {
return (getPlayer().getVolume() == 0);
}


/**
* Get the title from the currently played media
*
* @return String of the current title
*/
public String getTitle() {
String contentTitle = "Unknown";
if (player != null && player.getCurrentMediaItem() != null && player.getCurrentMediaItem().mediaMetadata.title != null) {
MediaMetadata mm = player.getCurrentMediaItem().mediaMetadata;
contentTitle = mm.title.toString();
if (mm.subtitle != null) {
contentTitle += ": " + mm.subtitle; // Usually the episode title is available in subtitle
}
}
return contentTitle;
}

/**
* Get player instance.
*
* @return Attribute.
*/
private ExoPlayer getPlayer() {
public ExoPlayer getPlayer() {
return player;
}

Expand Down
4 changes: 2 additions & 2 deletions NRIMATracker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
versionCode 4
versionName "1.0.4"
versionCode 5
versionName "1.0.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down
4 changes: 2 additions & 2 deletions NewRelicVideoCore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
versionCode 7
versionName "1.0.4"
versionCode 8
versionName "1.0.5"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand Down

0 comments on commit 89def72

Please sign in to comment.