JavaFX WebView能否单独静音?如何实现音量控制?
Hey there, let's cut to the chase: there is no built-in API in JavaFX's WebView or WebEngine to directly mute or adjust the volume of audio playing from web content.
I’ve dug through the source code of both WebView and WebEngine, scoured relevant troubleshooting resources, and came up empty-handed—there’s no native way to target the audio output specifically from the WebView component.
The tricky constraint here is that you can’t rely on global audio mute, since you need your app’s other MediaPlayer instances to keep functioning normally. Global controls would silence all audio in your application, which isn’t what you’re looking for.
As of now, there’s no straightforward workaround within standard JavaFX to isolate and control WebView’s audio independently. If this feature is critical for your project, you might need to explore alternative web rendering components that support volume controls, but that would mean moving beyond the standard JavaFX toolset.
内容的提问来源于stack exchange,提问作者Pablo Fernandez

