AVPlayerItem File Permission Error

Lately i've been getting a strange error that is attached to the currentIem property of my AVPlayer object.


When changing from one playerItem to the next i load up the AVURLAsset asynchronously and setup the playerItem once it has loaded the asset.

The AVPlayer's currentItem is replaced with the new one and occassionally I will get a AVPlayerStatusFailed on the playerItem. The Error has a domain of NSCocoaErrorDomain and a code 257 stating "The file couldn't be opened because you don't have permission to view it.". I can then try the process again for the same file and it will work.


Anyone else get that kind of error on the AVPlayerItem? Seems bizarre considering it works if you try it again. Files are stored in the app. The app shouldn't have a problem accessing files. Any tips welcome, thanks.

Replies

Problem went away by adding a slight delay between load of next episode. Strange

can you share code