-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(mobile): video player restarting when device rotates #17362
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
fix(mobile): video player restarting when device rotates #17362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The global key was essential here when I added this code because of how the hero animation internally renders the target page. I don't think it should be changed to a value key unless we can confirm the video is never reinitialized.
@mertalev can you tell me how I can test out the hero animation? I was unable to reproduce this. Issue with rotation is that the whole tree is rebuilt, and we need a consistent key across rebuilds to avoid the video controller reinitializing |
You can add debug logs to the video player loading methods, including the aspect ratio, video source, etc. They should be called exactly once for an asset. |
@mertalev thanks for your help, I know understand why the I have now introduced the Everything has been verified using loggin here on initial load (hero) and by rotating the device. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* fix(mobile): Video player restarting when device rotates * use global key in state * Implement suggestions from code review
…17362) * fix(mobile): Video player restarting when device rotates * use global key in state * Implement suggestions from code review
Description
Fixes the video player restarting when rotating the device.
Cause was a builder which would create a new
GlobalKey
every time the device was rotated (and therefore the WidgetTree rebuilt). This newGlobalKey
would cause a complete reinitialization of the Widget, rendering theuseState
useless.Changed the key to aValueKey
which should still work for the hero animation it was introduced for.#17362 (comment)
Fixes #16294
How Has This Been Tested?
Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)