机器人的WebView无法呈现的YouTube视频通过iframe中嵌入 [英] Android webview cannot render youtube video embedded via iframe

查看:754
本文介绍了机器人的WebView无法呈现的YouTube视频通过iframe中嵌入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是加载使用的WebView里面最新的嵌入式格式(IFRAME)的YouTube视频。

This is about loading youtube videos using latest embedded format (iframe) inside a webview.

在iframe嵌入格式示例

Example of the iframe embed format

<iframe width="637" height="358" src="http://www.youtube.com/embed/olC42gO-Ln4?fs=1&amp;feature=oembed" frameborder="0" allowfullscreen=""></iframe>

测试在Android 2.3.3及放大器的code; 3.2设备(HTC Desire的&放大器;华硕变压器),web视图将只显示一个黑色的矩形

Test the code on Android 2.3.3 & 3.2 devices (HTC Desire & Asus Transformer), the webview would only show a black rectangle.

我试图从VIMEO类似的嵌入

I tried a similar embed from vimeo

<iframe src="http://player.vimeo.com/video/35693267" width="640" height="360" frameborder="0"></iframe>

在2.3,视频正常播放
在3.2,一个黑色矩形闪过,消失,iframe的区域是空白。

In 2.3, video played correctly
In 3.2, a black rectangle flashed and disappeared, the iframe area is blank.

最后,如果旧的嵌入格式(使用对象标签)时,适当的web视图内同时显示在2.3.3&安培的视频; 3.2。

Finally if the old embed format (using the object tag) is used, the video is displayed properly inside the webview in both 2.3.3 & 3.2.

我已经检查了相关的问题,并添加

I have checked related questions and added

android:hardwareAccelerated="true"

在应用程序和/或活动的标记,但仍然在这两个2.3和放大器没有视频; 3.2设备。

in the application and/or activity tag but still no video in both 2.3 & 3.2 devices.

这是因为越来越多的网站现在使用最新的格式(IFRAME)嵌入自己的YouTube视频的一个大问题。安卓/ YouTube团队,请看看这个问题。

This is a big problem because more websites are now using the newest format (iframe) to embed their youtube videos. Android/Youtube Team, please take a look at this problem.

推荐答案

Android的浏览器是完全马车想到什么就视频播放和嵌入。它根本就没有跨设备的正常工作。试图得到它的工作只是浪费你的时间。我的建议是,你不要试图包括&LT; IFRAME&GT; 而只是提供直接链接到YouTube网页或H264文件中的视频的缩略图

Android browsers are utterly buggy what comes to video playback and embedding. It simply does not work across devices. Trying to get it working is just waste of your time. My suggestion is that you don't try to include <iframe> but simply provide a thumbnail of the video which directly links to YouTube page or h264 file.

前面的讨论中,有一个可能的解决方案。

Earlier discussion, with a possible solution.

<一个href="http://stackoverflow.com/questions/7586475/google-reader-esque-optimizing-of-webviews-on-android">Google WebViews Android上器式的优化

这篇关于机器人的WebView无法呈现的YouTube视频通过iframe中嵌入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆