2

I merge two videos side by side in sequence mode by using AVMutableComposition, play two videos one after another, I can do this successfully. My problem is that while Playing the first video, the second video screen will display a blank screen until it completes the first video. Can anyone give me a solution to show the thumbnail image of the second video while playing the first one?

Augustine
  • 1,714
  • 1
  • 17
  • 21

2 Answers2

0

Have you tried using https://developer.apple.com/library/mac/documentation/AVFoundation/Reference/AVAssetImageGenerator_Class/Reference/Reference.html and just a plain UIImageView containing the Thumbnail?

Tim Specht
  • 3,068
  • 4
  • 28
  • 46
  • This is to take thumbnail image from a video, My task is to show thumbnail while merging two videos side by side in sequence mode, and want show thumbnail on second video while playing first video. – Raees Valapuram Madathil Nov 29 '13 at 12:31
  • yeah so whats the problem with generating the thumbnail from the start of the second video and putting it over the space where the second video is supposed to play until the first video finished and then removing the overlaid thumbnail? – Tim Specht Nov 29 '13 at 15:53
  • I cant insert thumbnail on video for a specific time range.When I put thumbnail over the space where the second video is supposed to play as overlay, It hide the second video through out. Please help me to putt thumbnail for a specific time range. – Raees Valapuram Madathil Dec 02 '13 at 04:03
  • wow it really seems you took exactly 1 second to view the documentation. You generate the thumbnail, overlay it over the second video. Once the AVPlayer which plays the first video notifies you that it finished you set mySecondOverlayImageView.hidden = YES; and tell the second AVPlayer to start playing. Thats all you have to do! – Tim Specht Dec 02 '13 at 08:16
0

We can display the thumbnail image on the video by using the following code.

CALayer *firstThumbnailOverlay=[CALayer layer]; 
CABasicAnimation *firstfadeAnimation;

firstfadeAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];

firstfadeAnimation.fromValue = [NSNumber numberWithFloat:1.0];
firstfadeAnimation.toValue = [NSNumber numberWithFloat:0.0];
firstfadeAnimation.additive = NO;
firstfadeAnimation.removedOnCompletion = NO;
firstfadeAnimation.beginTime = CMTimeGetSeconds(firstAsset.duration);
firstfadeAnimation.duration = 0.0;
firstfadeAnimation.fillMode = kCAFillModeBoth;
[firstThumbnailOverlay addAnimation:firstfadeAnimation forKey:Nil];
[parentLayer addSublayer:firstThumbnailOverlay];