Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the background color of AVPlayer? If yes, how?

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).

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

let playerLayer = AVPlayerLayer(player: player)
playerLayer.backgroundColor = UIColor.blueColor().CGColor
like image 406
Yash Tamakuwala Avatar asked Dec 14 '22 06:12

Yash Tamakuwala


1 Answers

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

For example:

let av = AVPlayerViewController()
av.view.backgroundColor = UIColor.whiteColor()
like image 75
Tomasz Nazarenko Avatar answered Dec 16 '22 19:12

Tomasz Nazarenko