Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to show buffering view when setPlayWhenReady=false #4304

Closed
Gidex opened this issue May 27, 2018 · 8 comments
Closed

Add option to show buffering view when setPlayWhenReady=false #4304

Gidex opened this issue May 27, 2018 · 8 comments

Comments

@Gidex
Copy link

Gidex commented May 27, 2018

private void updateBuffering() {
if (bufferingView != null) {
boolean showBufferingSpinner =
showBuffering
&& player != null
&& player.getPlaybackState() == Player.STATE_BUFFERING
&& player.getPlayWhenReady();
bufferingView.setVisibility(showBufferingSpinner ? View.VISIBLE : View.GONE);
}
}

I think PlayerView.getPlayWhenReady() should not interfere with the visibility of the bufferingView, since the player keeps buffering even when paused...

@botaydotcom
Copy link
Contributor

Hi @Gidex,
I think the idea is to only show buffering view when user is watching/focusing on the player. If player.getPlayWhenReady() is false, the player is paused, and buffering is only done in the background. This is something user probably doesn't care about.
Is this something that's causing problem in your use case? Could you please clarify the problem you are facing in more details?

@ojw28
Copy link
Contributor

ojw28 commented May 29, 2018

I can confirm the current behavior is intentional. Displaying a buffering spinner when the user intention isn't to start playback immediately feels like extra UI noise that doesn't provide the user with useful information. We could probably make the behavior configurable, but I'm not convinced it's important.

@Gidex
Copy link
Author

Gidex commented May 29, 2018

As a user, I find it common for the user to use the buffering spinner to know when the player is ready to play. When watching and the player starts buffering, if the user pauses and the buffering spinner disappears, he may think the player is ready, but if the buffering spinner appears again when playing, it may seem confusing. In slow or unstable connections it is common for the user to pause to wait for the player to load enough so that he can continue without problems, so if he pauses and leaves his cell phone on the couch to go to drink water, when he returns and does not see the buffering spinner, no doubt he will think that the player is ready to play.
I'm using onPlayerStateChanged to do this, but it would be great if PlayerView.setShowBuffering was configurable :)

@ojw28 ojw28 changed the title BufferingView visibility Allow option to show buffering view when setPlayWhenReady=false Jun 4, 2018
@ojw28 ojw28 changed the title Allow option to show buffering view when setPlayWhenReady=false Add option to show buffering view when setPlayWhenReady=false Jun 4, 2018
@ojw28 ojw28 self-assigned this Jun 4, 2018
@szaboa
Copy link
Contributor

szaboa commented Jul 25, 2018

@ojw28
Can I work on this or it is already in progress?

@ojw28
Copy link
Contributor

ojw28 commented Jul 25, 2018

Feel free to work on this! I think I'd envisage a new PlayerView.setShowBuffering method that takes an IntDef that can have three values (SHOW_BUFFERING_NEVER / SHOW_BUFFERING_WHEN_PLAYING / SHOW_BUFFERING_ALWAYS). You can then deprecate the old method and update it to call the new one in a way that maintains its current behavior:

public void setShowBuffering(boolean showBuffering) {
  setShowBuffering(
      showBuffering ? SHOW_BUFFERING_WHEN_PLAYING : SHOW_BUFFERING_NEVER
}

Open to other approaches also.

@szaboa
Copy link
Contributor

szaboa commented Jul 26, 2018

Thank you, I do not see any better approach at the moment.
Started to work on this, will do the PR once is done.

@szaboa
Copy link
Contributor

szaboa commented Jul 26, 2018

@ojw28
Pull request here: #4585

szaboa added a commit to szaboa/ExoPlayer that referenced this issue Jul 27, 2018
@ojw28
Copy link
Contributor

ojw28 commented Aug 14, 2018

This will be merged shortly. Let's use the pull request for tracking.

@ojw28 ojw28 closed this as completed Aug 14, 2018
ojw28 added a commit that referenced this issue Aug 16, 2018
#4304 - Add option to show buffering view when setPlayWhenReady is false
@google google locked and limited conversation to collaborators Dec 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants