Skip to content

Conversation

@duongphuhiep
Copy link
Contributor

Motivation

Allow consumer to mock the VideoPlayer in all kind of situations (for Previewing or testing). For example

  • Preview (or instrumented test) when the video is Buffering -> assert that the slider turns gray
  • Preview (or instrumented test) when the currentTime > 1min -> assert that the Ads modal pop up, slider turns blue..
  • Preview (or instrumented test) when state contains an error -> assert that the error is displayed in the right place
  • etc..

Solution

Turn VideoPlayerState to interface, consumer provides their own (mock) Player State for previewing (or testing).

Breaking changes

VideoPlayerState() becomes createVideoPlayerState()

Note: this breaking change won't impact most consumers, because they usually use rememberVideoPlayerState() to instantiate a new VideoPlayerState

@duongphuhiep
Copy link
Contributor Author

I amended my "rush" commit.
Now we can have this

Screenshot_20251223_154546

@duongphuhiep duongphuhiep force-pushed the VideoPlayerStateInterface branch 2 times, most recently from 7cfab0e to b3a1c8f Compare December 23, 2025 16:33
@kdroidFilter kdroidFilter changed the base branch from bump-dependencies to master December 23, 2025 17:56
@kdroidFilter
Copy link
Owner

Thank you so much, I really like it, it’s super convenient!
I’d prefer to merge it into master instead. Would you be able to resolve the conflicts? I just finished my PR to re-add Compose Web support.

@duongphuhiep
Copy link
Contributor Author

I will try,

but I won't be able to test on Mac, Windows, iOS, I only have a Linux laptop

@duongphuhiep duongphuhiep force-pushed the VideoPlayerStateInterface branch from b3a1c8f to b8fcdaf Compare December 23, 2025 21:20
@duongphuhiep
Copy link
Contributor Author

duongphuhiep commented Dec 23, 2025

Hi, I solved all the conflicts and tested on

  • Android (Google TV Emulator old Android 12)
  • Linux Desktop (my Ubuntu laptop)
  • Web (Google Chrome)

For other platform Win, Mac, iOS, I think that it compiles, but I don't have MAC or iPhone to test.

@kdroidFilter kdroidFilter merged commit cf3815e into kdroidFilter:master Dec 24, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants