RenderHeads / UnityPlugin-AVProVideo

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

[iOS] Crashes on iOS AVPPluginGetRenderEventFunction #1947

Closed IgorKubyshkin closed 1 month ago

IgorKubyshkin commented 2 months ago

Hello. We've noticed some crashes after release our app in the AppStore. This happens when AVPPluginGetRenderEventFunction is called. Could you help us to resolve this? I attached crash logs and screenshot from xcode

Your Setup (please complete the following information):

Logs https://drive.google.com/file/d/174xYTQ6QxJLaQ23VUBTazZqMqSuFMOvN/view

Screenshots https://drive.google.com/file/d/1B-bJMG1jrIBGY8fRucvkNpTVJN35oY0S/view?usp=sharing

MorrisRH commented 2 months ago

AVPPluginGetRenderEventFunction is only called when the plugin is initialised the first time a MediaPlayer component is created. The odd thing from your crash logs is that this is being called from Unity's render thread when I would expect it to be called from the main thread.

Unfortunately there is not enough information in the log files to work out what's going wrong and without a reproducible case a fix will not be possible. If you could provide as much information as possible around how you're using the player in your app that would be helpful.

IgorKubyshkin commented 2 months ago

I use the Media Player component as part of the some prefabs. Nothing special. They cannot be created outside of the main thread. I don't create any Media Player instances in my code directly. I just add it in a prefab through the Inspector window and then I create instance of it using Instantiate method.

IgorKubyshkin commented 2 months ago

In my case the Initialise() function usually calls in OpenMedia(), becouse I open videos in OnEnable() function before Start(). But not always in OnEnable, it can be executed in Start in some cases.

I can try to add Media Player component in my launch/first scene, where is no any references to Media Player. Just for initialization and static constuctor call, then check if this crash is gone

efeurun commented 1 month ago

We are having the same problem, many of our iOS users crash with this error. This wasn't an issue before 3.X.

Did you come up with something? @IgorKubyshkin

IgorKubyshkin commented 1 month ago

I noticed that this happens quite often when calling Destroy media player (not at the time of media player initialization, as previously suggested). I can reproduce this crash in my project, but I havn't yet understood what needs to be done to avoid the error.

MorrisRH commented 1 month ago

@IgorKubyshkin if you're able to share your reproducible case that would be great, please send a link to unitysupport@renderheads.com

IgorKubyshkin commented 1 month ago

In my case, the app stops crashing if I temporarily comment Native.AVPPlayerRelease(_player) in PlatformMediaPlayer.Dispose(). I will try to reproduce the error on an empty project, if get success, I will send the link

IgorKubyshkin commented 1 month ago

@MorrisRH I've just sent you a link to unitysupport@renderheads.com

MorrisRH commented 1 month ago

@IgorKubyshkin thanks for the project. I've been able to reproduce the crash and identified the underlying issue. A fix will make it into the next release.

Chris-RH commented 1 month ago

AVPro Video version 3.0.8 has been released. Please can you let us know if it has not fixed your issue.

IgorKubyshkin commented 1 month ago

I can confirm that my test project is no longer crashing. I need to update my app in the App Store and collect some statistics, hopefully this crash won't happen anymore.

Chris-RH commented 1 month ago

I'll close this for now. Please reopen it if your users are still having issues with the updated version.