9+ (void)registerWithRegistrar:(nonnull NSObject<FlutterPluginRegistrar>*)registrar {
10 NSObject<FlutterTextureRegistry>* textureRegistry = [registrar textures];
12 int64_t textureId = [textureRegistry registerTexture:texture];
13 [NSTimer scheduledTimerWithTimeInterval:0.05
15 block:^(NSTimer* _Nonnull timer) {
16 [textureRegistry textureFrameAvailable:textureId];
25 return [
self pixelBuffer];
28- (CVPixelBufferRef)pixelBuffer {
29 NSDictionary* options = @{
31 (NSString*)kCVPixelBufferMetalCompatibilityKey : @YES
33 CVPixelBufferRef pxbuffer = NULL;
34 CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, 200, 200, kCVPixelFormatType_32BGRA,
35 (__bridge CFDictionaryRef)options, &pxbuffer);
37 NSAssert(status == kCVReturnSuccess && pxbuffer != NULL,
@"Failed to create pixel buffer.");
CVPixelBufferRef _Nullable copyPixelBuffer()