Friday, October 30, 2026
HomeiOS Developmentios - the way to detect volumn change in motion extension

ios – the way to detect volumn change in motion extension

[ad_1]

I wish to make a youtube participant utilizing motion extension.However the issue is volumn modifications will not be mirrored in an motion extension whereas it really works in an app.

my code is like:

let audioSession = AVAudioSession.sharedInstance()

self.obs = audioSession.observe(.outputVolume ) {[weak self] (av, change) in

     guard let self = self else { return }

     print("quantity (av.outputVolume)")

     self.slide.worth = av.outputVolume
}

and likewise I attempted to cover the system volumn bar utilizing code like this:

let volumeView = MPVolumeView(body: CGRect(x: 0, y: 0, width: 0, peak: 0))
self.view.addSubview(volumeView)

it additionally works in an app however not in an motion extension.
Anyone may also help me out? Or inform me why they will not work in an motion extension?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments