Skip to content

Conversation

@MGaetan89
Copy link
Contributor

Pull request

Description

This PR introduces a CreditState, and its corresponding rememberCreditState() to observe entering/leaving a credit and seeking to the end of it.

Changes made

  • Create a CreditState.
  • Update the demo apps to use it.
  • Add some unit tests.

Checklist

  • APIs have been properly documented (if relevant).
  • The documentation has been updated (if relevant).
  • New unit tests have been written (if relevant).
  • The demo has been updated (if relevant).

@MGaetan89 MGaetan89 self-assigned this Aug 13, 2025
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Pillarbox Aug 13, 2025
@MGaetan89 MGaetan89 moved this from 📋 Backlog to 🚧 In Progress in Pillarbox Aug 13, 2025
@MGaetan89 MGaetan89 force-pushed the fix-end-credit-event branch 2 times, most recently from c796d25 to 4bd59eb Compare August 13, 2025 14:38
@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch 2 times, most recently from 85cb90c to 81ff1ed Compare August 14, 2025 14:33
@github-actions
Copy link

github-actions bot commented Aug 14, 2025

Code Coverage

Overall Project 49.94% 🟢
Files changed 100% 🟢

Module Coverage
Kover Gradle Plugin XML report for :plugins 6.83% 🟢
:pillarbox-ui 3.95% 🟢
Files
Module File Coverage
Kover Gradle Plugin XML report for :plugins PillarboxAndroidLibraryTestedModulePlugin.kt 0% 🟢
:pillarbox-ui CreditState.kt 100% 🟢
ComposablePlayer.kt 0% 🟢

@MGaetan89 MGaetan89 marked this pull request as ready for review August 14, 2025 14:51
@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch 2 times, most recently from b79d224 to e7bb1b3 Compare August 14, 2025 14:53
@MGaetan89 MGaetan89 moved this from 🚧 In Progress to 🍿 Code Review in Pillarbox Aug 14, 2025
@MGaetan89 MGaetan89 requested a review from StaehliJ August 14, 2025 15:02
Base automatically changed from fix-end-credit-event to main August 15, 2025 09:06
@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch from e7bb1b3 to 00634d5 Compare August 15, 2025 09:17
@StaehliJ
Copy link
Contributor

I don't like much the startObserving and stopObserving it's remind me the start of the Pillarbox project. This is why we moved to callback flows. At least for "states" related to the player.

@MGaetan89
Copy link
Contributor Author

I don't like much the startObserving and stopObserving it's remind me the start of the Pillarbox project. This is why we moved to callback flows. At least for "states" related to the player.

Media3 only adds the listener and never removes it:
https://github.com/androidx/media/blob/b7bbc6e2bc3e45ff3ed99884c114c50f03bba5c9/libraries/ui_compose/src/main/java/androidx/media3/ui/compose/state/PlayPauseButtonState.kt#L39-L43

I can use the same approach if you prefer?

@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch from 00634d5 to c56abb5 Compare August 26, 2025 08:15
@MGaetan89
Copy link
Contributor Author

I don't like much the startObserving and stopObserving it's remind me the start of the Pillarbox project. This is why we moved to callback flows. At least for "states" related to the player.

I've made CreditState's constructor internal, so integrators have to use rememberCreditState() to get an instance, and they don't need to worry about starting/stopping the listener.

@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch from 0e10d1e to 107589d Compare August 28, 2025 11:24
@MGaetan89 MGaetan89 force-pushed the 1112-improve-player-demo_credit branch from 107589d to 27b15bd Compare August 29, 2025 14:00
@MGaetan89 MGaetan89 enabled auto-merge August 29, 2025 14:03
@MGaetan89 MGaetan89 added this pull request to the merge queue Aug 29, 2025
Merged via the queue into main with commit ba8cf7d Aug 29, 2025
12 checks passed
@MGaetan89 MGaetan89 deleted the 1112-improve-player-demo_credit branch August 29, 2025 14:10
@github-project-automation github-project-automation bot moved this from 🍿 Code Review to ✅ Done in Pillarbox Aug 29, 2025
@MGaetan89 MGaetan89 linked an issue Aug 29, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Improve Player demo

2 participants