Simple webView and memory video

when playing videos in web browsing and searching for tools - I see a high level of memory usage when playing. (Total about 23 MB)

When I leave the view (it is in the UINavigation view), all memory is cleared as it should. (using ARC)

IMPORTANT : I am downloading a video from DISK and not downloading it from the server!

Question: Is there a way to reduce the amount of memory when playing a 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];

enter image description here

+5
source share
1 answer

From your code, it seems to me that you are trying to use UIWebView as a video player without displaying other HTML content in it at the same time.

, , , , - UIWebView , -.

Apple MediaPlayer, MPMoviePlayerController / MPMoviePlayerViewController.

, MPMoviePlayerViewController. :

MPMoviePlayerViewController *vc = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[self presentMoviePlayerViewControllerAnimated:vc];
[vc release];

, . , moviePlayer.

, MPMoviePlayerController. , :

MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[player prepareToPlay];
player.view.frame = contentView.bounds; //The Player View Frame must match the Parent View's
// ...
[player play];
+1

All Articles