Giter VIP home page Giter VIP logo

Comments (22)

parmaia avatar parmaia commented on July 22, 2024

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.

AndrewRH avatar AndrewRH commented on July 22, 2024

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.

AndrewRH avatar AndrewRH commented on July 22, 2024

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.

joker-gizmo avatar joker-gizmo commented on July 22, 2024

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.

AndrewRH avatar AndrewRH commented on July 22, 2024

@joker-gizmo
Thanks for reporting this - could you provide more details on how to replicate this issue?

from unityplugin-avprovideo.

joker-gizmo avatar joker-gizmo commented on July 22, 2024

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.

AndrewRH avatar AndrewRH commented on July 22, 2024

Great to hear you found the issue, i'll close this ticket now

from unityplugin-avprovideo.

parmaia avatar parmaia commented on July 22, 2024

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:

  1. Create a new project and import AvPro 1.9.17.
  2. 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).
  3. 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;
        }
    }    
}
  1. Attach the script to the new GameObject.
  2. Attach the MediaPlayer to the Manager script.
  3. Compile and run the app on Android.
  4. When the app start, let the video play to the end and press back button to quit the app.
  5. 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.

ColorTwist avatar ColorTwist commented on July 22, 2024

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.

AndrewRH avatar AndrewRH commented on July 22, 2024

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.

ColorTwist avatar ColorTwist commented on July 22, 2024

Yes, it does :\ Whatever I tried to clean AVProVideo before quit game did not work.

from unityplugin-avprovideo.

ColorTwist avatar ColorTwist commented on July 22, 2024

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.

parmaia avatar parmaia commented on July 22, 2024

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.

ColorTwist avatar ColorTwist commented on July 22, 2024

@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.

ColorTwist avatar ColorTwist commented on July 22, 2024

@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.

parmaia avatar parmaia commented on July 22, 2024

@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.

nsmith1024 avatar nsmith1024 commented on July 22, 2024

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.

parmaia avatar parmaia commented on July 22, 2024

@nsmith1024 You can use the QuitApp() method in my previous comment. It is C#.

from unityplugin-avprovideo.

nsmith1024 avatar nsmith1024 commented on July 22, 2024

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.

stale avatar stale commented on July 22, 2024

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.

stale avatar stale commented on July 22, 2024

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.

Ste-RH avatar Ste-RH commented on July 22, 2024

Closing due to inactivity

from unityplugin-avprovideo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.