AVAudioPlayer and AirPlay - possible?

后端 未结 2 899
一个人的身影
一个人的身影 2021-01-03 01:53

I\'m trying to ascertain whether it\'s possible to toggle AirPlay support using the AVAudioPlayer class.

From what I have read:

A

2条回答
  •  星月不相逢
    2021-01-03 02:39

    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
    
    }
    

    }

提交回复
热议问题