0
저는 ios에 익숙하지 않습니다. 가로보기에서 비디오를위한 thumnail을 만들고 싶습니다. thumnail 비디오를 두드리면 필자는 paly.i를 생성해야합니다. 그러나 custum 플레이어를 만들었지 만 수평 thgumbnail을 만들 수 없습니다.비디오를위한 thumnail 만들기 및 클릭시 비디오 재생
저는 ios에 익숙하지 않습니다. 가로보기에서 비디오를위한 thumnail을 만들고 싶습니다. thumnail 비디오를 두드리면 필자는 paly.i를 생성해야합니다. 그러나 custum 플레이어를 만들었지 만 수평 thgumbnail을 만들 수 없습니다.비디오를위한 thumnail 만들기 및 클릭시 비디오 재생
당신은 노호 코드를 사용하여 비디오의 썸네일을 만들 수 있습니다
-(UIImage *)getThumbNail:(NSString*)stringPath // string path is a path of you video file
{
NSURL *urlvideoImage =[NSURL fileURLWithPath:stringPath];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:urlvideoImage options:nil];
AVAssetImageGenerator *generateImg = [[AVAssetImageGenerator alloc] initWithAsset:asset];
NSError *error = NULL;
CMTime time = CMTimeMake(1, 65);
CGImageRef refImg = [generateImg copyCGImageAtTime:time actualTime:NULL error:&error];
NSLog(@"error==%@, Refimage==%@", error, refImg);
UIImage *FrameImage= [[UIImage alloc] initWithCGImage:refImg];
//
return FrameImage;
}
덕분에 내가 thumnail를 얻었으나, 내 imageview.i이 코드를 사용했습니다에 이미지가 맞지 dosenot : - [있는 ScrollView ALLOC] initWithFrame : CGRectMake (0, 0, _movieView.bounds.size.width, _movieView.bounds. size.height)] – apple10
설정 이미지보기 모드 포함 : yourImageview.contentMode = UIViewContentModeScaleAspectFit; –