Trouble playing video from asset catalog

I am currently trying to take advantage of app thinning via the asset catalog. I am slicing videos so that only the appropriate sized video for the users deivce gets installed. That part seems to be working just fine.


The trouble I have run into is connecting the dots between getting that video out of the asset catalog and into an AVPlayer.

1. AVPlayer, AVPlayerItem, and AVAsset all seem to expect a URL to the video in order to play the content.

2. The only way to get my video out of the catalog is by using NSDataAsset, which does not provide a URL.


The only solution I have found so far (which feels like a terrible hack) is to create a URL to some location on disk, and then write the dataAsset.data to that URL. From there I can use any of the AV object APIs to provide content to the player. One of the drawbacks there is that now I have 2 copies of the video, one in the catalog and one on disk, which seems to defeat some of the purpose of app slicing.


I can only hope I have just missed something in the documentation. Does anyone have a better way to connect the dots between a video in the asset catalog and loading it into a player?

I have this exact question. Did you find a solution that doesn't duplicate the videos?
Trouble playing video from asset catalog
 
 
Q