1

您如何嵌入扩展名为 .m4v 的静态文件,M4V 是一种文件格式,

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"     
 codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="256" >
<param name="src" value="/static/example.m4v">

<param name="autoplay" value="false">

<param name="controller" value="true">

 <embed src="/static/example.m4v" type="video/mp4" width="320" height="256" controller="true"    controls="true" autostart="false"/>

  </object>

上面的例子强制它下载。

http://django-embed-video.readthedocs.org/en/v0.11/index.html仅适用于 youtube 等在线网站,其他网站很少。

4

1 回答 1

0

我在同样的问题上苦苦挣扎。我几乎从http://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 iOS3 if you include the poster attribute! fixed in iOS4.0 -->
<video width="640" height="360" controls>
    <!-- MP4 must be first for iPad! -->
    <source src="__VIDEO__.MP4" type="video/mp4" /><!-- Safari / iOS video    -->
    <source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox / Opera / Chrome10 -->
    <!-- fallback to Flash: -->
    <object width="640" height="360" 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="controlbar=over&amp;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>

然后确保使用以下内容创建 .htaccess 文件:

AddType video/ogg  .ogv
AddType video/mp4  .mp4
AddType video/webm .webm

另外,我在我的项目中使用了旧版本的 django (1.6.5),并且我的视频存储在我的 MEDIA_ROOT 中,并且在 settings.py 中也设置了 MEDIA_URL,因此视频源如下所示:

{{ MEDIA_URL }}/media/videos/video.m4v
于 2016-12-21T22:17:14.563 回答