remove deprecated usage of PlaybackParameter
Removes usage of PlaybackParameters where it seems to be trivial. PiperOrigin-RevId: 300435199
This commit is contained in:
parent
072720270d
commit
527563da31
@ -38,7 +38,6 @@ import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.util.Assertions;
|
||||
@ -129,7 +128,7 @@ public final class MediaSessionConnector {
|
||||
|
||||
/**
|
||||
* The name of the {@link PlaybackStateCompat} float extra with the value of {@link
|
||||
* PlaybackParameters#speed}.
|
||||
* Player#getPlaybackSpeed()}.
|
||||
*/
|
||||
public static final String EXTRAS_SPEED = "EXO_SPEED";
|
||||
|
||||
@ -766,9 +765,9 @@ public final class MediaSessionConnector {
|
||||
queueNavigator != null
|
||||
? queueNavigator.getActiveQueueItemId(player)
|
||||
: MediaSessionCompat.QueueItem.UNKNOWN_ID;
|
||||
PlaybackParameters playbackParameters = player.getPlaybackParameters();
|
||||
extras.putFloat(EXTRAS_SPEED, playbackParameters.speed);
|
||||
float sessionPlaybackSpeed = player.isPlaying() ? playbackParameters.speed : 0f;
|
||||
float playbackSpeed = player.getPlaybackSpeed();
|
||||
extras.putFloat(EXTRAS_SPEED, playbackSpeed);
|
||||
float sessionPlaybackSpeed = player.isPlaying() ? playbackSpeed : 0f;
|
||||
builder
|
||||
.setActions(buildPrepareActions() | buildPlaybackActions(player))
|
||||
.setActiveQueueItemId(activeQueueItemId)
|
||||
@ -1133,7 +1132,7 @@ public final class MediaSessionConnector {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
|
||||
public void onPlaybackSpeedChanged(float playbackSpeed) {
|
||||
invalidateMediaSessionPlaybackState();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
import com.google.android.exoplayer2.Timeline.Period;
|
||||
@ -133,6 +132,7 @@ public final class PlaybackStatsListener
|
||||
*/
|
||||
@Nullable
|
||||
public PlaybackStats getPlaybackStats() {
|
||||
@Nullable
|
||||
PlaybackStatsTracker activeStatsTracker =
|
||||
activeAdPlayback != null
|
||||
? playbackStatsTrackers.get(activeAdPlayback)
|
||||
@ -323,9 +323,8 @@ public final class PlaybackStatsListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackParametersChanged(
|
||||
EventTime eventTime, PlaybackParameters playbackParameters) {
|
||||
playbackSpeed = playbackParameters.speed;
|
||||
public void onPlaybackSpeedChanged(EventTime eventTime, float playbackSpeed) {
|
||||
this.playbackSpeed = playbackSpeed;
|
||||
sessionManager.updateSessions(eventTime);
|
||||
for (PlaybackStatsTracker tracker : playbackStatsTrackers.values()) {
|
||||
tracker.onPlaybackSpeedChanged(eventTime, playbackSpeed);
|
||||
|
@ -1008,7 +1008,7 @@ public class PlayerControlView extends FrameLayout {
|
||||
mediaTimeDelayMs = Math.min(mediaTimeDelayMs, mediaTimeUntilNextFullSecondMs);
|
||||
|
||||
// Calculate the delay until the next update in real time, taking playbackSpeed into account.
|
||||
float playbackSpeed = player.getPlaybackParameters().speed;
|
||||
float playbackSpeed = player.getPlaybackSpeed();
|
||||
long delayMs =
|
||||
playbackSpeed > 0 ? (long) (mediaTimeDelayMs / playbackSpeed) : MAX_UPDATE_INTERVAL_MS;
|
||||
|
||||
|
@ -37,7 +37,6 @@ import androidx.media.app.NotificationCompat.MediaStyle;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ControlDispatcher;
|
||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||
import com.google.android.exoplayer2.PlaybackParameters;
|
||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.Timeline;
|
||||
@ -1333,7 +1332,7 @@ public class PlayerNotificationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
|
||||
public void onPlaybackSpeedChanged(float playbackSpeed) {
|
||||
postStartOrUpdateNotification();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user