mp4视频无法在网站上播放

时间:2015-05-19 07:02:02

标签: php video mp4

我正在服务器上传mp4视频,并在前端播放它们,内嵌HTML视频标签。以下是使用的代码。

mFavLsv.setAdapter(youradapter);

问题是,它会播放一些视频,而某些视频则不播放。两者都是mp4,但它播放一些视频而其他视频不播放。对于一些人来说,他们不是视频,而只是音频。

你能帮我解决一下检查的内容以及如何解决这个问题。

感谢,

4 个答案:

答案 0 :(得分:1)

对于不同的来源,您应该有不同类型的视频

File    Type
MP4     video/mp4
WebM    video/webm
Ogg     video/ogg

答案 1 :(得分:1)

<!-- "Video For Everybody" v0.4.1 by Kroc Camen of Camen Design <camendesign.com/code/video_for_everybody>
     =================================================================================================================== -->
<!-- first try HTML5 playback: if serving as XML, expand `controls` to `controls="controls"` and autoplay likewise       -->
<!-- warning: playback does not work on iPad/iPhone if you include the poster attribute! fixed in iOS4.0                 -->
<video width="640" height="360" controls preload="none">
    <!-- MP4 must be first for iPad! -->
    <source src="__VIDEO__.MP4" type="video/mp4" /><!-- WebKit video    -->
    <source src="__VIDEO__.webm" type="video/webm" /><!-- Chrome / Newest versions of Firefox and Opera -->
    <source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox / Opera -->
    <!-- fallback to Flash: -->
    <object width="640" height="384" type="application/x-shockwave-flash" data="__FLASH__.SWF">
        <!-- Firefox uses the `data` attribute above, IE/Safari uses the param below -->
        <param name="movie" value="__FLASH__.SWF" />
        <param name="flashvars" value="image=__POSTER__.JPG&amp;file=__VIDEO__.MP4" />
        <!-- fallback image. note the title field below, put the title of the video there -->
        <img src="__VIDEO__.JPG" width="640" height="360" alt="__TITLE__"
             title="No video playback capabilities, please download the video below" />
    </object>
</video>
<!-- you *must* offer a download link as they may be able to play the file locally. customise this bit all you want -->
<p> <strong>Download Video:</strong>
    Closed Format:  <a href="__VIDEO__.MP4">"MP4"</a>
    Open Format:    <a href="__VIDEO__.OGV">"OGG"</a>
</p>

答案 2 :(得分:0)

Zende如果您想在网站中嵌入.webm或.ogg格式的视频,那么您必须转换.webm或.ogg格式的视频

答案 3 :(得分:0)

还要确保您的网站为该文件提供正确的MIME类型。如果您使用的是nginx,则需要安装http_mp4_module