Offscreen Rendering Guide
A cheat-sheet for offscreen rendering on iOS
To successfully initialize DeepAR in offscreen rendering mode, the initialization steps need to be done in the correct order.
Off-screen rendering iOS
Steps to take to do off-screen rendering (see iOS API documentation):
Create
DeepAR
objectcall
(void)setLicenseKey:(NSString)*
key to activate licence keyset the delegate of the
DeepAR
objectcall
(void)changeLiveMode:(BOOL)liveMode
; with false.call
(void)initializeOffscreenWithWidth:(NSInteger)width height:(NSInteger)height
feed the frames through
(void)processFrame:(CVPixelBufferRef)imageBuffer mirror:(BOOL)mirror
or(void)enqueueCameraFrame:(CMSampleBufferRef)sampleBuffer mirror:(BOOL)mirror
if you are using camera frames via AVFoundationrendered frames will be delivered through void
(void)frameAvailable:(CMSampleBufferRef)sampleBuffer
via theDeepARDelegate
.
Sample Swift initialisation code:
deepAr = DeepAR()
deepAr?.setLicenseKey("Your license key here!")
deepAr?.delegate = self
deepAr?.changeLiveMode(false)
deepAr?.initializeOffscreen(withWidth: 1080, height: 1920)
Sample ObjectiveC initialisation code:
self.deepAR = [[DeepAR alloc] init];
[self.deepAR setLicenseKey:@"Your license key here!"]; self.deepAR.delegate = self;
[self.deepAR changeLiveMode:NO];
[self.deepAR initializeOffscreenWithWidth:1080 height:1920];