I am using web view (WKWebView) in ios app - swift 5 And the application was given access to the microphone ... But it does not run on the website inside Web View ... and I tried the site in a well-functioning Safari app that uses the microphone What is the solution ..
thes is my code
override func viewDidLoad() {
super.viewDidLoad()
switch AVAudioSession.sharedInstance().recordPermission {
case AVAudioSessionRecordPermission.granted:
print("Permission granted")
case AVAudioSessionRecordPermission.denied:
print("Pemission denied")
case AVAudioSessionRecordPermission.undetermined:
print("Request permission here")
AVAudioSession.sharedInstance().requestRecordPermission({ (granted) in
// Handle granted
})
@unknown default:
fatalError()
}
guard let url = URL(string: "https://") else { return }
wq.translatesAutoresizingMaskIntoConstraints = false
wq.isUserInteractionEnabled = true
wq.navigationDelegate = self
navigationItem.title = "abt"
wq.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
wq.configuration.preferences.javaScriptEnabled = true
wq.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
wq.configuration.allowsInlineMediaPlayback = true
wq.load(URLRequest(url: url))
self.activityIndicator.startAnimating()
self.activityIndicator.hidesWhenStopped = true
}
and thes is info.plist
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME)</string>