mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove ad events from analytics listener and collector.
Ad load errors will be forwarded as media source load errors in the future and other ad events are not actually player related to warrant reporting them as part of playback analytics. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194936656
This commit is contained in:
parent
175a0100d0
commit
ddeafa4fef
@ -21,7 +21,6 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -134,7 +133,6 @@ public class PlayerActivity extends Activity
|
||||
DEFAULT_COOKIE_MANAGER.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
|
||||
}
|
||||
|
||||
private Handler mainHandler;
|
||||
private PlayerView playerView;
|
||||
private LinearLayout debugRootView;
|
||||
private TextView debugTextView;
|
||||
@ -164,7 +162,6 @@ public class PlayerActivity extends Activity
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mediaDataSourceFactory = buildDataSourceFactory(true);
|
||||
mainHandler = new Handler();
|
||||
if (CookieHandler.getDefault() != DEFAULT_COOKIE_MANAGER) {
|
||||
CookieHandler.setDefault(DEFAULT_COOKIE_MANAGER);
|
||||
}
|
||||
@ -594,8 +591,8 @@ public class PlayerActivity extends Activity
|
||||
adMediaSourceFactory,
|
||||
adsLoader,
|
||||
adUiViewGroup,
|
||||
mainHandler,
|
||||
player.getAnalyticsCollector());
|
||||
/* eventHandler= */ null,
|
||||
/* eventListener= */ null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
// IMA extension not loaded.
|
||||
return null;
|
||||
|
@ -35,7 +35,6 @@ import com.google.android.exoplayer2.metadata.MetadataOutput;
|
||||
import com.google.android.exoplayer2.source.MediaSource.MediaPeriodId;
|
||||
import com.google.android.exoplayer2.source.MediaSourceEventListener;
|
||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||
import com.google.android.exoplayer2.source.ads.AdsMediaSource;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
@ -59,7 +58,6 @@ public class AnalyticsCollector
|
||||
VideoRendererEventListener,
|
||||
MediaSourceEventListener,
|
||||
BandwidthMeter.EventListener,
|
||||
AdsMediaSource.EventListener,
|
||||
DefaultDrmSessionEventListener {
|
||||
|
||||
/** Factory for an analytics collector. */
|
||||
@ -534,40 +532,6 @@ public class AnalyticsCollector
|
||||
}
|
||||
}
|
||||
|
||||
// AdsMediaSource.EventListener implementation.
|
||||
|
||||
@Override
|
||||
public final void onAdLoadError(IOException error) {
|
||||
EventTime eventTime = generatePlayingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onAdLoadError(eventTime, error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onInternalAdLoadError(RuntimeException error) {
|
||||
EventTime eventTime = generatePlayingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onInternalAdLoadError(eventTime, error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onAdClicked() {
|
||||
EventTime eventTime = generatePlayingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onAdClicked(eventTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onAdTapped() {
|
||||
EventTime eventTime = generatePlayingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onAdTapped(eventTime);
|
||||
}
|
||||
}
|
||||
|
||||
// Internal methods.
|
||||
|
||||
/** Returns read-only set of registered listeners. */
|
||||
|
@ -433,38 +433,6 @@ public interface AnalyticsListener {
|
||||
*/
|
||||
void onRenderedFirstFrame(EventTime eventTime, Surface surface);
|
||||
|
||||
/**
|
||||
* Called if there was an error loading one or more ads. The ads loader will skip the problematic
|
||||
* ad(s).
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
* @param error The error.
|
||||
*/
|
||||
void onAdLoadError(EventTime eventTime, IOException error);
|
||||
|
||||
/**
|
||||
* Called when an unexpected internal error is encountered while loading ads. The ads loader will
|
||||
* skip all remaining ads, as the error is not recoverable.
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
* @param error The error.
|
||||
*/
|
||||
void onInternalAdLoadError(EventTime eventTime, RuntimeException error);
|
||||
|
||||
/**
|
||||
* Called when the user clicks through an ad (for example, following a 'learn more' link).
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
*/
|
||||
void onAdClicked(EventTime eventTime);
|
||||
|
||||
/**
|
||||
* Called when the user taps a non-clickthrough part of an ad.
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
*/
|
||||
void onAdTapped(EventTime eventTime);
|
||||
|
||||
/**
|
||||
* Called each time drm keys are loaded.
|
||||
*
|
||||
|
@ -152,18 +152,6 @@ public abstract class DefaultAnalyticsListener implements AnalyticsListener {
|
||||
@Override
|
||||
public void onRenderedFirstFrame(EventTime eventTime, Surface surface) {}
|
||||
|
||||
@Override
|
||||
public void onAdLoadError(EventTime eventTime, IOException error) {}
|
||||
|
||||
@Override
|
||||
public void onInternalAdLoadError(EventTime eventTime, RuntimeException error) {}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(EventTime eventTime) {}
|
||||
|
||||
@Override
|
||||
public void onAdTapped(EventTime eventTime) {}
|
||||
|
||||
@Override
|
||||
public void onDrmKeysLoaded(EventTime eventTime) {}
|
||||
|
||||
|
@ -403,26 +403,6 @@ public class EventLogger implements AnalyticsListener {
|
||||
logd(eventTime, "drmKeysLoaded");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadError(EventTime eventTime, IOException error) {
|
||||
printInternalError(eventTime, "adLoadError", error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInternalAdLoadError(EventTime eventTime, RuntimeException error) {
|
||||
printInternalError(eventTime, "internalAdLoadError", error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(EventTime eventTime) {
|
||||
logd(eventTime, "adClicked");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdTapped(EventTime eventTime) {
|
||||
logd(eventTime, "adTapped");
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a debug message.
|
||||
*
|
||||
|
@ -105,14 +105,10 @@ public final class AnalyticsCollectorTest {
|
||||
private static final int EVENT_DROPPED_VIDEO_FRAMES = 30;
|
||||
private static final int EVENT_VIDEO_SIZE_CHANGED = 31;
|
||||
private static final int EVENT_RENDERED_FIRST_FRAME = 32;
|
||||
private static final int EVENT_AD_LOAD_ERROR = 33;
|
||||
private static final int EVENT_INTERNAL_AD_LOAD_ERROR = 34;
|
||||
private static final int EVENT_AD_CLICKED = 35;
|
||||
private static final int EVENT_AD_TAPPED = 36;
|
||||
private static final int EVENT_DRM_KEYS_LOADED = 37;
|
||||
private static final int EVENT_DRM_ERROR = 38;
|
||||
private static final int EVENT_DRM_KEYS_RESTORED = 39;
|
||||
private static final int EVENT_DRM_KEYS_REMOVED = 40;
|
||||
private static final int EVENT_DRM_KEYS_LOADED = 33;
|
||||
private static final int EVENT_DRM_ERROR = 34;
|
||||
private static final int EVENT_DRM_KEYS_RESTORED = 35;
|
||||
private static final int EVENT_DRM_KEYS_REMOVED = 36;
|
||||
|
||||
private static final int TIMEOUT_MS = 10000;
|
||||
private static final Timeline SINGLE_PERIOD_TIMELINE = new FakeTimeline(/* windowCount= */ 1);
|
||||
@ -1089,26 +1085,6 @@ public final class AnalyticsCollectorTest {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_RENDERED_FIRST_FRAME, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadError(EventTime eventTime, IOException error) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_AD_LOAD_ERROR, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInternalAdLoadError(EventTime eventTime, RuntimeException error) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_INTERNAL_AD_LOAD_ERROR, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(EventTime eventTime) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_AD_CLICKED, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdTapped(EventTime eventTime) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_AD_TAPPED, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrmKeysLoaded(EventTime eventTime) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_DRM_KEYS_LOADED, eventTime));
|
||||
|
Loading…
x
Reference in New Issue
Block a user