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.DefaultControlDispatcher;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||||
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
||||||
import com.google.android.exoplayer2.PlaybackParameters;
|
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
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
|
* 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";
|
public static final String EXTRAS_SPEED = "EXO_SPEED";
|
||||||
|
|
||||||
@ -766,9 +765,9 @@ public final class MediaSessionConnector {
|
|||||||
queueNavigator != null
|
queueNavigator != null
|
||||||
? queueNavigator.getActiveQueueItemId(player)
|
? queueNavigator.getActiveQueueItemId(player)
|
||||||
: MediaSessionCompat.QueueItem.UNKNOWN_ID;
|
: MediaSessionCompat.QueueItem.UNKNOWN_ID;
|
||||||
PlaybackParameters playbackParameters = player.getPlaybackParameters();
|
float playbackSpeed = player.getPlaybackSpeed();
|
||||||
extras.putFloat(EXTRAS_SPEED, playbackParameters.speed);
|
extras.putFloat(EXTRAS_SPEED, playbackSpeed);
|
||||||
float sessionPlaybackSpeed = player.isPlaying() ? playbackParameters.speed : 0f;
|
float sessionPlaybackSpeed = player.isPlaying() ? playbackSpeed : 0f;
|
||||||
builder
|
builder
|
||||||
.setActions(buildPrepareActions() | buildPlaybackActions(player))
|
.setActions(buildPrepareActions() | buildPlaybackActions(player))
|
||||||
.setActiveQueueItemId(activeQueueItemId)
|
.setActiveQueueItemId(activeQueueItemId)
|
||||||
@ -1133,7 +1132,7 @@ public final class MediaSessionConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
|
public void onPlaybackSpeedChanged(float playbackSpeed) {
|
||||||
invalidateMediaSessionPlaybackState();
|
invalidateMediaSessionPlaybackState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import androidx.annotation.Nullable;
|
|||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||||
import com.google.android.exoplayer2.Format;
|
import com.google.android.exoplayer2.Format;
|
||||||
import com.google.android.exoplayer2.PlaybackParameters;
|
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import com.google.android.exoplayer2.Timeline.Period;
|
import com.google.android.exoplayer2.Timeline.Period;
|
||||||
@ -133,6 +132,7 @@ public final class PlaybackStatsListener
|
|||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public PlaybackStats getPlaybackStats() {
|
public PlaybackStats getPlaybackStats() {
|
||||||
|
@Nullable
|
||||||
PlaybackStatsTracker activeStatsTracker =
|
PlaybackStatsTracker activeStatsTracker =
|
||||||
activeAdPlayback != null
|
activeAdPlayback != null
|
||||||
? playbackStatsTrackers.get(activeAdPlayback)
|
? playbackStatsTrackers.get(activeAdPlayback)
|
||||||
@ -323,9 +323,8 @@ public final class PlaybackStatsListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackParametersChanged(
|
public void onPlaybackSpeedChanged(EventTime eventTime, float playbackSpeed) {
|
||||||
EventTime eventTime, PlaybackParameters playbackParameters) {
|
this.playbackSpeed = playbackSpeed;
|
||||||
playbackSpeed = playbackParameters.speed;
|
|
||||||
sessionManager.updateSessions(eventTime);
|
sessionManager.updateSessions(eventTime);
|
||||||
for (PlaybackStatsTracker tracker : playbackStatsTrackers.values()) {
|
for (PlaybackStatsTracker tracker : playbackStatsTrackers.values()) {
|
||||||
tracker.onPlaybackSpeedChanged(eventTime, playbackSpeed);
|
tracker.onPlaybackSpeedChanged(eventTime, playbackSpeed);
|
||||||
|
@ -1008,7 +1008,7 @@ public class PlayerControlView extends FrameLayout {
|
|||||||
mediaTimeDelayMs = Math.min(mediaTimeDelayMs, mediaTimeUntilNextFullSecondMs);
|
mediaTimeDelayMs = Math.min(mediaTimeDelayMs, mediaTimeUntilNextFullSecondMs);
|
||||||
|
|
||||||
// Calculate the delay until the next update in real time, taking playbackSpeed into account.
|
// 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 =
|
long delayMs =
|
||||||
playbackSpeed > 0 ? (long) (mediaTimeDelayMs / playbackSpeed) : MAX_UPDATE_INTERVAL_MS;
|
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.C;
|
||||||
import com.google.android.exoplayer2.ControlDispatcher;
|
import com.google.android.exoplayer2.ControlDispatcher;
|
||||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
||||||
import com.google.android.exoplayer2.PlaybackParameters;
|
|
||||||
import com.google.android.exoplayer2.PlaybackPreparer;
|
import com.google.android.exoplayer2.PlaybackPreparer;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
@ -1333,7 +1332,7 @@ public class PlayerNotificationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
|
public void onPlaybackSpeedChanged(float playbackSpeed) {
|
||||||
postStartOrUpdateNotification();
|
postStartOrUpdateNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user