Reputation: 18603
I have a webview which opens a page with a video that starts muted. Something like this:
<video autoplay muted playsinline>
This causes other apps playing audio in the background to pause, for instance Spotify. This is not a great user experience, as we do not want our users interrupted before they actively decide to listen to the audio of the video by clicking it. Is there any configuration we can do to the WebView
to fix this? Or do we have to accept that this is in the hands of Google and wait for a Chrome WebView fix?
Test page if you want to try and reproduce
Upvotes: 2
Views: 1596
Reputation: 6697
Try to invoke settings.setMediaPlaybackRequiresUserGesture(true);
on a WebSettings
object. It should solve your issue.
Works fine on Nexus 5X (Android 8.1.0) with Spotify in the background.
Upvotes: 2