码迷,mamicode.com
首页 > 其他好文 > 详细

第37月第29天 avplayer截屏

时间:2019-10-29 15:35:28      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:put   with   equal   copy   iphone6   turn   mod   col   iphone8   

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;
}

 

http://darktechlabs.com/2016/07/15/iOS-%E5%B0%8F%E5%9D%91%E8%AE%B0%E5%BD%95%EF%BC%9A%E5%A6%82%E4%BD%95%E7%BB%99-AVPlayer-%E6%88%AA%E5%9B%BE/

 

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截屏

标签:put   with   equal   copy   iphone6   turn   mod   col   iphone8   

原文地址:https://www.cnblogs.com/javastart/p/11758849.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!