Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Stack trace #53

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- Support for reporting the stack trace in case of error events, if provided by the player

## 2.7.2 - 2024-10-28

### Added
Expand Down
2 changes: 1 addition & 1 deletion ConvivaExampleApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
implementation project(':conviva')

//implementation 'com.bitmovin.analytics:conviva:2.1.1'
//api 'com.conviva.sdk:conviva-core-sdk:4.0.20'
implementation 'com.conviva.sdk:conviva-core-sdk:4.0.33'

implementation "com.google.ads.interactivemedia.v3:interactivemedia:$googleImaSdk" // only needed if ads are used:
implementation "com.google.android.gms:play-services-ads-identifier:$googlePlayAdsIdentifier" // only needed if ads are used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.bitmovin.player.api.advertising.AdSourceType;
import com.bitmovin.player.api.advertising.vast.AdSystem;
import com.bitmovin.player.api.advertising.vast.VastAdData;
import com.bitmovin.player.api.deficiency.ErrorEvent;
import com.bitmovin.player.api.event.Event;
import com.bitmovin.player.api.event.EventListener;
import com.bitmovin.player.api.event.PlayerEvent;
Expand Down Expand Up @@ -366,7 +367,15 @@ private void ensureConvivaSessionIsCreatedAndInitialized() {
}

private void customEvent(Event event) {
customEvent(event, new HashMap<>());
Map<String, Object> eventAttributes = new HashMap<>();
if (event instanceof PlayerEvent.Error || event instanceof SourceEvent.Error) {
ErrorEvent errorEvent = ((ErrorEvent) event);
if (errorEvent.getData() != null) {
// Report stack trace to Conviva
eventAttributes.put("stack trace", errorEvent.getData().toString());
}
}
customEvent(event, eventAttributes);
}

private void customEvent(Event event, Map<String, Object> attributes) {
Expand Down Expand Up @@ -568,16 +577,15 @@ private synchronized void transitionState(ConvivaSdkConstants.PlayerState state)
}, 100);
};

private final EventListener<PlayerEvent.Error> onPlayerErrorListener = new EventListener<PlayerEvent.Error>() {
@Override
public void onEvent(PlayerEvent.Error event) {
Log.d(TAG, "[Player Event] Error");
handleError(String.format("%s - %s", event.getCode(), event.getMessage()));
}
private final EventListener<PlayerEvent.Error> onPlayerErrorListener = event -> {
Log.d(TAG, "[Player Event] Error");
customEvent(event); // In case of Error, report current stack trace if available
handleError(String.format("%s - %s", event.getCode(), event.getMessage()));
};

private final EventListener<SourceEvent.Error> onSourceErrorListener = event -> {
Log.d(TAG, "[Source Event] Error");
customEvent(event); // In case of Error, report current stack trace if available
handleError(String.format("%s - %s", event.getCode(), event.getMessage()));
};

Expand Down
Loading