-
-
Notifications
You must be signed in to change notification settings - Fork 445
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: clearing watch positions doesn't works sometimes #5557
fix: clearing watch positions doesn't works sometimes #5557
Conversation
This PR assumes that the timer task is still running in the background even though the player fragment already got killed? I think it'd be easier to just release the timer in the |
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.
Removed Custom timer class. I thought it's easier to manage start and pause with custom timer class.
@@ -252,6 +251,9 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { | |||
} | |||
} | |||
|
|||
// schedule task to save the watch position each second | |||
private var watchPositionTimer = Timer() |
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.
private var watchPositionTimer = Timer() | |
private var watchPositionTimer: Timer? = null |
We don't need to initialize the timer here - it's going to be overwritten before the first usage anyways.
@@ -276,6 +278,18 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { | |||
100 | |||
) | |||
} | |||
|
|||
//Start or pause watch position timer |
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.
//Start or pause watch position timer | |
// Start or pause watch position timer |
@@ -907,7 +912,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { | |||
|
|||
val videoStream = streams.videoStreams.firstOrNull() | |||
val isShort = PlayingQueue.getCurrent()?.isShort == true || | |||
(videoStream?.height ?: 0) > (videoStream?.width ?: 0) | |||
(videoStream?.height ?: 0) > (videoStream?.width ?: 0) |
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.
Please undo that formatting change.
@@ -945,7 +950,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { | |||
if (binding.playerMotionLayout.progress != 1.0f) { | |||
// show controllers when not in picture in picture mode | |||
val inPipMode = PlayerHelper.pipEnabled && | |||
PictureInPictureCompat.isInPictureInPictureMode(requireActivity()) | |||
PictureInPictureCompat.isInPictureInPictureMode(requireActivity()) |
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.
Please undo that formatting change.
Just some nitpick comments, the idea generally looks good to me 👍 |
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!
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.
Sorry for making those silly mistakes.
Your suggestions really helps me to improve my code style.
No description provided.