ReplayKit Video Freeze

Hello,

The output video freezes for the first few seconds, this happens around 40% of screen recording. Sometimes it happens the first time i record, but in general the freeze is very random. I tested my code on all iOS 9+ and different devices.

I am using cocos2d.

here is my code:


(RPScreenRecorder* recorder) global variable
  recorder=nil;
    recorder =  RPScreenRecorder.sharedRecorder;
    recorder.delegate=self;

To start Recording

recorder.microphoneEnabled=NO;
        [recorder startRecordingWithHandler:^(NSError *error){
            if(error)
            {
               ......
            }
            else
            {
               Start animations....
            }
        }];



To stop Recording

-(void)StopRecording
{
    [recorder stopRecordingWithHandler:^(RPPreviewViewController * previewViewController,
                                         NSError * error) {
        if(previewViewController)
        {
            [self.delegate StopedRecording];
            previewViewController.previewControllerDelegate = self;
            previewViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
            [[CCDirector sharedDirector] presentViewController:previewViewController animated:YES completion:nil];
        }
        if(error)
        {
           .....
        }
    }];
}
- (void)previewControllerDidFinish:(RPPreviewViewController *)previewController
{
    [[CCDirector sharedDirector] dismissViewControllerAnimated:YES completion:nil];
   ....
}
- (void)screenRecorder:(RPScreenRecorder *)screenRecorder didStopRecordingWithError:(NSError *)error previewViewController:(nullable RPPreviewViewController *)previewViewController;
{
    ...
}


i use Open AL for sound output. The sound doesn't freeze.

Any suggestions?

ReplayKit Video Freeze
 
 
Q