mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Rollback of caf62842c4
*** Original commit *** Rollback ofc2cb22a056*** Original commit *** Rollback of1521e50307*** Original commit *** Wire up MediaMetricsListener and add configuration to... *** PiperOrigin-RevId: 429585773
This commit is contained in:
parent
4b72335d51
commit
99d2b11329
2 changed files with 4 additions and 42 deletions
|
|
@ -467,7 +467,6 @@ public interface ExoPlayer extends Player {
|
||||||
/* package */ long releaseTimeoutMs;
|
/* package */ long releaseTimeoutMs;
|
||||||
/* package */ long detachSurfaceTimeoutMs;
|
/* package */ long detachSurfaceTimeoutMs;
|
||||||
/* package */ boolean pauseAtEndOfMediaItems;
|
/* package */ boolean pauseAtEndOfMediaItems;
|
||||||
/* package */ boolean usePlatformDiagnostics;
|
|
||||||
/* package */ boolean buildCalled;
|
/* package */ boolean buildCalled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -508,7 +507,6 @@ public interface ExoPlayer extends Player {
|
||||||
* <li>{@code releaseTimeoutMs}: {@link #DEFAULT_RELEASE_TIMEOUT_MS}
|
* <li>{@code releaseTimeoutMs}: {@link #DEFAULT_RELEASE_TIMEOUT_MS}
|
||||||
* <li>{@code detachSurfaceTimeoutMs}: {@link #DEFAULT_DETACH_SURFACE_TIMEOUT_MS}
|
* <li>{@code detachSurfaceTimeoutMs}: {@link #DEFAULT_DETACH_SURFACE_TIMEOUT_MS}
|
||||||
* <li>{@code pauseAtEndOfMediaItems}: {@code false}
|
* <li>{@code pauseAtEndOfMediaItems}: {@code false}
|
||||||
* <li>{@code usePlatformDiagnostics}: {@code true}
|
|
||||||
* <li>{@link Clock}: {@link Clock#DEFAULT}
|
* <li>{@link Clock}: {@link Clock#DEFAULT}
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
|
@ -658,7 +656,6 @@ public interface ExoPlayer extends Player {
|
||||||
clock = Clock.DEFAULT;
|
clock = Clock.DEFAULT;
|
||||||
releaseTimeoutMs = DEFAULT_RELEASE_TIMEOUT_MS;
|
releaseTimeoutMs = DEFAULT_RELEASE_TIMEOUT_MS;
|
||||||
detachSurfaceTimeoutMs = DEFAULT_DETACH_SURFACE_TIMEOUT_MS;
|
detachSurfaceTimeoutMs = DEFAULT_DETACH_SURFACE_TIMEOUT_MS;
|
||||||
usePlatformDiagnostics = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1038,28 +1035,6 @@ public interface ExoPlayer extends Player {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether the player reports diagnostics data to the Android platform.
|
|
||||||
*
|
|
||||||
* <p>If enabled, the player will use the {@link android.media.metrics.MediaMetricsManager} to
|
|
||||||
* create a {@link android.media.metrics.PlaybackSession} and forward playback events and
|
|
||||||
* performance data to this session. This helps to provide system performance and debugging
|
|
||||||
* information for media playback on the device. This data may also be collected by Google <a
|
|
||||||
* href="https://support.google.com/accounts/answer/6078260">if sharing usage and diagnostics
|
|
||||||
* data is enabled</a> by the user of the device.
|
|
||||||
*
|
|
||||||
* @param usePlatformDiagnostics Whether the player reports diagnostics data to the Android
|
|
||||||
* platform.
|
|
||||||
* @return This builder.
|
|
||||||
* @throws IllegalStateException If {@link #build()} has already been called.
|
|
||||||
*/
|
|
||||||
@UnstableApi
|
|
||||||
public Builder setUsePlatformDiagnostics(boolean usePlatformDiagnostics) {
|
|
||||||
checkState(!buildCalled);
|
|
||||||
this.usePlatformDiagnostics = usePlatformDiagnostics;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link Clock} that will be used by the player. Should only be set for testing
|
* Sets the {@link Clock} that will be used by the player. Should only be set for testing
|
||||||
* purposes.
|
* purposes.
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ import androidx.media3.exoplayer.PlayerMessage.Target;
|
||||||
import androidx.media3.exoplayer.Renderer.MessageType;
|
import androidx.media3.exoplayer.Renderer.MessageType;
|
||||||
import androidx.media3.exoplayer.analytics.AnalyticsCollector;
|
import androidx.media3.exoplayer.analytics.AnalyticsCollector;
|
||||||
import androidx.media3.exoplayer.analytics.AnalyticsListener;
|
import androidx.media3.exoplayer.analytics.AnalyticsListener;
|
||||||
import androidx.media3.exoplayer.analytics.MediaMetricsListener;
|
|
||||||
import androidx.media3.exoplayer.analytics.PlayerId;
|
import androidx.media3.exoplayer.analytics.PlayerId;
|
||||||
import androidx.media3.exoplayer.audio.AudioRendererEventListener;
|
import androidx.media3.exoplayer.audio.AudioRendererEventListener;
|
||||||
import androidx.media3.exoplayer.metadata.MetadataOutput;
|
import androidx.media3.exoplayer.metadata.MetadataOutput;
|
||||||
|
|
@ -318,11 +317,7 @@ import java.util.concurrent.TimeoutException;
|
||||||
playbackInfoUpdateHandler.post(() -> handlePlaybackInfo(playbackInfoUpdate));
|
playbackInfoUpdateHandler.post(() -> handlePlaybackInfo(playbackInfoUpdate));
|
||||||
playbackInfo = PlaybackInfo.createDummy(emptyTrackSelectorResult);
|
playbackInfo = PlaybackInfo.createDummy(emptyTrackSelectorResult);
|
||||||
analyticsCollector.setPlayer(this.wrappingPlayer, applicationLooper);
|
analyticsCollector.setPlayer(this.wrappingPlayer, applicationLooper);
|
||||||
PlayerId playerId =
|
PlayerId playerId = Util.SDK_INT < 31 ? new PlayerId() : Api31.createPlayerId();
|
||||||
Util.SDK_INT < 31
|
|
||||||
? new PlayerId()
|
|
||||||
: Api31.registerMediaMetricsListener(
|
|
||||||
applicationContext, /* player= */ this, builder.usePlatformDiagnostics);
|
|
||||||
internalPlayer =
|
internalPlayer =
|
||||||
new ExoPlayerImplInternal(
|
new ExoPlayerImplInternal(
|
||||||
renderers,
|
renderers,
|
||||||
|
|
@ -3084,17 +3079,9 @@ import java.util.concurrent.TimeoutException;
|
||||||
private Api31() {}
|
private Api31() {}
|
||||||
|
|
||||||
@DoNotInline
|
@DoNotInline
|
||||||
public static PlayerId registerMediaMetricsListener(
|
public static PlayerId createPlayerId() {
|
||||||
Context context, ExoPlayerImpl player, boolean usePlatformDiagnostics) {
|
// TODO: Create a MediaMetricsListener and obtain LogSessionId from it.
|
||||||
@Nullable MediaMetricsListener listener = MediaMetricsListener.create(context);
|
return new PlayerId(LogSessionId.LOG_SESSION_ID_NONE);
|
||||||
if (listener == null) {
|
|
||||||
Log.w(TAG, "MediaMetricsService unavailable.");
|
|
||||||
return new PlayerId(LogSessionId.LOG_SESSION_ID_NONE);
|
|
||||||
}
|
|
||||||
if (usePlatformDiagnostics) {
|
|
||||||
player.addAnalyticsListener(listener);
|
|
||||||
}
|
|
||||||
return new PlayerId(listener.getLogSessionId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue