[英]Remove Image of First Frame of Video in UIImageView before playing video in MPMoviePlayerController
I have a video which gets played in a MPMoviePlayerController. 我有一个在MPMoviePlayerController中播放的视频。 I have set the background color of the MPMoviePlayerController to clearColor.
我已经将MPMoviePlayerController的背景色设置为clearColor。
In order to display the first frame of the given video, I am using a UIImageView below the MPMoviePlayerController to display the first frame. 为了显示给定视频的第一帧,我正在MPMoviePlayerController下面使用UIImageView来显示第一帧。
When the user clicks on the play button, I remove the given image from the super view using the following code inside the method moviePlaybackStarted: 当用户单击播放按钮时,我使用moviePlaybackStarted方法中的以下代码从超级视图中删除了给定的图像:
[imageView removeFromSuperview];
This I have put inside a Notification method, for which I have used the following code. 我已将其放入Notification方法中,并为此使用了以下代码。
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackStarted:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:self.videoPlayer];
The problem is that, when I remove the UIImage from the imageView object, there appears a black screen before the movie starts playing. 问题是,当我从imageView对象中删除UIImage时,在电影开始播放之前会出现黑屏。
If I dont remove the imageView object from the superview, then that black screen does not appear. 如果我不从超级视图中删除imageView对象,则不会出现黑屏。 But I have to remove it from the superview.
但是我必须将其从超级视图中删除。
Where should I remove the imageView from the superview so that I do not get the black screen before the video starts playing. 我应该从超级视图中删除imageView,以便在视频开始播放之前不会出现黑屏。 Please help.
请帮忙。
Actully u wanna to cahnge the background image not the image view , so u have to set the different image over imageView at different conditions. 实际上,您想更改背景图像而不是图像视图,因此必须在不同的条件下在imageView上设置不同的图像。 by this way ur background image will not look black.
通过这种方式,您的背景图片不会看起来很黑。 like:
喜欢:
[imgView setImage:[UIImage imageNamed:@"img1.png"]]; [imgView setImage:[UIImage imageNamed:@“ img1.png”]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.