Search Unity

Bug Video Cannot Resume

Discussion in 'Audio & Video' started by artfail, May 28, 2023.

  1. artfail

    artfail

    Joined:
    Apr 18, 2017
    Posts:
    34
    I am hitting a Bug, and I am trying to find a solution or a workaround. I am making a 360 video app in iOS. When users minimize the app and come back, the app crashes because the video player crashes do to the fact that iOS flushes the app memory and now unity cant access the video buffer. I have tried working around this by saving the video time, and stopping the video when the app is minimized and then playing and setting the video player time when the app is resumed. Unfortunately this also does not work as VideoPlayer.time usually fails. Is there a recommended way to resume a video?

    Notes:
    I have tried using prepare which hasn't worked. I have tried playing the video for a few seconds first which works sometimes but still fails often. It also seems like the larger the value of time, ie the further into the video Unity has to seek, the grater chance it will fail to so so.
    I am using Unity 2022.2.21
     
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    I will ask my colleague and come back to you.
     
  3. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    Hey, we would appreciate it if you could report the bugs. As for a workaround, making a seek before calling Play should do the trick. The order is important right now. It shouldn't and we are trying to improve it. Please let me know if it fixes your issue.
    Code (CSharp):
    1. VideoPlayer.clip = myclip;
    2. VideoPlayer.time = whatever;
    3. VideoPlayer.Play()
     
  4. artfail

    artfail

    Joined:
    Apr 18, 2017
    Posts:
    34
    Thank you. Ill give it a shot.
     
  5. artfail

    artfail

    Joined:
    Apr 18, 2017
    Posts:
    34
    The result of doing it this way is that setting the time is always ignored. The video plays from the beginning.

    VideoPlayer.time = mySavedTime; //has no effect
    VideoPlayer.Play();
    print(VideoPlayer.time); //prints 0