UnityPlugin-AVProVideo icon indicating copy to clipboard operation
UnityPlugin-AVProVideo copied to clipboard

[Android] Video Time precision is not enough for return back to frame due to upgrade to 3.2.9 ( 16KB Policy )

Open Robin-XRSPACE opened this issue 2 months ago • 4 comments

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) Image After you added this for 16KB Policy Image 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 Image 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


Robin-XRSPACE avatar Oct 30 '25 07:10 Robin-XRSPACE

Are you saying that this worked as you think it should before, and if so, which version was it?

Chris-RH avatar Oct 30 '25 10:10 Chris-RH

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.

Image

Robin-XRSPACE avatar Oct 31 '25 02:10 Robin-XRSPACE

Note: I changed (typed wrong before) Unity editor platform -> macOS AVPro Video edition -> Ultra

Robin-XRSPACE avatar Oct 31 '25 05:10 Robin-XRSPACE

Linked to fix for issue #1999

Ste-RH avatar Nov 24 '25 16:11 Ste-RH