本文介绍了iOS - 如何播放透明的视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我录制了一个蓝屏视频.我们有将视频转换为透明背景的软件.在自定义 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?

推荐答案

不知道除了我还有没有人对此感兴趣,但我正在使用 GPUImage 和 Chromakey 过滤器来实现这一点^^ https://github.com/BradLarson/GPUImage

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

这篇关于iOS - 如何播放透明的视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 13:33