可以更改AVPlayer的背景颜色吗?如果是,怎么办? [英] Is it possible to change the background color of AVPlayer? If yes, how?

查看:219
本文介绍了可以更改AVPlayer的背景颜色吗?如果是,怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将默认背景颜色从黑色更改为我想要的颜色.可能是与视频形成对比的颜色(大多数情况下是黑色的).

I wish to change the default background color from black to a color that i desire. Possibly to a color which contrasts the video (which is black most of the time).

我已经在我的viewWillAppear()函数中添加了这段代码:

I have added this piece of code in my viewWillAppear() function:

let playerLayer = AVPlayerLayer(player: player)
playerLayer.backgroundColor = UIColor.blueColor().CGColor

推荐答案

背景的黑色是AVPlayerView ‐控制器视图的backgroundColor,可以自由更改.

The black color of the background is the backgroundColor of the AVPlayerView ‐ Controller’s view, which you are free to change.

例如:

let av = AVPlayerViewController()
av.view.backgroundColor = UIColor.whiteColor()

这篇关于可以更改AVPlayer的背景颜色吗?如果是,怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆