Hi all,
I'm trying to create a videoplayer component, which loads 2 videos (an intro and outro video).
The goal is that the intro video plays, when the video is done, a InfoPopup is shown, and when you close the InfoPopup, the outro video plays (the video is a 3D animation which zooms in on a product and then zooms back).
I've already made it work. But I'm wondering if I'm doing it right, because the docs on Apple aren't that clear to me right now.
This is what I've done:
- Create an intro and outro AVURLAsset
- Listen to loadValuesAsynchronouslyForKeys on the intro and outro asset
- When both assets are loaded, I have an intro and an outro AVPlayerItem which I set
- I create an AVPlayer instance and set its AVPlayerItem to the intro
- I listen when the intro video is done, and show the popup
- I listen to the close action on the popup
- I change the AVPlayer's asset by using [self.player replaceCurrentItemWithPlayerItem:self.outroItem];
This all works ... but when i check my memory it just skyrockets!
Is there a way to remove the memory for each video when they are done?
Also is there not a way to work with 1 AVPlayerItem which holds the 2 videos (with those 'tracks' they talk about?)
Thnx in advance,
Frederik