iOS – How to play a video with transparency?

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

EDIT: 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];
    }];
}

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

Leave a Comment