-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
The failed test cases will be fixed once #60 is merged |
f2b3110
to
660b783
Compare
@@ -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) |
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.
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...
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.
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) |
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.
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) |
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.
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
660b783
to
0468215
Compare
course/src/main/java/org/openedx/course/presentation/unit/video/VideoFullScreenFragment.kt
Outdated
Show resolved
Hide resolved
- Added flag to handle screen display timed out - Moving the `keepScreenOn` flag to OnPause & OnResume due to instance lifecycle Fixes: LEARNER-10249
Description:
fix: LEARNER-10249