iBala
iBala

Reputation: 41

In iOS9.0, the MPVolumeSlider value is not holding proper value, It always 0.0

The following code works fine in iOS 8.0 devices, but in iOS9.0 always getting slider value as 0.000,

    let volumeView = MPVolumeView()
    for subview in volumeView.subviews {
        if subview.isKindOfClass((NSClassFromString("MPVolumeSlider"))!) {
            let volumeSlider = subview as? UISlider
            print("volumeSlider value : \(volumeSlider?.value)")
        }
    }

console output : volumeSlider value : Optional(0.0)

Any idea about this behaviour? I want to get master volume value. Please give your suggestions.

Upvotes: 2

Views: 979

Answers (1)

iBala
iBala

Reputation: 41

After analysis i used AVAudioSession.sharedInstance().outputVolume to get the master volume of iOS9.0 devices

Upvotes: 2

Related Questions