How to set a transparent background for an AVVideoComposition?

喜夏-厌秋 提交于 2019-12-03 15:47:42

In Apple's documentation for AVVideoCompositionInstruction the property you want to set, backgroundColor, is of type CGColorRef.

My bet is, because you are setting backgroundColor with UIColor and only then getting the value of it through the CGColor property, for some reason the alpha value doesn't get passed into a CGColorRef object. You know the white value gets passed because the default color is black.

UIColor has some limitations. I suggest you read the following article. Take particular notice of the section "The problems with UIColor" of the article.

I'm guessing the best solution for your problem is defining backgroundColor with CGColor directly (use CGColorCreate, for instance), instead of UIColor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!