Skip to content

Commit

Permalink
Disable chronometer for playback speeds != 1.0
Browse files Browse the repository at this point in the history
This doesn't work because the Chronometer text layout can only count in realtime.

Issue:#6816
PiperOrigin-RevId: 288711702
  • Loading branch information
tonihei authored and ojw28 committed Jan 8, 2020
1 parent e5eaace commit 216518e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
* OkHttp extension: Upgrade OkHttp dependency to 3.12.7, which fixes a class of
`SocketTimeoutException` issues when using HTTP/2
([#4078](https://github.com/google/ExoPlayer/issues/4078)).
* Don't use notification chronometer if playback speed is != 1.0
([#6816](https://github.com/google/ExoPlayer/issues/6816)).

### 2.11.1 (2019-12-20) ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,18 @@ public final void setSmallIcon(@DrawableRes int smallIconResourceId) {
}

/**
* Sets whether the elapsed time of the media playback should be displayed
* Sets whether the elapsed time of the media playback should be displayed.
*
* <p>Note that this setting only works if all of the following are true:
*
* <ul>
* <li>The media is {@link Player#isPlaying() actively playing}.
* <li>The media is not {@link Player#isCurrentWindowDynamic() dynamically changing its
* duration} (like for example a live stream).
* <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 device is running at least API 21 (Lollipop).
* </ul>
*
* <p>See {@link NotificationCompat.Builder#setUsesChronometer(boolean)}.
*
Expand Down Expand Up @@ -1082,7 +1093,8 @@ protected NotificationCompat.Builder createNotification(
&& useChronometer
&& player.isPlaying()
&& !player.isPlayingAd()
&& !player.isCurrentWindowDynamic()) {
&& !player.isCurrentWindowDynamic()
&& player.getPlaybackParameters().speed == 1f) {
builder
.setWhen(System.currentTimeMillis() - player.getContentPosition())
.setShowWhen(true)
Expand Down

0 comments on commit 216518e

Please sign in to comment.