mirror of
https://github.com/samsonjs/media.git
synced 2026-04-05 11:15:46 +00:00
Remove onNetworkTypeChanged from AnalyticsListener.
It doesn't really serve a purpose and is not automatically triggered. Apps need to trigger it manually through AnalyticsCollector.notifyNetworkTypeChanged which is easy to forget. Moreover, the current network type can be obtained by Util.getNetworkType at any time when it's needed without the need for a listener. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=199790033
This commit is contained in:
parent
f02788af4b
commit
0beff72452
5 changed files with 0 additions and 41 deletions
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.analytics;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.Surface;
|
||||
import com.google.android.exoplayer2.C;
|
||||
|
|
@ -159,18 +158,6 @@ public class AnalyticsCollector
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify analytics collector that the network type or connectivity changed.
|
||||
*
|
||||
* @param networkInfo The new network info, or null if no network connection exists.
|
||||
*/
|
||||
public final void notifyNetworkTypeChanged(@Nullable NetworkInfo networkInfo) {
|
||||
EventTime eventTime = generatePlayingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onNetworkTypeChanged(eventTime, networkInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the analytics collector for a new media source. Should be called before the player is
|
||||
* prepared with a new media source.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.analytics;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.Surface;
|
||||
import com.google.android.exoplayer2.C;
|
||||
|
|
@ -313,14 +312,6 @@ public interface AnalyticsListener {
|
|||
*/
|
||||
void onViewportSizeChange(EventTime eventTime, int width, int height);
|
||||
|
||||
/**
|
||||
* Called when the type of the network connection changed.
|
||||
*
|
||||
* @param eventTime The event time.
|
||||
* @param networkInfo The network info for the current connection, or null if disconnected.
|
||||
*/
|
||||
void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo);
|
||||
|
||||
/**
|
||||
* Called when there is {@link Metadata} associated with the current playback time.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.analytics;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.Surface;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
|
|
@ -111,9 +109,6 @@ public abstract class DefaultAnalyticsListener implements AnalyticsListener {
|
|||
@Override
|
||||
public void onViewportSizeChange(EventTime eventTime, int width, int height) {}
|
||||
|
||||
@Override
|
||||
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {}
|
||||
|
||||
@Override
|
||||
public void onMetadata(EventTime eventTime, Metadata metadata) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package com.google.android.exoplayer2.util;
|
||||
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
|
@ -368,11 +367,6 @@ public class EventLogger implements AnalyticsListener {
|
|||
logd(eventTime, "viewportSizeChanged", width + ", " + height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {
|
||||
logd(eventTime, "networkTypeChanged", networkInfo == null ? "none" : networkInfo.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpstreamDiscarded(EventTime eventTime, MediaLoadData mediaLoadData) {
|
||||
logd(eventTime, "upstreamDiscarded", Format.toLogString(mediaLoadData.trackFormat));
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ public final class AnalyticsCollectorTest {
|
|||
private static final int EVENT_READING_STARTED = 19;
|
||||
private static final int EVENT_BANDWIDTH_ESTIMATE = 20;
|
||||
private static final int EVENT_VIEWPORT_SIZE_CHANGED = 21;
|
||||
private static final int EVENT_NETWORK_TYPE_CHANGED = 22;
|
||||
private static final int EVENT_METADATA = 23;
|
||||
private static final int EVENT_DECODER_ENABLED = 24;
|
||||
private static final int EVENT_DECODER_INIT = 25;
|
||||
|
|
@ -671,7 +670,6 @@ public final class AnalyticsCollectorTest {
|
|||
new PlayerRunnable() {
|
||||
@Override
|
||||
public void run(SimpleExoPlayer player) {
|
||||
player.getAnalyticsCollector().notifyNetworkTypeChanged(networkInfo);
|
||||
player
|
||||
.getAnalyticsCollector()
|
||||
.notifyViewportSizeChanged(/* width= */ 320, /* height= */ 240);
|
||||
|
|
@ -686,7 +684,6 @@ public final class AnalyticsCollectorTest {
|
|||
assertThat(listener.getEvents(EVENT_SEEK_STARTED)).containsExactly(PERIOD_0);
|
||||
assertThat(listener.getEvents(EVENT_SEEK_PROCESSED)).containsExactly(PERIOD_0);
|
||||
assertThat(listener.getEvents(EVENT_VIEWPORT_SIZE_CHANGED)).containsExactly(PERIOD_0);
|
||||
assertThat(listener.getEvents(EVENT_NETWORK_TYPE_CHANGED)).containsExactly(PERIOD_0);
|
||||
}
|
||||
|
||||
private static TestAnalyticsListener runAnalyticsTest(MediaSource mediaSource) throws Exception {
|
||||
|
|
@ -1021,11 +1018,6 @@ public final class AnalyticsCollectorTest {
|
|||
reportedEvents.add(new ReportedEvent(EVENT_VIEWPORT_SIZE_CHANGED, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetworkTypeChanged(EventTime eventTime, @Nullable NetworkInfo networkInfo) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_NETWORK_TYPE_CHANGED, eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMetadata(EventTime eventTime, Metadata metadata) {
|
||||
reportedEvents.add(new ReportedEvent(EVENT_METADATA, eventTime));
|
||||
|
|
|
|||
Loading…
Reference in a new issue