ios - 在 CGPath 或 UIBezierPath 内播放视频

标签 ios video uibezierpath clipping cgpath

是否可以将视频剪辑到自定义的 CGPath?我意识到 UIBezierPath 实际上只是一个包装器,但我出于熟悉的目的将其放入其中。

最佳答案

我不了解视频,但将 View 剪辑到路径的典型方法是创建一个CAShapeLayer,将其path设置为您想要的任何路径,然后使用该 CAShapeLayer 作为要剪辑的 View 的 layermask

例如,要制作某个 View 的圆形蒙版,您可以:

UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0)
                                                    radius:self.view.bounds.size.width * 0.4
                                                startAngle:0
                                                  endAngle:2.0 * M_PI
                                                 clockwise:YES];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [path CGPath];

self.myView.layer.mask = shapeLayer;

关于ios - 在 CGPath 或 UIBezierPath 内播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16745168/

相关文章:

ios - 如何在iOS客户端上将外部WebVTT字幕添加到HTTP Live Stream中

ios - NSJSONSerialization 无法从 URL 加载大型 json 数据

iphone - OSStatus 错误 - 12780 调用 insertTimeRange :ofTrack:atTime:error: of AVMutableCompositionTrack for the second time 时

ios - 如何在 iOS 中播放 .h264

ios - 裁剪 CGPathRef 或 UIBezierPath

swift - 部分 UIView 的屏幕截图被屏蔽为 UIBezierPath/CGPath

ios - 无法转换 FBSDKGraphRequestHandler 类型的值

ios - 如何在呈现 Controller 的顶部显示 UIAlertController

iphone - 如何使用 libavcodec (ffmpeg) 读取 http 视频流

swift - Swift 中的 UIBezierPath 描边(和填充)