I want to make a youtube player using action extension.But the problem is volumn changes won't be reflected in an action extension while it 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("volume \(av.outputVolume)")
self.slide.value = av.outputVolume
}
and also I tried to hide the system volumn bar using code like this:
let volumeView = MPVolumeView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
self.view.addSubview(volumeView)
it also works in an app but not in an action extension. Anybody can help me out? Or tell me why they won't work in an action extension?