I need to capture a screenshot of the video being played in the mpmovieplayer controller, but all I get is a red screen (I made a coverView with a red background and 0.5 alpha).
Here is the code:
NSArray *windows = [[UIApplication sharedApplication] windows]; if ([windows count] > 1) { UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow]; UIView *coverView = [[UIView alloc] initWithFrame:moviePlayerWindow.bounds]; [mainController.moviePlayer pause]; //Without that it won't work either! coverView.backgroundColor = [UIColor redColor]; coverView.alpha = 0.5; [moviePlayerWindow addSubview:coverView]; UIGraphicsBeginImageContext(coverView.bounds.size); [coverView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenShot; screenShot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(screenShot, self, nil, nil); }
Any ideas ???
thanks
I myself was curious. I believe there are similar problems with screenshots from OpenGL material.
If you look at this blog post http://getsetgames.com/2009/07/30/5-ways-to-take-screenshots-of-your-iphone-app/ , they have a method that works for EAGLView it may be worth it go for your problem.
:
, , , , . , , , .
MPMoviePlayerController , UIImage , .
- (UIImage *)thumbnailImageAtTime:(NSTimeInterval)playbackTime timeOption:(MPMovieTimeOption)option
, , bingo, UIImage.
, , mpmovieplayer. , , , , -, .
, , ? .
It looks like you are shooting a video overlay mask http://en.wikipedia.org/wiki/Hardware_overlay
Source: https://habr.com/ru/post/1724935/More articles:Частичный просмотр рендеринга по условию - asp.net-mvcHow to create crosstab SQL query with Django ORM? - sqlCharacter in PHP I've never encountered before - phpBest approach for thread synchronization queue - multithreadingПочему исключение exception.getCause() ==? - javaZend_Form For canceling the default decorators - phppreopulate MVC Models with IOC - an alternative to caching? - asp.net-mvcLisp the difference between (cons' a (cons' b 'c)) and (cons' a' (bc)) - lispКак git svn извлечь старую историю? - gitWhy do some .Net exceptions end with a newline - .netAll Articles