I couldn't find an answer on MDN Web Docs and Stack Overflow, Google Search so I'm posting a question.
The issue I'm experiencing is that...
Why does the 'playbackRate Change' button in the provided 'controls' of the HTML Audio attribute not work in my macOS project's WebView?
I have a very simple HTML that plays audio.
<audio src="../Audio/013.mp3" controls="controls" style="width:370px;position: absolute;top:560px;left:200px;"></audio>
In Safari, the buttons supported in Controls work fine. However, in my Mac app, the playback speed change button doesn't work.
Just like this
Deployment Target and Minimum Deployments macOS -> 12.0
Please note that it only supports macOS apps.
I have tried.
webView.allowsLinkPreview = false
webView.allowsBackForwardNavigationGestures = true
webView.configuration.allowsAirPlayForMediaPlayback = true
webView.configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
webView.configuration.preferences.javaScriptEnabled = true
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
webView.configuration.mediaTypesRequiringUserActionForPlayback = .audio
App Sandbox -> outgoing Connections (Client)
Check
++
As an additional test, the playbackRate functionality itself works, but the button remains inactive.
I really foolishly tried to solve the problem elsewhere. The root of the problem was that I inherited WKWebView to prevent right-clicking and had a statement in willOpenMenu to removeAll items. I never thought this would have any impact on the issue I was facing, and I'm fortunate to have found it now. I won't delete the question as other developers may have similarly challenging experiences.
class CustomWKWebView: WKWebView {
override func willOpenMenu(_ menu: NSMenu, with event: NSEvent) {
#warning("here??")
menu.items.removeAll() // -> is this criminal !!!!!
}