mirror of
https://github.com/androidx/media.git
synced 2025-05-06 23:20:42 +08:00
Migrate usages of deprecated Player#set/getPlaybackParameters()
PiperOrigin-RevId: 321166822
This commit is contained in:
parent
820970e767
commit
437d1b6e9a
@ -320,12 +320,12 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setPlaybackSpeed(float playbackSpeed) {
|
public boolean setPlaybackSpeed(float playbackSpeed) {
|
||||||
player.setPlaybackParameters(new PlaybackParameters(playbackSpeed));
|
player.setPlaybackSpeed(playbackSpeed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPlaybackSpeed() {
|
public float getPlaybackSpeed() {
|
||||||
return player.getPlaybackParameters().speed;
|
return player.getPlaybackSpeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
@ -923,7 +923,7 @@ public class PlayerNotificationManager {
|
|||||||
* <li>The media is not {@link Player#isCurrentWindowDynamic() dynamically changing its
|
* <li>The media is not {@link Player#isCurrentWindowDynamic() dynamically changing its
|
||||||
* duration} (like for example a live stream).
|
* duration} (like for example a live stream).
|
||||||
* <li>The media is not {@link Player#isPlayingAd() interrupted by an ad}.
|
* <li>The media is not {@link Player#isPlayingAd() interrupted by an ad}.
|
||||||
* <li>The media is played at {@link Player#getPlaybackParameters() regular speed}.
|
* <li>The media is played at {@link Player#getPlaybackSpeed() regular speed}.
|
||||||
* <li>The device is running at least API 21 (Lollipop).
|
* <li>The device is running at least API 21 (Lollipop).
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
@ -1086,7 +1086,7 @@ public class PlayerNotificationManager {
|
|||||||
&& player.isPlaying()
|
&& player.isPlaying()
|
||||||
&& !player.isPlayingAd()
|
&& !player.isPlayingAd()
|
||||||
&& !player.isCurrentWindowDynamic()
|
&& !player.isCurrentWindowDynamic()
|
||||||
&& player.getPlaybackParameters().speed == 1f) {
|
&& player.getPlaybackSpeed() == 1f) {
|
||||||
builder
|
builder
|
||||||
.setWhen(System.currentTimeMillis() - player.getContentPosition())
|
.setWhen(System.currentTimeMillis() - player.getContentPosition())
|
||||||
.setShowWhen(true)
|
.setShowWhen(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user