[Android] Video Time precision is not enough for return back to frame due to upgrade to 3.2.9 ( 16KB Policy )
Unity version
2022.3.62f2
Unity editor platform
macOS
AVPro Video edition
Ultra
AVPro Video version
3.2.9
Device hardware
Galaxy S24+
Which Android OS version are you using?
14
Unity Graphics API
OpenGLES 3
Video API
MediaPlayer
Texture format
BGRA
Audio output
Unity
Any other Media Player component configuration required to reproduce the issue.
No response
Which output component(s) are you using?
Playlist MediaPlayer
Any other component configuration required to reproduce the issue.
No response
The issue
Video Player SeekToFrame() seek video by time (using ConvertFrameToTimeSeconds)
After you added this for 16KB Policy
After seek finished, "mediaPlayer.CurrentTime" eliminated precision, only retain three decimal place.
So, if you want to calculate where the frame is according to the time after you seek, it will cause inaccurate.
- For example, I want to seek to frame 1:
Condition: Frame: 1 Frame rate: 36.860 (Video rate)
You will get where the time is for the frame 1 by
ConvertFrameToTimeSecond(1, 36.86)
frame = 1
frameRate = 36.86
frameDurationSeconds = 1.0/36.86 = 0.0271296799
return = 1*0.0271296799 + 0.0271296799*0.01 = 0.0274009767
After you execute
Seek(0.0274009767)
your mediaPlayer
PlatformMediaPlayer.cs
public override double GetCurrentTime()
{
return _state.currentTime
}
will get 0.027
So, if you want to calculate where the frame is by currentTime
You will use ConvertTimeSecondsToFrame
you execute
ConvertTimeSecondsToFrame(0.027, 36.86);
seconds = 0.027
frameRate = 36.86
0.027 * 36.86 = 0.99522
return (int)Floor(0.99522) = 0
You will get you are in frame 0
This is totally wrong ~
Media information
No response
Logcat output
Are you saying that this worked as you think it should before, and if so, which version was it?
Are you saying that this worked as you think it should before, and if so, which version was it?
This thing just happen after my teammate updated to v3.2.9. I asked him, but he forgot which version before he updated.
It worked before this Line came up.
Note: I changed (typed wrong before) Unity editor platform -> macOS AVPro Video edition -> Ultra
Linked to fix for issue #1999