UnityPlugin-AVProVideo
UnityPlugin-AVProVideo copied to clipboard
Doesn't work on 2023.2.11f1
Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE
Describe the issue
After trying in Unity version: 2023.2.11f1 i see that it doesn't work at all. On older Unity version My project works good.
I debugged it to find issue and i see:
AndroidJavaException: java.lang.IllegalStateException: Player is accessed on the wrong thread. Current thread: 'Thread-2' Expected thread: 'main' See https://developer.android.com/guide/topics/media/issues/player-accessed-on-wrong-thread java.lang.IllegalStateException: Player is accessed on the wrong thread. Current thread: 'Thread-2' Expected thread: 'main' See https://developer.android.com/guide/topics/media/issues/player-accessed-on-wrong-thread at com.google.android.exoplr2avp.ExoPlayerImpl.verifyApplicationThread(ExoPlayerImpl.java:2795) at com.google.android.exoplr2avp.ExoPlayerImpl.setVideoFrameMetadataListener(ExoPlayerImpl.java:1621) at com.renderheads.AVPro.Video.Player_ExoPlayer.CreateExoPlayer(Player_ExoPlayer.java:167) at com.renderheads.AVPro.Video.Player_ExoPlayer.InitialisePlayer(Player_ExoPlayer.java:94) at com.renderheads.AVPro.Video.Player_Base.Initialise(Player_Base.java:57) at com.renderheads.AVPro.Video.Manager.CreatePlayer(Manager.java:30) at UnityEngine.AndroidJNISafe.CheckEx
Also i checking thread where i call _mediaPlayer.OpenMedia and it is main thread. Also i see that line from AndroidMediaPlayer also called from main thread:
m_Video = s_Interface.Call<AndroidJavaObject>( "CreatePlayer", (int)(m_API), options.useFastOesPath, options.preferSoftwareDecoder, (int)(options.audioOutput), (int)(options.audio360ChannelMode), options.audio360LatencyMS, Helper.GetUnityAudioSampleRate(), options.StartWithHighestBandwidth(), options.minBufferMs, options.maxBufferMs, options.bufferForPlaybackMs, options.bufferForPlaybackAfterRebufferMs, (int)(options.GetPreferredPeakBitRateInBitsPerSecond()), (int)(vPreferredVideo.x), (int)(vPreferredVideo.y), (int)(options.blitTextureFiltering), options.forceEnableMediaCodecAsyncQueueing);
Your Setup (please complete the following information):
- Unity version: 2023.2.11f1
- AVPro Video version (number and edition (trial/core/ultra/enterprise)): AVPro Video v2.9.2 trial
- Operating system version: Android
- Device model: Quest2
- What version of Unity was it working in previously?
- Is this reproducible using a new project and only AVPro Video demo scenes?
@Chris-RH , it works in 2023.1.20f1
I'll try to check demo soon
@Chris-RH , I've made clear test. I've created clean project and build apk with Demo_360Stereo and i see the same exception when i start it on quest2.
Here is logcat with exception: logs.txt
P.s. Unity and AvPro version the same as in the first message
OK. yeah, Unity 2023 is causing some issues. What you need to do is: Edit -> Project Settings -> Player Settings -> Settings for Android -> Other Settings Application Entry Point Activity - Check this box GameActivity - Uncheck this box
Hopefully this should work for you
OK. yeah, Unity 2023 is causing some issues. What you need to do is: Edit -> Project Settings -> Player Settings -> Settings for Android -> Other Settings Application Entry Point Activity - Check this box GameActivity - Uncheck this box
Hopefully this should work for you
It doesn't work for me. My App for Meta Quest. And when i try build with checked Activity instead of GameActivity app doesn't start. And also i see in Meta Project Setup Tool error: "Always specify single GameActivity application entry on Unity 2023.2+".
I think it must be fixed in Android part. May be you need init Expolyer inside runOnUiThread ?
runOnUiThread(new Runnable() { // init here })
Even in a fresh project running just AVPro Video? What about Android Mediaplayer?
Even in a fresh project running just AVPro Video? What about Android Mediaplayer?
Yep i've created a new project for tests.
I don't interest Android Mediaplaye, because i think that exoplayer better for Android. But i tested and i've got other exception:
Please don't upload projects containing our assets publicly. Could you email it to us at [email protected] please. Have you tried on a different android device? I can't reproduce it with a fresh project and AVPro Video mediaplayer demo scene, with the aforementioned changes and removing Vulkan from graphics API.
Have you tried on a different android device? I can't reproduce it with a fresh project and AVPro Video mediaplayer demo scene, with the aforementioned changes and removing Vulkan from graphics API.
Do you use GameActivity or Activity? My App for VR with Meta SDK. I can't use Activity because it requires GameActivity on Unity 2023.2+. And i've nott tried on another android devices because i need it for oculus quest 2/3 only.
I've made repo private and send invate to [email protected]
I didn't know Meta SDK required you to use GameActivity? Where is this information?
I didn't know Meta SDK required you to use GameActivity? Where is this information?
Sorry for late answer.
If you change GameActivity to Activity in Player Settings you will see this Error:
I've tried ignore this error and build app with Activity instead of GameActivity but app doesn't start with Exception that cant find GameActivity. I've tried use custom AndroidManifest where i set Activity instead of GameActivity but i got the same error.
Ahh, I see. This is something that we will have to look into. Meanwhile, could you use a different version of Unity?
Ahh, I see. This is something that we will have to look into. Meanwhile, could you use a different version of Unity?
Yep i use 2023.1.20f1. I just wanted to update ;) but looks like i have to wait while you fix it.
Unity 2023.2.17, AVProVideo 2.9.3
Same issue here. I am working on a Meta quest application that play 360 videos and I got the same exception java.lang.IllegalStateException: Player is accessed on the wrong thread when try to play the video.
I tried with the version 2.9.3 of AVPro video that as been deprecated now so there will be no fix for the V2.
I upgraded to the v 3.0.0 for about 250$ and the application does not even start, it crashes immediatly.
How you guys can sell a product at this price and deprecate it without even fix this kind of issue and force users to buy new version that working less than the old one.
I upgraded to the v 3.0.0 for about 250$ and the application does not even start, it crashes immediatly.
I also have crash after update to v3 https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1807
I think we need wait. I hope they can find solution for crash. Their demo scene work with v3. Just post your logcat with crash in my issue. It will help them find solution.
This is a very grey area. The issue is that ExoPlayer, a year or two ago, changed their threading model such that all ExoPlayer calls needed to be made on the same thread that ExoPlayer was created on. Meta seem to be now forcing the use of GameActivity which appears to be where this threading difference has come in.
Currently, we are not sure how we might work around this issue. But please be aware that this is changes externally to the AVPro Video asset that have landed on all of us.
@Hadrien-Estela If the AVPro Video asset is not working for you and your current project(s), then we will happily refund you such that you can use another solution. Simply apply to Unity for a refund. They will then check your current usage of the asset and apply to us to agree a refund...which we will agree to promptly.
@Anton111111 I do not believe the crash in #1807 is linked to this issue. Please refrain from cross posting as it always means things take longer for us to follow/figure out!
@Chris-RH , I don't think it's difficult. Do you have source codes for the Android part. I can fix it ;)
With all due respect, you do not know the AVPro codebase. It might be as simple as adding a flag to run the player creation/localisation on the main thread (which is what I think you believe the fix might be), and that may indeed allow player creation, but I suspect that will have many knock on issues.
With all due respect, you do not know the AVPro codebase. It might be as simple as adding a flag to run the player creation/localisation on the main thread (which is what I think you believe the fix might be), and that may indeed allow player creation, but I suspect that will have many knock on issues.
Of course, I'm not familiar with the code. But I have a good experience working with exoplayer on android. And I could help with that.
Can you just wrap the contents of the android method 'CreatePlayer' on runOnUiThread(new Runnable() { // init here })?
In principle, this is not so important to me at the moment. I will definitely not migrate to 2023.2.11f1 this year. So you can just ignore this issue.
Thank you for your offer, sorry if I came over a bit abrasive! That is not what I meant to do.
Can you just wrap the contents of the android method 'CreatePlayer' on runOnUiThread(new Runnable() { // init here })?
Well, in principle this is one of the solutions. But in practice it is required for every single call into the ExoPlayer library that Unity triggers. So whilst that may fix the player creation, there are so many other pieces of functionality that then cause playback to fall over. This is not a small undertaking, but one we have noted for a while might eventually be required. It is just that Unity/Meta have thrust this upon us with no warning!
We like to be on the front foot with such things as this, and so we have looked at all viable solutions, but ultimately landed on working towards a solution that will mean everything ExoPlayer within AVPro Video will ultimately run on the UI thread (meaning a lot more deferral/caching code). Hoping to have a working solution out this week or maybe next.
AVPro Video version 3.0.3 has been released. Please let us know if it has not fixed your issue.