我想知道有没有办法强制replaykit在正方形模式下只录制屏幕的一部分?当前的API似乎记录了整个屏幕!
发布于 2017-02-08 19:14:56
ReplayKit将所有内容记录在屏幕上,免除系统提示和对话框。
但是,您可以将另一个UIWindow覆盖在您的主UIView之上,并对一个空的and应用一个掩码,以隐藏屏幕的某些部分并强制进行正方形录制。
尽管如此,最终录制的帧比率仍将等于屏幕。
_overlayWindow = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; //Full sized window
_overlayWindow.backgroundColor = [UIColor clearColor];
_overlayWindow.userInteractionEnabled = false;
_overlayWindow.hidden = NO;
UIView *maskedView = [[UIView alloc] initWithFrame:_overlayWindow.bounds];
// Create a mask layer
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
CGRect maskRect = CGRectMake(0, 0, 200, 200);
// Create a path with the rectangle in it.
CGPathRef path = CGPathCreateWithRect(maskRect, NULL);
maskLayer.path = path;
// Set the mask of the view.
maskedView.layer.mask = maskLayer;
[_overlayWindow addSubview:maskedView];发布于 2016-01-01 17:44:22
目前,ReplayKit框架不提供屏幕尺寸方面的屏幕录制定制。所以你必须录下整个屏幕的GamePlay。
https://stackoverflow.com/questions/34554954
复制相似问题