问题描述
我用蓝屏录制了一段视频。我们有将该视频转换为透明背景的软件。在自定义UIView上覆盖这个视频的最佳方式是什么?每当我在iPhone上看到视频时,它总会启动该播放器界面。有什么方法可以避免这种情况吗?
I recorded a video with a bluescreen. We have the software to convert that video to a transparent background. What's the best way to play this video overlaid on a custom UIView? Anytime I've seen videos on the iPhone it always launches that player interface. Any way to avoid this?
谢谢!
推荐答案
Don'我知道除了我之外是否还有人对此感兴趣,但我正在使用GPUImage和Chromakey过滤器来实现这一点^^
Don't know if anyone is still interested in this besides me, but I'm using GPUImage and the Chromakey filter to achieve this^^ https://github.com/BradLarson/GPUImage
编辑:我所做的示例代码(现在可能已过时):
example code of what I did (may be dated now):
-(void)AnimationGo:(GPUImageView*)view {
NSURL *url = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"mov"];
movieFile = [[GPUImageMovie alloc] initWithURL:url];
filter = [[GPUImageChromaKeyBlendFilter alloc] init];
[movieFile addTarget:filter];
GPUImageView* imageView = (GPUImageView*)view;
[imageView setBackgroundColorRed:0.0 green:0.0 blue:0.0 alpha:0.0];
imageView.layer.opaque = NO;
[filter addTarget:imageView];
[movieFile startProcessing];
//to loop
[imageView setCompletionBlock:^{
[movieFile removeAllTargets];
[self AnimationGo:view];
}];
}
我可能不得不稍微修改一下GPUImage,它可能无法使用最新版本的GPUImage,但这就是我们使用的
I may have had to modify GPUImage a bit, and it may not work with the latest version of GPUImage but that's what we used
这篇关于iPhone SDK - 如何播放透明视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!