-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Add frame step buttons to internal video player #1207
base: master
Are you sure you want to change the base?
Conversation
Created icon_restart in order to reuse icon_previous asset for the frame step back button
src/main/java/org/quantumbadger/redreader/views/video/ExoPlayerWrapperView.java
Outdated
Show resolved
Hide resolved
R.string.video_step_back, | ||
view -> { | ||
long frameRate = mVideoPlayer.getVideoFormat() != null ? 30 : (long) mVideoPlayer.getVideoFormat().frameRate; | ||
mVideoPlayer.seekTo(mVideoPlayer.getCurrentPosition() - frameRate); |
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.
I don't think this is the correct way to do it? Frame rate is a number of frames in a second so you need to calculate 1000 / frameRate
to get duration of a frame in milliseconds
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're absolutely right, I'm not sure what I was thinking there. I also unintentionally inverted the null check which hid a different issue: apparently getVideoFormat().framerate
is always null in this context. After looking into it a bit, it seems like it's due to the format being H.264/AVC which ExoPlayer doesn't supply a frame rate for.
The condition is fixed in 8e0efb3. If you have any suggestions on how to proceed for calculating the frame rate just let me know. I'm working on the assumption that there may be a format change at some point in the future so I kept the frame rate check there for now.
Hi! This PR is based on #716. It adds an option for stepping through videos approximately frame by frame.
The setting is disabled by default and the new buttons are grayed out and disabled when playing as per this comment #716 (comment) by @QuantumBadger
I apologize if I'm stepping on any toes, there's been no activity on #716 for over a year so I figured I'd pick it up. Any feedback or suggestions are very welcome if there's more that needs to be done.