Android平台部分YouTube iframe视频无法播放问题求助
Android WebView通过iframe集成YouTube视频部分无法播放,iOS/Web平台正常
我们在Android、iOS及Web(Angular)三个平台通过iframe集成YouTube视频,仅Android平台存在部分视频无法播放的问题,iOS与Web平台可正常播放。以下是相关信息:
Android端无法播放的视频iframe
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/DwenbrW2Ljs" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; web-share" allowfullscreen></iframe>
可正常播放的视频iframe
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/1wntBImcNqU" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; web-share" allowfullscreen></iframe> <iframe width="100%" height="100%" src="https://www.youtube.com/embed/KS_letyBOZ8" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; web-share" allowfullscreen></iframe>
各平台截图
- Android端无法播放的视频预览截图:

- iOS端该视频正常预览截图:

- Web端该视频正常预览截图:

Android端实现代码
val webView = WebView(root.context) webView.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 230.dpToPx()) webView.setBackgroundColor(Color.TRANSPARENT) webView.settings.javaScriptEnabled = true webView.settings.domStorageEnabled = true webView.webChromeClient = WebChromeClient() webView.loadData(iFrame, "text/html", "utf-8") linearYoutube.addView(webView)
我们已尝试寻找解决方案但未果,恳请协助排查此问题。
内容的提问来源于stack exchange,提问作者Chirag Savsani
相关产品推荐
相关产品推荐

