Closed yasirkula closed 3 months ago
I got weird problem after upgrading to v3. On Android after I call Seek() to any position I receive FinishedPlaying event almost immediatly and app closes video. In v2 this in not happenning and seek working as expected.
I'm not seeing this. Can you reproduce this in a fresh project using only AVPro Video mediaplayer demo scene?
I emailed reproduction project to unitysupport@renderheads.com
I'm getting a FinishedSeeking event. It continues to play fine though.
Yes. Player is working after seek.
But we getting FinishedPlaying event and MediaPlayer.Control.IsFinished() returns true after Seek is completed. Video is nowhere near it completion. So event is missfired and MediaPlayer.Control.IsFinished() should return false.
Described behaviour visible on reproduction video. Last GUI button with "Finished" text represents _mediaPlayer.Control.IsFinished() in your demo.
We tested this on devices: Quset 2, Quest 3 (Android 12), Redmagic 9 Pro, Pixel 6a (Android 14) It is happening both with remote (https://) and local (/storage) videos.
I attached debugger and Finished comes from Native.AVPPlayerGetState(_player, ref _state); in PlatformMediaPlayer. I can't debug deeper because it ends up in precompiled C plugin.
I managed to workaround this issue by ignoring FinishedPlaying event and MediaPlayer.Control.IsFinished() method and implementing custom completion detection using MediaPlayer.Control.HasMetaData(), MediaPlayer.Control.GetCurrentTime() and MediaPlayer.Info.GetDuration()
It works fine in Android mediaplayer, so it must be something to do with the switch over from Exoplayer to AndroidXMedia3
I'm not seeing this. Can you reproduce this in a fresh project using only AVPro Video mediaplayer demo scene?
I've set Auto Open, Auto Play and Loop to false in the Demo_MediaPlayer scene and added _mediaPlayer.OpenMedia(false);
to MediaPlayerUI.Start function. Then built the scene to my Android device.
I've been encountering a recurring issue that seems tied to specific software versions. Previously, everything was functioning perfectly on version 2.#.# of the software. However, after upgrading to version 3.0.0, I've noticed that seeking within a video triggers the FinishedPlaying event prematurely. This issue only surfaced after the transition to version 3.0.0.
I am currently using AVPro Video v3.0.0 with the native plugin also updated to v3.0.0-ultra. The platform specifics include an Adreno (TM) 740 GPU running Vulkan 1.1.0 [512.767.0], with multithreading enabled, on an Android system. My development environment is Unity 2022.3.20f1, and I'm streaming an MP4 file directly from AWS.
What's also interesting is that once the video has concluded that it "FinishedPlaying" from seeking, it wont trigger that event until a new video has played.
This can be validated by attaching this to a generic scene, connect the mediaplayer to the component MediaEvents.zip
With the seek active, mediaPlayer.Control.Seek(position); this event doesn't run at the end of the video MediaPlayerEvent.EventType.FinishedPlaying
With the seek INactive, MediaPlayerEvent.EventType.FinishedPlaying works as expected.
Interestingly, this problem seems to be isolated to the Android platform, specifically on the Quest 3 headset. I do not encounter this issue when running the same setup on a Windows system.
I hope this helps
I attached debugger and Finished comes from Native.AVPPlayerGetState(_player, ref _state); in PlatformMediaPlayer. I can't debug deeper because it ends up in precompiled C plugin.
@Last8Exile this goes through to the AVProVideo.jar as you observed in #1811. Digging through the Player_Base.PlayerRenderUpdate there is a bit where it's setting the flags for the state the player is in. Note that the bit being set for m_bFinishedSeeking
is the same as for IsFinished
so finishing seeking sets the IsFinished flag. Hence the false positive when seeking finishes.
if (IsPlaying())
i = bool | 0x2;
if (IsPaused())
i |= 0x4;
if (IsFinished())
i |= 0x8;
if (IsSeeking())
i |= 0x10;
if (IsBuffering())
i |= 0x20;
if (this.m_bFinishedSeeking)
i |= 0x8;
if (GetVideoTracksDirty() || GetAudioTracksDirty() || GetTextTracksDirty())
i |= 0x10000;
This should be fixed in v3.0.2 (penciled in for release by the end of the week)
AVPro Video version 3.0.2 has been released. Please let us know if it has not fixed your issue.
Describe the issue After having major issues with v3 on Android, I've downgraded to v2.9.3 and can confirm that the following issues arrived with v3.0.0:
PS. Using ExoPlayer.
Your Setup (please complete the following information):
To Reproduce