Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIWebview dos不播放mp4视频_Ios_Video_Uiwebview_Screen_Frame - Fatal编程技术网

Ios UIWebview dos不播放mp4视频

Ios UIWebview dos不播放mp4视频,ios,video,uiwebview,screen,frame,Ios,Video,Uiwebview,Screen,Frame,我试图用UIWebView播放一个网站上的.mp4视频(带有HTML5视频标签)。 iPhone/iPad设备和模拟器只显示了一个带有删除播放按钮的黑色边框。 如果我只是在Safari Mac版本上打电话给这个网站,就可以玩它了。 怎么了 它不是本地文件。html如下所示: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xh

我试图用UIWebView播放一个网站上的.mp4视频(带有HTML5视频标签)。 iPhone/iPad设备和模拟器只显示了一个带有删除播放按钮的黑色边框。 如果我只是在Safari Mac版本上打电话给这个网站,就可以玩它了。 怎么了

它不是本地文件。html如下所示:

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <link rel="stylesheet" type="text/css" href="../css/shared-culture.css" />
    </head>
    <body>
        <section class="base">
            <hgroup>
                <h1>creative commons</h1>
                <h2>a shared culture</h2>
            </hgroup>

                <p>To celebrate our 2008 fundraising campaign, Creative Commons has
                    released “A Shared Culture,” a short video by renowned filmmaker <a
                        href="http://en.wikipedia.org/wiki/Jesse_Dylan">Jesse Dylan</a>. Known for
                    helming a variety of films, music videos, and the Emmy Award-winning <a
                        href="http://my.barackobama.com/page/invite/yeswecanvideo">“Yes We Can”</a>
                    Barack Obama campaign video collaboration with rapper will.i.am, Dylan created
                    “A Shared Culture” to help spread the word about the Creative Commons mission. </p>
                <!-- height="240" width="360" -->
                <video id="video1" controls="controls">
                    <source src="../video/shared-culture.mp4" type="video/mp4"/>
                    <source src="../video/shared-culture.webm" type="video/webm"/>
                    <div class="errmsg">
                        <p>Your Reading System does not support (this) video.</p>
                        <pre><code>
&lt;video id="video1" controls="controls"&gt;                    
  &lt;source src="../video/shared-culture.mp4" type="video/mp4"/&gt;
  &lt;source src="../video/shared-culture.webm" type="video/webm"/&gt;    
&lt;/video&gt;
                        </code></pre>
                    </div>
                </video>
                <p>In the video, some of the leading thinkers behind Creative Commons
                    describe how the organization is helping “save the world from failed sharing”
                    through free tools that enable creators to easily make their work available to
                    the public for legal sharing and remix. Dylan puts the Creative Commons system
                    into action by punctuating the interview footage with dozens of photos that have
                    been offered to the public for use under CC licenses. Similarly, he used two
                    CC-licensed instrumental pieces by Nine Inch Nails as the video’s soundtrack
                    music. These tracks, “17 Ghosts II” and “21 Ghosts III,” come from the Nine Inch
                    Nails album Ghosts I-IV, which was released earlier this year under a Creative
                    Commons BY-NC-SA license. (See <a
                        href="http://creativecommons.org/videos/a-shared-culture">attribution</a>.)
                </p>

        </section>

    </body>
</html>
在视频中,创意共享背后的一些主要思想家 描述该组织如何帮助“从失败的共享中拯救世界” 通过免费工具,使创作者能够轻松地将他们的作品提供给用户 公众可以合法分享和混音。迪伦提出了知识共享系统 通过在采访画面中添加几十张已经被曝光的照片来采取行动 已提供给公众使用CC许可证。同样,他使用了两个 CC许可的九英寸钉子乐器作品作为视频的配乐 音乐。这些曲目,“17鬼II”和“21鬼III”来自9英寸 《钉子》专辑《鬼魂I-IV》,今年早些时候在一项创造性的计划下发行 Commons BY-NC-SA许可证。(见附件。)


听起来像是编解码器的问题。如果在计算机上的VLC中打开该文件,您可以查看该文件使用的编解码器,请转到“窗口->媒体信息->编解码器详细信息”。答案链接到苹果的文档,您可以在其中找到支持的视频和音频编解码器:


它可能不是iPhone友好的格式


将mp4文件拖动到iMovie中,然后单击“共享”->“导出电影”,并选择一种与iPhone兼容的格式。

您使用的相对路径可能有问题。。尝试使用完全绝对路径-从http://

开始,如果承载视频文件的web服务器不支持字节范围,则视频无法在UIWebView中播放。UIWebView不会一次下载整个.mp4文件;相反,它通过请求部分文件来流式传输视频。现在大多数服务器都支持字节范围,但如果您的服务器不支持,或者您出于某种原因关闭了它,您将无法向iOS设备提供视频。

我也有这个问题,我有2个
.mp4
,但一个可以使用,一个不能,我尝试将类型文件
.mp4
格式化为
.mp4
,用于IPad及其工作,我想你应该试试。

在iPhone编程上播放mp4视频并不难。我们只需要多做一次拖放

请选择一个新的单视图项目。然后在ViewController.m文件中复制并粘贴此代码

<!DOCTYPE html>
<html>
<head></head>

<body>
  <center> <video width="250" height="304" controls preload>
        <source src="video1.mp4" type="video/mp4">
            </video> </center>

   <p>Thanks to Md Kamrul Hasan .....mdkamrul.hasan@marquette.edu</p>

   </body>
</html>
然后创建名为testingHTML.HTML的HTML文件

并将以下代码复制粘贴到HTML文件中

WebView.AllowsLinkPreview = true;
WebView.AllowsInlineMediaPlayback = true;
WebView.AllowsPictureInPictureMediaPlayback = true;

感谢卡姆鲁尔·哈桑博士……卡姆鲁尔博士。hasan@marquette.edu

将MP4类型的视频拖放到两个位置:

第一:将视频从HDD拖到项目选项卡[Xcode的左选项卡] 第二:从Xcode左侧选项卡,再次将相同的视频文件拖动到Project->Build Phases->Copy Bundle Resources

通常,复制包资源包含项目文件,但有时不包含视频文件

现在运行项目并欣赏视频


祝你好运

我在C#NET核心Ios网络视图应用程序中搜索同样的东西。对于我来说,在WebView控件上设置这些开关(在WebView中设置html之后):


为我工作。

是本地文件中的视频吗,你能发布你的
HTML
代码吗。如果你只想在该网站上播放视频,请查看。只需查看
http://my.barackobama.com . . ./video/shared culture.mp4
,它正在声明具有以下属性的电影嵌入标记:
type=“application/x-shockwave-flash”
。对于Apple HLS,您需要MPEG2.TS容器中的H.264/AVC。HLS文档在此:@richtoley您应该回答这个问题,而不是发表评论。您是否厌倦了在实际设备上播放它?我必须使用Adobe Media Encoder重新编码我的视频以使其正常工作(iOS 8.3)。我的视频很短(3秒)。我尝试在两个网络视图中播放两个视频,但只播放单个视频。
WebView.AllowsLinkPreview = true;
WebView.AllowsInlineMediaPlayback = true;
WebView.AllowsPictureInPictureMediaPlayback = true;