when playing a video inside a webview and looking at instruments – I see a high peak of memory usage when playing. (Around 23 MB in total)
As I leave the view (it is in a UINavigation view) all memory get cleared as it should. (using ARC)
IMPORTANT: I am loading the video from DISK and not loading it from server!
Question: Is there a way to reduce the memory when playing the video?
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
//
NSURLRequest *request = [[NSURLRequest alloc] initWithURL: videoURL cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 10.0];
[webView loadRequest: request];
[webView setOpaque:NO];

From your code it seems to me that you are trying to use an UIWebView as a video player, without displaying any other HTML content in it at the same time.
Even though this is quite possible, it is, as you have observed, not particularly efficient – a UIWebView will load all of it’s content into memory since it was made for displaying web pages.
A better solution would be to use Apple’s
MediaPlayerframework, namelyMPMoviePlayerControllerand/orMPMoviePlayerViewController.If you only need to playback fullscreen video, you should use
MPMoviePlayerViewController. Using it is simple:This will present a modal view controller containing your clip.
If you want to customize any part of it, you can use the
moviePlayerproperty.If you would rather display video inside another view, you should look into
MPMoviePlayerController.Using this class involves more boilerplate, but also gives you more control: