简体   繁体   English

Android-三星的HTML5视频未显示控件

[英]Android - HTML5 video on Samsung's not showing controls

I'm currently working on an Android app with a WebView control, which has the following HTML snippet in it: 我目前正在使用带有WebView控件的Android应用程序,该应用程序中包含以下HTML代码段:

<video width="270" height="270" controls>
  <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"/>
</video>

On my LG Nexus 4 (Vanilla Android), this renders the video and the controls correctly (eg play, pause, full screen, etc), though when viewing on a Samsung Galaxy s4 and also a Nexus 10 (Touchwiz) tablet, the controls are displayed as red boxes (as in the screen shot below). 在我的LG Nexus 4(Vanilla Android)上,这可以正确渲染视频和控件(例如,播放,暂停,全屏等),尽管在Samsung Galaxy s4和Nexus 10(Touchwiz)平板电脑上查看时,控件被显示为红色框(如下图所示)。

三星视频控件

I've viewed the same page on Google Chrome and the controls render correctly, which leads me to believe something is different in Google chrome vs the WebView provided by Touchwiz 我已经在Google Chrome浏览器上查看了同一页面,并且控件可以正确呈现,这使我相信Google chrome和Touchwiz提供的WebView有所不同

I've tried a number of options on the HTML 5 snippet, and also removing / adding the WebClient / WebChromeClient which are currently attached on the WebView, though none of the solutions seem to have worked. 我已经尝试了HTML 5片段中的许多选项,并且还删除/添加了当前附加在WebView上的WebClient / WebChromeClient,尽管这些解决方案似乎都没有用。

The WebView is currently configured as below: WebView当前配置如下:

webView = (WebView)findViewById(R.id.newsletter_webview);
webView.loadUrl("http://example.com");

Thanks! 谢谢!

Not sure whether to delete the question or not, but found out the reason this was happening was due to a stylesheet on the page styling the and input[type=button] elements with border-radius and box-shadow styles - which are used to render the video player controls in the WebView - and which the WebView wasn't properly rendering. 不确定是否要删除问题,但发现发生这种情况的原因是页面上的样式表使用border-radius和box-shadow样式来对and input [type = button]元素进行样式设置-这些样式用于在WebView中渲染视频播放器控件-以及哪些WebView没有正确渲染。

Removing the styles seems to have fixed the problem, and brings the video player controls back to normal. 删除样式似乎可以解决问题,并使视频播放器控件恢复正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM