RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
237 stars 28 forks source link

Video doesn't pause on the right frame in Android #2037

Open noman5412 opened 3 days ago

noman5412 commented 3 days ago

I am using this code to pause video exactly on some specific frame but it goes beyond that frame in Android and then video gets paused.

private void Update() { if (_mediaPlayer.Control.GetCurrentTimeFrames() == 14000) { _mediaPlayer.Control.Pause(); } Debug.Log(_mediaPlayer.Control.GetCurrentTimeFrames()); }

Ste-RH commented 3 days ago

That is just the way video decoding works. There are a number of factors/reasons including, but not limited to:

Your best bet is to watch for the frame (or maybe the frame(s) before depending on application framerate and video framerate) and pause + seek to the desired frame. Have you tried this?

Even if we offered the above as a feature in the guts of the plugin (to mitigate the delays because of the second point above), we would likely have to seek back in order to guarantee no frames were thrown away due to being decoded, buffered, thrown away due to new frames arriving before the API actually pauses playback.