RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

NSRangeException when opening multiple videos #1848

Closed adrianplapamaruintenselife closed 1 month ago

adrianplapamaruintenselife commented 1 month ago

When opening multiple videos using mediaPlayer.OpenMedia(new MediaPath(url, MediaPathType.AbsolutePathOrURL), isFirstVideo); I have this exceptipm

AVPPluginGetCachedMediaStatusForURL
NSRangeException - *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array
Fatal Exception: NSRangeException
0  CoreFoundation                 0xec678 (Missing UUID 5a6c1f41bf7032f6a1d65b894dd21362)
1  libobjc.A.dylib                0x2bc80 objc_exception_throw
2  CoreFoundation                 0xf7ae4 (Missing UUID 5a6c1f41bf7032f6a1d65b894dd21362)
3  libswiftCore.dylib             0x134a0 (Missing UUID 496d989cd1d93db8ba7c8f2d16215c1d)
4  UnityFramework                 0x3caab7c AVPPluginGetCachedMediaStatusForURL
5  UnityFramework                 0x3c9383c AVPPluginGetCachedMediaStatusForURL
6  UnityFramework                 0x3c913b1 AVPPluginGetCachedMediaStatusForURL
7  UnityFramework                 0x3cab7dd AVPPluginGetCachedMediaStatusForURL
8  UnityFramework                 0x3cade51 AVPPluginGetCachedMediaStatusForURL
9  UnityFramework                 0x3cc0d01 AVPPluginGetCachedMediaStatusForURL
10 UnityFramework                 0x3cadfc5 AVPPluginGetCachedMediaStatusForURL
11 libswift_Concurrency.dylib     0x49a41 (Missing UUID 51d41f8acf113af689efc1acce7c833b)

To Reproduce

  1. Open multiple videos (looping is enabled)
  2. Playing only one switching between them after 2-4 seconds
Chris-RH commented 1 month ago

Are you using Firebase? How many videos are you playing? How many videos are playing at any one time? Are you always going to be playing them in the same order or is it random? Do you have the same issue when you play longer videos? How are you switching between videos?

adrianplapamaruintenselife commented 1 month ago

Are you using Firebase? Yes

How many videos are you playing? About 10

How many videos are playing at any one time? Only one

Are you always going to be playing them in the same order or is it random? I have a circular scroll view

Do you have the same issue when you play longer videos? I don't know.

How are you switching between videos? I have a circular scroll view. At a time I have 3 open videos and only one playing.

Chris-RH commented 1 month ago

Can you see if you can replicate this in a new project using only AVPro Video (no Firebase etc)?

adrianplapamaruintenselife commented 1 month ago

I wasn't able to reproduce this issue in a new project (no Firebase).

Chris-RH commented 1 month ago

Try adding Firebase to that new project and see if the issue occurs, please?

adrianplapamaruintenselife commented 1 month ago

With Firebase, the issue occurs. Terminating app due to uncaught exception 'NSRangeException', reason: ' -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array' *** First throw call stack: (0x19a58ab28 0x1923e6f78 0x19a595ff4 0x198dc309c 0x109d45600 0x109d2e2c0 0x109d2be35 0x109d46261 0x109d488d5 0x109d5b785 0x109d48a49 0x1a5832775)

adrianplapamaruintenselife commented 1 month ago

I removed firebase just to test it again and the crash occurs after a longer time than with firebase.

Chris-RH commented 1 month ago

Could you retest in a new project, rather than one that has had Firebase in it, please?

adrianplapamaruintenselife commented 1 month ago

I made a new project without Firebase and reproduce the issue. The issue occurs without Firebase.

adrianplapamaruintenselife commented 1 month ago

Does the last update from asset store fix this issue? I observed there is an update from 10 May. Thanks!

Chris-RH commented 1 month ago

Hi, no we would post here to let you know if it was fixed

  1. Could you try playing longer videos and see if the issue still occurs?
  2. Could you try using the playlist component to switch between videos?
  3. If you are playing the videos in the same order, could you try putting them together in one file?
adrianplapamaruintenselife commented 1 month ago

Hello! We found a solution for this issue. We use cache and the app no longer crash. On the previous version of AVProVideo we had an issue with the cache (first video stops after 5-6 seconds), so we removed caching. But now everything is ok! Thank you!.