I have a strange problem with MediaPlayer or AVFoundation. At some random point in the app, it stops working. With MPMoviePlayerViewController for instance it is automatically dismissed without playing the movie; with [AVURLAsset URLAssetWithURL:movieURL options:nil];
it returns nil.
The thing is that when I close the app, also from the OS background, and restart it, it will start working again.
My question is if why does it happen, or if it is a way of reset something so it could start working again. Thanks.
I have a strange problem with MediaPlayer or AVFoundation. At some random point in
Share
Hard to tell without seeing any code, but, if
[AVURLAsset URLAssetWithURL:movieURL options:nil];is returning nil, then my guess would be that movieURL is no longer valid.How are you creating movieURL? How are you releasing it?
My suggestion is to set a breakpoint where you call
[AVURLAsset URLAssetWithURL:movieURL options:nil];and check the value for movieURL. I am willing to be that it will be nil when the movie fails to load.