Comments (22)
Hello!
I'm facing the exact same issue. If I close the app with Application.Quit(); during the video play, then I can re open it with no problem. If I close the app after the video finishes playing, then I got the message: "[AVProVideo] Failed to create player instance".
from unityplugin-avprovideo.
We've just released a new version of AVPro Video (v.1.9.17) which should fix this issue. Please do test it and let us know if if this resolves it for you.
Thanks,
from unityplugin-avprovideo.
We'll close this issue in a couple of days, as we've proposed a solution (new plugin version) but haven't heard anything back. If you're still having this issue with the new version please do let us know.
Thanks,
from unityplugin-avprovideo.
The issue still persist after update.
My setup:
Unity version: 2018.4.2f1
AVPro Video version: 1.9.17
Operating system version: Android 8.0.0
Device model: Samsung S8
2019-06-20 19:03:52.928 15070-15387/com.GizmoVR.GizmoVR E/Unity: [AVProVideo] Failed to create player instance
RenderHeads.Media.AVProVideo.AndroidMediaPlayer:.ctor(Boolean, Boolean, VideoApi, Boolean, Audio360ChannelMode, Boolean)
RenderHeads.Media.AVProVideo.MediaPlayer:CreatePlatformMediaPlayer()
RenderHeads.Media.AVProVideo.MediaPlayer:Initialise()
RenderHeads.Media.AVProVideo.MediaPlayer:Start()
2019-06-20 19:03:52.942 15070-15387/com.GizmoVR.GizmoVR I/Unity: [AVProVideo] Initialising AVPro Video (script v1.9.17 plugin v1.9.17) on Mali-G71/OpenGL ES 3.2 v1.r9p0-01rel0.2498e584901afb9257be0d365ada85fa (MT False) on Android
RenderHeads.Media.AVProVideo.Helper:LogInfo(String, Object)
RenderHeads.Media.AVProVideo.MediaPlayer:Initialise()
RenderHeads.Media.AVProVideo.MediaPlayer:Start()
from unityplugin-avprovideo.
@joker-gizmo
Thanks for reporting this - could you provide more details on how to replicate this issue?
from unityplugin-avprovideo.
The problem was with another native plugin which is not terminate their thread correctly on quit. There was a bunch of errors on quit and after restart no one plugin was able to init. Sorry, for misleading you
from unityplugin-avprovideo.
Great to hear you found the issue, i'll close this ticket now
from unityplugin-avprovideo.
Hi!
Sorry for the delayed response.
I tested the new version (1.9.17) and have to say that the problem is still present. I made a small test project to show the issue, and realized that I'm when the video ends I disable the GameObject with the MediaPlayer attached and that is causing the problem. If I don't disable the GameObject or quit the app before the video ends, all goes fine.
To reproduce:
- Create a new project and import AvPro 1.9.17.
- Add a MediaPlayer, a Display UGui and link them so a video can be viewed. For simplicity let AutoOpen and AutoPlay to true. Add a video (any from StreamingAssets will work).
- Create a GameObject and attach this script:
using RenderHeads.Media.AVProVideo;
using UnityEngine;
public class Manager : MonoBehaviour{
public MediaPlayer player;
void Start() {
player.Events.AddListener(PlayerEvent);
}
void Update() {
if(Input.GetKeyDown(KeyCode.Escape)){
Application.Quit();
}
}
public void PlayerEvent(MediaPlayer player, MediaPlayerEvent.EventType eventType, ErrorCode error){
switch(eventType){
case MediaPlayerEvent.EventType.FinishedPlaying:
player.CloseVideo(); // The problem occurs regardless of this line
player.gameObject.SetActive(false); // <-- If you remove this line, the problem dissapears.
break;
}
}
}
- Attach the script to the new GameObject.
- Attach the MediaPlayer to the Manager script.
- Compile and run the app on Android.
- When the app start, let the video play to the end and press back button to quit the app.
- Launch the app again, the app will freeze and the logcat shows:
[AVProVideo] Failed to create player instance
If you want I can send you the project I made to test it.
Thanks!
from unityplugin-avprovideo.
Also receiving this issue on Android 9 with unity 2019.1.11f, happens always after Application.Quit();
and returning and running the game again. very annoying to players.
using the latest version 1.10.0
If closing the app using the home button, it seems the videos are working and i do not get this error.
Any fix for this or maybe should i use something to dipose AVPRO on Application.quit?
09-30 21:08:56.848: E/Unity(5478): Unable to find libc
09-30 21:08:56.882: E/Unity(5478): [AVProVideo] Failed to create player instance
09-30 21:08:56.882: E/Unity(5478): RenderHeads.Media.AVProVideo.AndroidMediaPlayer:.ctor(Boolean, Boolean, VideoApi, Boolean, Audio360ChannelMode, Boolean)
09-30 21:08:56.882: E/Unity(5478): RenderHeads.Media.AVProVideo.MediaPlayer:CreatePlatformMediaPlayer()
09-30 21:08:56.882: E/Unity(5478): RenderHeads.Media.AVProVideo.MediaPlayer:Initialise()
09-30 21:08:56.882: E/Unity(5478): RenderHeads.Media.AVProVideo.MediaPlayer:Start()
09-30 21:08:56.882: E/Unity(5478):
09-30 21:08:56.882: E/Unity(5478): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
from unityplugin-avprovideo.
Hmm...seems that this issue is still happening (sorry we only noticed now as we don't get notifications on Closed issues)
from unityplugin-avprovideo.
Yes, it does :\ Whatever I tried to clean AVProVideo before quit game did not work.
from unityplugin-avprovideo.
Any update on this?
I'll do note that I do open a few instances of AVProVideo in order to pre-prepare a video in a sequence.
If I Application.Quit()
without init any video the problem does not occur.
from unityplugin-avprovideo.
Hi,
I can confirm that this is still happening.
My workarround was to quit the app using Android native code:
public static void QuitApp(){
#if UNITY_ANDROID
AndroidJavaClass player = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject androidActivity = player.GetStatic<AndroidJavaObject>("currentActivity");
if(androidActivity!=null){
androidActivity.Call("finishAffinity");
AndroidJavaClass system = new AndroidJavaClass("java.lang.System");
system.CallStatic("exit", new object[]{0});
}
#else
Application.Quit();
#endif
}
This is working on Unity 2019.1.14f1, Unity 2018.4.2f1, on Android 8 and 9.
from unityplugin-avprovideo.
@parmaia thanks for the update. I less prefer this solution, but it's better than nothing until fixed.
I'll try it out.
from unityplugin-avprovideo.
@parmaia For some reason, i get an error on:
AndroidJavaClass System = AndroidNativeInterface.GetClass("java.lang.System");
'AndroidNativeInterface' does not exist in the current context
When compling to APK
from unityplugin-avprovideo.
@ColorTwist sorry, I kind of messed up with my sample code. I have a class for native calls and one line went into my sample code.
This is the good code:
public static void QuitApp(){
#if UNITY_ANDROID
AndroidJavaClass player = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject androidActivity = player.GetStatic<AndroidJavaObject>("currentActivity");
if(androidActivity!=null){
androidActivity.Call("finishAffinity");
AndroidJavaClass system = new AndroidJavaClass("java.lang.System");
system.CallStatic("exit", new object[]{0});
}
#else
Application.Quit();
#endif
}
I tested this on Unity 2018.4.2f1 and Untiy 2019.1.14f1 and on Android 8 and Android 9.
Again, sorry for the mistake.
from unityplugin-avprovideo.
I have this problem too, but I dont have any native code, is there way to do it from C# in unity?
from unityplugin-avprovideo.
@nsmith1024 You can use the QuitApp() method in my previous comment. It is C#.
from unityplugin-avprovideo.
OK, thanks i w ill try it, i was wondering should I replace "com.unity3d.player.UnityPlayer" with my app package name? what about "currentActivity" do i have to change that?
from unityplugin-avprovideo.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from unityplugin-avprovideo.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from unityplugin-avprovideo.
Closing due to inactivity
from unityplugin-avprovideo.
Related Issues (20)
- Incompatible min SDK and target SDK HOT 1
- How can i check the support media ? HOT 4
- Try to cache and play the video, an error occurs on Android. HOT 4
- WebGL Error HOT 2
- [iOS] Sometimes the video doesn't play HOT 4
- RTMP url fails to open HOT 4
- Which VideoAPI should I choose in Win? HOT 1
- Issue building for iOS HOT 2
- Replace Pointer_stringify(ptrToSomeCString) with UTF8ToString(ptrToSomeCString) in WebGL Plugin HOT 1
- v3.0 Crashes on UWP ARM64 (HoloLens 2) on app start HOT 2
- v3.0 Media player only plays audio UWP HOT 1
- Ad Support/MediaTailor/Disable Seek HOT 3
- Cant load 4k videos with AV pro plugin (Paid version) HOT 3
- About Visual Angle HOT 2
- When I try to play a video on Android, the video appears to flash, and it crashes when I try to seek. HOT 4
- Some android devices not working on vulkan api HOT 12
- Video with spatial audio is started only once HOT 2
- Significant drop in FPS with Playback on Vulkan HOT 6
- [Spatial Video] How to play spatial video on Quest3 device using Unity? HOT 3
- Enabling "UseMotionBlur" corrupts exported video when capture mode is Offline Render HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unityplugin-avprovideo.