AVAudioPlayer and AirPlay - possible?

折月煮酒 提交于 2019-11-30 15:09:24
Ben Novakovic

In response to my own question. It looks like the simple way is to add the custom volume controller is mentioned here: [ ref ], and it will work perfectly with the MPAudioPlayer. Its just a matter of positioning it.

Its pretty easy with Interface Builder so you can easily utilize Auto Layout. Place anywhere you want an UIView object onto your main view then create a subclass of MPVolumeView and use this custom class for your UIView object

and the class VolumeView subclass of MPVolumeView

import UIKit
import MediaPlayer
class VolumeView: MPVolumeView {
   convenience init() {
       self.init()
}

override func drawRect(rect: CGRect) {
    self.showsVolumeSlider = false
    self.layer.cornerRadius = 10.0
    self.clipsToBounds = true

}

}

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