6

i'm using AVPlayerViewController for playing audios. Reason for using it is that it provides and handles basic controls i.e. play/pause/slider/volume.

Now, i need to set background image of this view. Image will be fetched from some network location. i debugged AVPlayerViewController's view hierarchy. There's an image view. I'm not sure how to access that or even if it's possible

I don't want to use AVPlayer or AVAudio player as in that case i'll have to handle all the controls.How can i do that?

Fayza Nawaz
  • 2,256
  • 3
  • 26
  • 61

1 Answers1

12

Yes you can customize AVPlayerViewController by customizing it's contentOverlayView.

Add UIImageView as contentOverlayView.Add button etc also if you want custom design for them too.

controller.contentOverlayView.addsubview(myImageView)

To cahnge color etc:

controller.contentOverlayView.backgroundColor = UIColor(red: 178/255, green: 178/255, blue: 122/255, alpha: 1)

for more check following link

Change AVPlayerViewController background to album artwork objective-c iOS

Community
  • 1
  • 1
MOHAMMAD ISHAQ
  • 988
  • 7
  • 15