Search Unity

iOS only crash related to the VideoPlayer component

Discussion in 'Getting Started' started by TylerJay-B, Feb 24, 2023.

  1. TylerJay-B

    TylerJay-B

    Joined:
    Dec 29, 2018
    Posts:
    18
    I had posted a build of my app to TestFlight previously with the VideoPlayer Component included with all the same functionality which worked fine.

    However, I am experiencing a crash when entering my cinematic scene with the video player that uses Prepare() and then Play() when prepared.

    I commented all the VideoPlayer code, including prepare and play functions and all works fine in TestFlight.

    I suppose what I'm wondering is, is there anything in this code or related to video files which would cause TestFlight iOS build to crash?

    EDIT: The crash happens immediately, you don't even get to see the scene.

    controller.LoadScene(); is just a SceneManager.LoadScene(sceneId);
    TurnOnProjector/TurnOffProjector(); are just gameObject.SetActive(bool);


    Code (CSharp):
    1.     private async void SetupProjector()
    2.     {
    3.         video.Prepare();
    4.  
    5.         await Task.Delay((int)(delayForProjector * 1000));
    6.  
    7.         if (Application.isPlaying)
    8.         {
    9.             while (!video.isPrepared) await Task.Yield();
    10.  
    11.             if (Application.isPlaying)
    12.             {
    13.                 video.Play();
    14.  
    15.                 videoRawImage.enabled = true;
    16.  
    17.                 zooming = true;
    18.  
    19.                 TurnOnProjector();
    20.  
    21.                 while (video.isPlaying) await Task.Yield();
    22.  
    23.                 if (Application.isPlaying)
    24.                 {
    25.                     TurnOffProjector();
    26.  
    27.                     videoRawImage.enabled = false;
    28.  
    29.                     controller.LoadScene();
    30.                 }
    31.             }
    32.         }
    33.  
    34.         void TurnOnProjector()
    35.         {
    36.             projectorRays.SetActive(true);
    37.         }
    38.  
    39.         void TurnOffProjector()
    40.         {
    41.             projectorRays.SetActive(false);
    42.         }
    43.     }
     
    Last edited: Feb 25, 2023