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

fix: Restrict screen display timed out while video is playing #61

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

omerhabib26
Copy link

Description:

  • Added flag to handle screen display timed out while video is playing

fix: LEARNER-10249

@omerhabib26
Copy link
Author

The failed test cases will be fixed once #60 is merged

@omerhabib26 omerhabib26 force-pushed the 2U/omer/LEARNER-10249 branch from f2b3110 to 660b783 Compare October 16, 2024 07:28
@@ -187,6 +189,7 @@ class VideoFullScreenFragment : Fragment(R.layout.fragment_video_full_screen) {
super.onPause()
exoPlayer?.removeListener(exoPlayerListener)
exoPlayer?.pause()
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Copy link
Collaborator

@dixidroid dixidroid Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added the flag in onCreate and clear it in onPause. Maybe it would be better to clear it in onDestroy? Or maybe better to add the flag in onResume...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As only one activity is used, it is better to move the keepScreenOn at the view level IMO.

eg. playerView.keepScreenOn = true

PS: +1 with @dixidroid's comment to utilizing the onResume and onPause.

@@ -277,6 +279,11 @@ class VideoUnitFragment : Fragment(R.layout.fragment_video_unit) {
}
}

override fun onPause() {
super.onPause()
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -187,6 +189,7 @@ class VideoFullScreenFragment : Fragment(R.layout.fragment_video_full_screen) {
super.onPause()
exoPlayer?.removeListener(exoPlayerListener)
exoPlayer?.pause()
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As only one activity is used, it is better to move the keepScreenOn at the view level IMO.

eg. playerView.keepScreenOn = true

PS: +1 with @dixidroid's comment to utilizing the onResume and onPause.

- Added flag to handle screen display timed out

fix: LEARNER-10249
@omerhabib26 omerhabib26 force-pushed the 2U/omer/LEARNER-10249 branch from 660b783 to 0468215 Compare October 21, 2024 07:44
@k1rill k1rill self-requested a review October 23, 2024 17:53
@HamzaIsrar12 HamzaIsrar12 merged commit c673d74 into 2U/develop Oct 29, 2024
3 checks passed
@HamzaIsrar12 HamzaIsrar12 deleted the 2U/omer/LEARNER-10249 branch October 29, 2024 05:18
farhan-arshad-dev pushed a commit that referenced this pull request Oct 31, 2024
- Added flag to handle screen display timed out
- Moving the `keepScreenOn` flag to OnPause & OnResume due to instance lifecycle

Fixes: LEARNER-10249
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.

5 participants