The <video> from webview shows the media player icon before loading, I want to prevent this, but I can’t solve it in any way, can you help me?
webView.settings.apply {
javaScriptEnabled = true
domStorageEnabled = true
mediaPlaybackRequiresUserGesture = false
}
webView.webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
val jsCode = """
function setPoster() {
console.log('Poster ayarlama başladı');
var videos = document.getElementsByTagName('video');
console.log('Video sayısı:', videos.length);
for(var i = 0; i < videos.length; i++) {
var video = videos[i];
video.poster = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
console.log('Video ' + i + ' poster ayarlandı');
}
}
setPoster();
"""
view?.evaluateJavascript(jsCode, null)
}
}