如何在点击按钮时更改AVSampleBufferDisplayLayer的视频重力?

时间:2019-02-01 05:50:39

标签: ios objective-c avplayerlayer

我有此配置文件:

_sampleBufferLayer = [[AVSampleBufferDisplayLayer alloc] init];
_sampleBufferLayer.videoGravity = AVLayerVideoGravityResizeAspect;
[videoArea.layer addSublayer:_sampleBufferLayer];

- (IBAction)changeAspectRatio:(UIButton *)sender {
    NSLog(@"Ratio Button tapped;");
    _sampleBufferLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
    [videoArea layoutIfNeeded];
    [videoArea setNeedsLayout];

}

它应该立即更改视频重力,但它什么也没做。有帮助吗?

0 个答案:

没有答案