问题描述
我已经开发了一个应用程序,用户可以在网页上设置视频: - 他们可以指定一个YouTube网址要么 - 他们可以将视频上传
I have developed an application where the user can set videos on a web page:- They can specify a Youtube URLOR- They can upload a video
根据所选择的用户选择我呈现的视频网页是这样的:如果视频从YouTube:
Depending on which option the user chooses i render a video page like this :If a video is from youtube:
<iframe type="text/html" width="640" height="385" src="http://www.youtube.com/embed/YOUTUBEID?autoplay=1&loop=1&autohide=1&fs=0" frameborder="0"></iframe>
如果该视频被上传:
<video id="video" style="cursor: pointer;" width="640" height="480" autoplay controls loop>
<source src="../video/Tareas_Diarias_Resumen.mp4" type="video/mp4" />
</video>
确定。所有这一切都完美的作品在谷歌浏览器,但事实是,视频是怎么回事16三星GT-P5100安卓4.03平板电脑观看。
OK. All this works perfect on Google Chrome, but the fact is that the video is going to be watched on 16 Samsung GT-P5100 Android 4.03 Tablets.
我们创建了一个Android应用程序中嵌入一个web视图这样的:
We created an Android application which embeds an webView like that:
WebView engine = (WebView) findViewById(R.id.web_engine);
engine.setWebChromeClient(new WebChromeClient());
engine.getSettings().setPluginsEnabled(true);
engine.getSettings().setPluginState(PluginState.ON);
engine.getSettings().setJavaScriptEnabled(true);
engine.getSettings().setAllowFileAccess(true);
engine.loadUrl(miUrl);
在这里,我有两个问题:1-的Youtube视频。它的工作原理好吧,我可以看到视频,但没有自动播放,我们希望它自动播放工作。任何解决办法?2 - 上传的视频不工作,我能看到的球员,但没有视频。
And here I have two issues:1- Youtube video. It works ok, I can see the video but with no autoplay, and we want it to work with autoplay. Any solution?2- The uploaded video does not work, I can see the player but no video.
该视频被转化与手刹,选择iPhone和放大器; iPod的触摸preSET,网络优化选项。
The video was converted with handbrake, choosing iphone & ipod-touch preset and "Web Optimized" option.
任何帮助或线索?在此先感谢
Any help or clue?Thanks in advance
推荐答案
[升级每个请求的回答]
[upgraded to answer per request]
自动播放在大多数移动平台(安卓,IOS)被停止,以避免糟糕的用户体验 - 视频只能播放以下用户操作。通常你可以解决它通过对另一事件触发的play()(如onloaded事件)
Autoplay on most mobile platforms (Android, iOS) gets blocked to avoid poor user experiences - video should only play following a user action. You can usually work around it by triggering the play() on another event (eg the onloaded event)
这篇关于机器人的WebView HTML5视频自动播放不工作在Android 4.0.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!