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

Custom played colour in TimeBar #2740

Closed
botondbutuza opened this issue Apr 27, 2017 · 3 comments
Closed

Custom played colour in TimeBar #2740

botondbutuza opened this issue Apr 27, 2017 · 3 comments
Assignees

Comments

@botondbutuza
Copy link

Hey guys!

Just updated to 2.4.0 and am playing around with the new TimeBar. Loving the customisations available.

I set a custom playedColor (app:played_color="@color/red"), and noticed that the colour of the whole progress bar changes to the played colour when scrubbing finishes. So if I'm at position 1000 and am scrubbing back to position 200, the played colour only fills up to 200, but if I let go at 200, the whole bar turns to the played colour.

@andrewlewis andrewlewis self-assigned this Apr 27, 2017
@andrewlewis
Copy link
Collaborator

andrewlewis commented Apr 28, 2017

The name played_color is misleading. The value is used as the bar color both to the left and to the right of the scrubbing handle, except that the opacity is overridden to be opaque for the part of the bar on the left of the handle.

You should be able to see this if you set the color like app:played_color="#880000FF". In this case the section of the bar to the left of the handle should be opaque blue while the section to the right should be translucent. (The other relevant color, which can also be overridden, is the buffered_color; if you saw a different color to the right of the scrubbing handle, that might be due to the player having buffered past the playback position, and possibly to the end of the content.)

I'll fix the naming of the attribute, but I suspect you might also want the ability to set the colors to the left and the right of the scrubbing handle separately? Please clarify if this is the case and if so I'll mark this as an enhancement. Thanks!

@botondbutuza
Copy link
Author

Thank you for your response and explanation, Andrew!

Okay, so my app:played_colour was #EA4239, and that colour was applied both left and right of the playhead, without any opacity change. When I changed the colour to #88EA4239, the opacity is correctly set, and the left side is different to the right side. I guess the colour is incorrectly parsed if there's no alpha value?

Also, something that I found odd: when scrubbing back, the buffered colour is used instead of the played colour. So we get a section of solid red, the playhead, buffered colour up to currentPosition, followed by translucent red. When scrubbing finishes, the bar turns translucent red to the right of the playhead. I personally think that the buffered colour shouldn't show when scrubbing back, as that section isn't technically buffered, and just results in a colour jump. What are your thoughts on this?

@andrewlewis
Copy link
Collaborator

I suspect #EA4239 is implicitly opaque. The color is used unmodified on the unplayed portion, and is made opaque for the played portion, and in this case there's no difference because the color is already opaque.

I'll mark this as an enhancement to track being able to specify colors for the played/buffered/unplayed parts of the bar and the scrubber handle separately.

If you want to customize how the buffered section is shown, you can make your own implementation of TimeBar and use it with PlaybackControlView.

ojw28 pushed a commit that referenced this issue May 4, 2017
Add attributes for the scrubber handle color and unplayed color. If attributes
are missing, derive defaults from the played color.

Issue: #2740

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154825736
@ojw28 ojw28 closed this as completed May 8, 2017
ojw28 pushed a commit that referenced this issue May 11, 2017
Add attributes for the scrubber handle color and unplayed color. If attributes
are missing, derive defaults from the played color.

Issue: #2740

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154825736
@google google locked and limited conversation to collaborators Sep 6, 2017
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

3 participants