第37月第29天 avplayer截屏
Posted javastart
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第37月第29天 avplayer截屏相关的知识,希望对你有一定的参考价值。
1.
- (void)displayLinkCallback:(CADisplayLink *) sender{ CMTime time = [snapshotOutput itemTimeForHostTime:CACurrentMediaTime()]; if ([snapshotOutput hasNewPixelBufferForItemTime:time]) { lastSnapshotPixelBuffer = [snapshotOutput copyPixelBufferForItemTime:time itemTimeForDisplay:NULL]; } } - (UIImage *)snapshotImage { if (lastSnapshotPixelBuffer) { CIImage *ciImage = [CIImage imageWithCVPixelBuffer:lastSnapshotPixelBuffer]; CIContext *context = [CIContext contextWithOptions:NULL]; CGRect rect = CGRectMake(0, 0, CVPixelBufferGetWidth(lastSnapshotPixelBuffer), CVPixelBufferGetHeight(lastSnapshotPixelBuffer)); CGImageRef cgImage = [context createCGImage:ciImage fromRect:rect]; return [UIImage imageWithCGImage:cgImage]; } return NULL; }
2.
if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([platform isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([platform isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([platform isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([platform isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
https://www.jianshu.com/p/d77f94c9d9f3
https://www.theiphonewiki.com/wiki/Models
以上是关于第37月第29天 avplayer截屏的主要内容,如果未能解决你的问题,请参考以下文章