mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Allow the user to pause while a video is buffering (#5929)
Fix pause while buffering Use getPlayWhenReady wrapper everywhere playWhenReady is checked Remove duplicate `playPause()` code
This commit is contained in:
		| @@ -706,11 +706,7 @@ public final class Player implements | |||||||
|             // Android TV: without it focus will frame the whole player |             // Android TV: without it focus will frame the whole player | ||||||
|             binding.playPauseButton.requestFocus(); |             binding.playPauseButton.requestFocus(); | ||||||
|  |  | ||||||
|             if (simpleExoPlayer.getPlayWhenReady()) { |             playPause(); | ||||||
|                 play(); |  | ||||||
|             } else { |  | ||||||
|                 pause(); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|         NavigationHelper.sendPlayerStartedEvent(context); |         NavigationHelper.sendPlayerStartedEvent(context); | ||||||
|     } |     } | ||||||
| @@ -1687,7 +1683,7 @@ public final class Player implements | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void saveWasPlaying() { |     public void saveWasPlaying() { | ||||||
|         this.wasPlaying = simpleExoPlayer.getPlayWhenReady(); |         this.wasPlaying = getPlayWhenReady(); | ||||||
|     } |     } | ||||||
|     //endregion |     //endregion | ||||||
|  |  | ||||||
| @@ -2686,7 +2682,7 @@ public final class Player implements | |||||||
|             Log.d(TAG, "onPlayPause() called"); |             Log.d(TAG, "onPlayPause() called"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (isPlaying()) { |         if (getPlayWhenReady()) { | ||||||
|             pause(); |             pause(); | ||||||
|         } else { |         } else { | ||||||
|             play(); |             play(); | ||||||
| @@ -4012,6 +4008,10 @@ public final class Player implements | |||||||
|         return !exoPlayerIsNull() && simpleExoPlayer.isPlaying(); |         return !exoPlayerIsNull() && simpleExoPlayer.isPlaying(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public boolean getPlayWhenReady() { | ||||||
|  |         return !exoPlayerIsNull() && simpleExoPlayer.getPlayWhenReady(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     private boolean isLoading() { |     private boolean isLoading() { | ||||||
|         return !exoPlayerIsNull() && simpleExoPlayer.isLoading(); |         return !exoPlayerIsNull() && simpleExoPlayer.isLoading(); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tom
					Tom