mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 18:03:48 +00:00
Added support for previewing Video and mp3 files.
This commit is contained in:
@@ -1804,4 +1804,13 @@ textarea:-moz-placeholder {/* for FF */
|
||||
.pubinfo-item .obj {
|
||||
font-size:11px;
|
||||
color:#999;
|
||||
.video-container {
|
||||
margin: auto;
|
||||
width: 800px;
|
||||
height: 400px;
|
||||
}
|
||||
.audio-container {
|
||||
margin: auto;
|
||||
width: 500px;
|
||||
height: 30px;
|
||||
}
|
@@ -162,6 +162,15 @@ if (!($.browser.msie && parseInt($.browser.version) < 10)) {
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'Video' %}
|
||||
$('#file-view').html('<div class="video-container"><video src="{{raw_path}}" width="800" height="400"></video></div>');
|
||||
$('video').mediaelementplayer(/* Options */);
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'Audio' %}
|
||||
$('#file-view').html('<div class="audio-container"><audio src="{{raw_path}}" width="500" height="30"></audio></div>');
|
||||
$('audio').mediaelementplayer(/* Options */);
|
||||
{% endif %}
|
||||
{% if filetype == 'Unknown' %}
|
||||
$('#file-view').html('<div id="file-view-tip"><p>{% trans "This type of file cannot be viewed online." %}</p></div>');
|
||||
{% endif %}
|
||||
|
@@ -7,6 +7,9 @@
|
||||
{% if filetype == 'PDF' and use_pdfjs %}
|
||||
<script type="text/javascript" src="{{MEDIA_URL}}js/pdf.js"></script>
|
||||
{% endif %}
|
||||
{% if filetype == 'Video' or filetype == 'Audio' %}
|
||||
<script src="{{MEDIA_URL}}js/mediaelement-and-player.min.js"></script>
|
||||
{% endif %}
|
||||
{% if filetype == 'Markdown' %}
|
||||
<script type="text/javascript" src="{{MEDIA_URL}}js/showdown.js"></script>
|
||||
{% endif %}
|
||||
|
@@ -19,3 +19,7 @@
|
||||
#file-view { text-align:center; padding:30px 0; }
|
||||
</style>
|
||||
{% endif %}
|
||||
|
||||
{% if filetype == 'Video' or filetype == 'Audio' %}
|
||||
<link rel="stylesheet" href="{{MEDIA_URL}}css/mediaelementplayer.css" />
|
||||
{% endif %}
|
||||
|
@@ -45,6 +45,8 @@ PREVIEW_FILEEXT = {
|
||||
'PDF': ('pdf',),
|
||||
'Markdown': ('markdown', 'md'),
|
||||
'Sf': ('seaf',),
|
||||
'Video': ('mp4', 'ogv', 'webm', 'flv'),
|
||||
'Audio': ('mp3',),
|
||||
}
|
||||
|
||||
def gen_fileext_type_map():
|
||||
|
Reference in New Issue
Block a user