【问题标题】:IOS9 WKWebView html5 video no playback buttonIOS9 WKWebView html5视频无播放按钮
【发布时间】:2016-11-23 19:28:39
【问题描述】:

我正在使用 WKWebView 来显示 html5 视频元素。最初加载视图时,有播放按钮(大圆形按钮)。如果您按下它,则会显示内置视频全屏控制器并开始播放视频。

在播放视频时按“完成”按钮:
1. 全屏控制器崩溃,我看到了我的 webview
2. 但是没有播放按钮了(所以我不能再开始播放视频了)

如果您先暂停视频并按“完成”,或者观看视频到最后然后按“完成”,一切都很好。

在 IOS8 上运行没有问题。

是IOS9的bug,还是我配置有问题? 有哪些可能的解决方法?

这是加载到 webview 中的 html:

@"<!DOCTYPE html>
<html>
<head>
    <meta name=""viewport"" content=""width=device-width, initial-scale=1, user-scalable=no"">
    <style>
        html, body {{
            margin: 0;
            padding: 0;
            background-color: #000;
        }}
        video {{
            background-color: #000;
            width: 100%;
            height: auto;
            max-height: 100%;
            margin: auto;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            position: absolute;
        }}
    </style>
</head>
<body>
<video poster=""{0}""><source src=""{1}"" /></video>
</body>
</html>";

【问题讨论】:

    标签: ios html5-video ios9 wkwebview


    【解决方案1】:

    问题是缺少控件属性。

    来自 Apple 文档:

    HTML5 和标签使向您的网站添加媒体变得简单。只需包含&lt;audio&gt;&lt;video&gt; 元素,使用src 属性标识媒体源,并包含controls 属性。

    https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Introduction/Introduction.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      • 2014-04-06
      • 1970-01-01
      • 1970-01-01
      • 2015-12-03
      • 1970-01-01
      • 2014-08-21
      相关资源
      最近更新 更多