Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Android crash when VideoPlayer. stop() is executed

Discussion in 'Audio & Video' started by bx3776, Nov 16, 2022.

  1. bx3776

    bx3776

    Joined:
    Nov 25, 2014
    Posts:
    8
    I created a simple android video player application in unity2021.3.12. It played in URL mode. At first, everything was normal. But whenever I executed VideoPlayer When Stop(), the application always crashes, and the exception capture cannot catch stop(). However, if I use Unity2020.3.4 to export and run again, everything is normal and stop () performs well. What is the reason for this, or what needs to be done to stop normally when I use 2021.3.12?
     
    kazak_tm likes this.
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    375
    Can you check the logcat to see if you get an error?
     
  3. bx3776

    bx3776

    Joined:
    Nov 25, 2014
    Posts:
    8
    This is Log in Android Studio when Crashes

    Code (CSharp):
    1. 15:39:50.814  E  FATAL EXCEPTION: UnityMain
    2.                  Process: com.DefaultCompany.NewUnityProject, PID: 22291
    3.                  java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    4.                  Version '2021.3.12f1c2 (ffeb050254a0)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
    5.                  Build fingerprint: 'HUAWEI/NOH-AN00/HWNOH:10/HUAWEINOH-AN00/102.0.0.280C00:user/release-keys'
    6.                  Revision: '0'
    7.                  ABI: 'arm64'
    8.                  Timestamp: 2022-11-15 15:39:49+0800
    9.                  pid: 22291, tid: 23578, name: Background Job.  >>> com.DefaultCompany.NewUnityProject <<<
    10.                  uid: 10745
    11.                  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    12.                  Cause: null pointer dereference
    13.                      x0  0000000000000000  x1  00000000000035e6  x2  0000000070cf5c00  x3  0000000000000002
    14.                      x4  0000006fc03168f0  x5  0000006fc0316878  x6  0000000000000000  x7  002e00640069006f
    15.                      x8  ffffff80ffffffd8  x9  0000006fc0316720  x10 0000006fc0316750  x11 6975e3601bdf8c4d
    16.                      x12 0000006fc03167c0  x13 0069007400630065  x14 0000000000000000  x15 0000000000000000
    17.                      x16 00000070d96e8240  x17 00000070dbc27d60  x18 0000006ec89e0000  x19 0000006fc0317020
    18.                      x20 0000006fc0316878  x21 0000006fc03168f0  x22 000000704618e0a0  x23 0000000000000002
    19.                      x24 0000000000000000  x25 00000070d812ff10  x26 0000000000000000  x27 0000006e559ffa00
    20.                      x28 0000006fc0317020  x29 0000006fc03167b0
    21.                      sp  0000006fc0316690  lr  00000070d96048ac  pc  00000070d9580030
    22.                
    23.                  backtrace:
    24.                        #00 pc 0000000000116030  /system/lib64/libandroid_runtime.so (BuildId: e99b2e2e44982c12a4dc2e20fbdbab43)
    25.                        #01 pc 000000000019a8a8  /system/lib64/libandroid_runtime.so (BuildId: e99b2e2e44982c12a4dc2e20fbdbab43)
    26.                        #02 pc 00000000000587a8  /system/lib64/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+136) (BuildId: 5a8d1089356748819d9494d2f5f1a6bc)
    27.                        #03 pc 000000000004c248  /system/lib64/libmedia.so (BuildId: a5fb2fe9293e08ae66f184e85492ba2b)
    28.                        #04 pc 000000000015386c  /system/lib64/libstagefright.so (android::ClearMediaHTTP::disconnect()+120) (BuildId: 5a4b48048e1e8b9b7353781c2d32daf0)
    29.                        #05 pc 000000000015a8f4  /system/lib64/libstagefright.so (android::NuMediaExtractor::~NuMediaExtractor()+560) (BuildId: 5a4b48048e1e8b9b7353781c2d32daf0)
    30.                        #06 pc 000000000015aa84  /system/lib64/libstagefright.so (android::NuMediaExtractor::~NuMediaExtractor()+16) (BuildId: 5a4b48048e1e8b9b7353781c2d32daf0)
    31.                        #07 pc 000000000000f6e0  /system/lib64/libutils.so (android::RefBase::decStrong(void const*) const+112) (BuildId: d5e46e511fe7f84584dfbf4942e8ac28)
    32.                        #08 pc 000000000001ca3c  /system/lib64/libmediandk.so (BuildId: 0d818036e6ffc84aebc9fc15b84ac170)
    33.                        #09 pc 0000000000683d8c  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (AndroidVideoMedia<AndroidMediaNDK::Traits>::ThreadedCleanup()+76) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    34.                        #10 pc 0000000000630370  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    35.                        #11 pc 000000000025a550  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (JobQueue::Exec(JobInfo*, long long, int, bool)+104) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    36.                        #12 pc 000000000025a880  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (JobQueue::ExecuteJobFromHighPriorityStack(bool)+64) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    37.                        #13 pc 000000000025aabc  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (JobQueue::ProcessJobs(JobQueue::ThreadInfo*, void*)+244) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    38.                        #14 pc 0000000000259ef4  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (JobQueue::WorkLoop(void*)+264) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    39. 15:39:50.815  E        #15 pc 000000000037e018  /data/app/com.DefaultCompany.NewUnityProject-CF2a5wKHwMyAFz_Je-BoNw==/lib/arm64/libunity.so (Thread::RunThreadWrapper(void*)+796) (BuildId: 8a868e4da224b6ab33c604054b12818128870df5)
    40.                        #16 pc 00000000000cf7c0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: b91c775ccc9b0556e91bc575a2511cd0)
    41.                        #17 pc 00000000000721a8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: b91c775ccc9b0556e91bc575a2511cd0)
    42.                
    43.                      at libandroid_runtime.0x116030(Native Method)
    44.                      at libandroid_runtime.0x19a8a8(Native Method)
    45.                      at libbinder.android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)(transact:136)
    46.                      at libmedia.0x4c248(Native Method)
    47.                      at libstagefright.android::ClearMediaHTTP::disconnect()(disconnect:120)
    48.                      at libstagefright.android::NuMediaExtractor::~NuMediaExtractor()(~NuMediaExtractor:560)
    49.                      at libstagefright.android::NuMediaExtractor::~NuMediaExtractor()(~NuMediaExtractor:16)
    50.                      at libutils.android::RefBase::decStrong(void const*) const(decStrong:112)
    51.                      at libmediandk.0x1ca3c(Native Method)
    52.                      at libunity.AndroidVideoMedia<AndroidMediaNDK::Traits>::ThreadedCleanup()(ThreadedCleanup:76)
    53.                      at libunity.0x630370(Native Method)
    54.                      at libunity.JobQueue::Exec(JobInfo*, long long, int, bool)(Exec:104)
    55.                      at libunity.JobQueue::ExecuteJobFromHighPriorityStack(bool)(ExecuteJobFromHighPriorityStack:64)
    56.                      at libunity.JobQueue::ProcessJobs(JobQueue::ThreadInfo*, void*)(ProcessJobs:244)
    57.                      at libunity.JobQueue::WorkLoop(void*)(WorkLoop:264)
    58.                      at libunity.Thread::RunThreadWrapper(void*)(RunThreadWrapper:796)
    59.                      at libc.__pthread_start(void*)(__pthread_start:36)
    60.                      at libc.__start_thread(__start_thread:64)
     
  4. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    375
    Can you tell me your android API version? Is your phone using API 31 or 32? In any case, it is a crash in Unity, so I would open a bug report so we can investigate. Make sure you provide the logcat with it. After opening it, paste the ticket number here so I help the QA a little bit.
     
  5. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Just upgrade your Unity to 2022.1.23f1
    Unity 2021 series has that bug that’s crashes apk on start or in between functions… Save yourself the stress
     
    The_Island likes this.
  6. World_Familiar

    World_Familiar

    Joined:
    Jul 3, 2017
    Posts:
    2
    Any other progress?
    Has it been fixed?
     
  7. World_Familiar

    World_Familiar

    Joined:
    Jul 3, 2017
    Posts:
    2
    I also encountered the same bug , my phone's android is using API 31 .
     
  8. flintcheeze

    flintcheeze

    Joined:
    Sep 10, 2015
    Posts:
    80
    Apk crash on start fix!
    Delete all android resolved library
    It will work
    But I highly recommend you should delete the libraries little by little till you have a playable apk
    The crash is as a result of duplicate aar and plugins which Unity ignores on build
     
  9. ThisIsDangerous

    ThisIsDangerous

    Joined:
    Dec 3, 2018
    Posts:
    37
    2021.3.13f1 crashes on videoPlayer.Stop() in Android too. Will upgrade to the latest LTS in hopes the bug is fixed there. Will report back here.
     
  10. ThisIsDangerous

    ThisIsDangerous

    Joined:
    Dec 3, 2018
    Posts:
    37
    Nope, 2021.3.16f1 (current LTS) still has the bug. A shame.
     
    rulu420 likes this.
  11. kazak_tm

    kazak_tm

    Joined:
    Sep 7, 2021
    Posts:
    12
  12. kazak_tm

    kazak_tm

    Joined:
    Sep 7, 2021
    Posts:
    12
    In my test project I use only XR Interaction Toolkit, XR Plugin Manager and Open XR. Crashes start after installing these plugins.
     
  13. rulu420

    rulu420

    Joined:
    Apr 15, 2013
    Posts:
    2
    Android crash when VideoPlayer. stop() is executed . I am also facing the same issue in 2021.3.16f1. This doesn't happen in Editor but on Android it does.

    Minimum API level 24

    Target API Level 29/31

    Tried Unity 2022.2.0f1 : It didn't crash for a couple of builds but then all builds started crashing on VideoPlayer.stop()
     
    Last edited: Dec 29, 2022
  14. ehudcandivore

    ehudcandivore

    Joined:
    Jul 18, 2018
    Posts:
    10
    Happens to me as well... Is there a workaround? Video playback is simply broken on the 2021.3 LTS release?
     
  15. KinuxUnity

    KinuxUnity

    Joined:
    Dec 4, 2015
    Posts:
    8
    same bug , same stack trace on android emulator
     
  16. N7Nico

    N7Nico

    Joined:
    Sep 1, 2017
    Posts:
    3
    Same bug and problem for me too... :/
     
  17. kazak_tm

    kazak_tm

    Joined:
    Sep 7, 2021
    Posts:
    12
    Response from the Unity QA team: "We actually know about this issue and you can check the status here: https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-20661 There are fixes Under Consideration for 2021.3, 2022.2, 2023.1 Streams Please reach out to me if I can answer any questions or be of further help."
     
  18. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    375
    Yeah, sorry for the long delay in our response. Most people on the team came back last week. I just pushed the fix on 2023 that fix this issue https://issuetracker.unity3d.com/is...g-the-source-url-of-a-video-player-in-android. I am waiting for it to land in 2023. After that, it should get backported relatively quickly as it is a high priority.

    There is a lot of people here so I am not sure if you all have the same issue. Your log should look like @bx3776. If you have something else then it is maybe another bug. You can check with ADB, Android Log Cat package or Android Studio
     
    Last edited: Jan 17, 2023
    ThisIsDangerous likes this.
  19. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    29
    Crashing for me on Android after updating from 2020.3.32 to 2020.3.43, which I thought would be safe.
    Crash happens when calling player.Stop() on a VideoPlayer with a url source. Destroying the GameObject with the VideoPlayer also crashes. Pause() seems to behave but user cannot get past the video without crashing.

    Any known workarounds?
     
  20. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    375
    The only thing you can do right now is to take a slightly older Unity version. You should be safe using an older version than 2022.1.21f1, 2021.3.12f1 and 2020.3.43f1. It is where the regression was introduced. So @shochet, I would downgrade to 2020.3.42f1 if you can.
     
    shochet likes this.
  21. soundleaders

    soundleaders

    Joined:
    Jan 21, 2019
    Posts:
    1
    2021.3.16f1 is too, video player scene -> move other scene after crash or set video player Stop() (null pointer, android, !!! only url used !!!)
    [use macbook pro m1, ventura 13.0, unity 2021.3.16f1, il2cpp build, target api 33]
     
    Last edited: Jan 19, 2023
  22. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    29
    Thanks for the note. Downgrading to 2020.3.42f1 indeed fixed the crash. Perhaps there should be a known issue listed for this in .43 release notes - would have saved some effort here.
     
  23. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    29
    Update - while downgrading my test project fixed the crash, downgrading our actual production project created 999+ Package Manager errors every time the project loads or when hitting play.

    @The_Island have you ever seen this before? I've never downgraded Unity versions before. Already tried deleting the project Library folder and reimporting - did not help. I'm not finding much help for these errors elsewhere in the forums. Any ideas would be appreciated. The .md and .cs files sure look ok to me on disk though they are not XML files.

    upload_2023-1-19_16-32-5.png