I have a controller with AVQueuePlayer, here i have implemented proximity sensor code but here the notification of proximity does not get fire for some reason. Below is the code that i have implemented.
UIDevice.current.isProximityMonitoringEnabled = true
NotificationCenter.default.addObserver(self, selector: #selector(self.proximityChanged), name: UIDevice.proximityStateDidChangeNotification, object: UIDevice.current)
the below method does not get called
@objc func proximityChanged(_ notification: Notification) {
if let device = notification.object as? UIDevice {
print("\(device) detected!")
}
}
Note:- this method works in all the controller except the controller where video player is implemented. Any help will be great.!!