1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-13 19:15:20 +02:00

[ticket/16863] Support playing video attachments

Correctly implement audio and video HTML5 tags (there is only one source)

PHPBB3-16863
This commit is contained in:
3D-I 2021-08-30 22:58:06 +02:00
parent 52c8de0bd7
commit e6e7f5afe3
3 changed files with 5 additions and 17 deletions

View File

@ -253,7 +253,7 @@ class attachment extends controller
// Content-type header // Content-type header
$response->headers->set('Content-Type', $attachment['mimetype']); $response->headers->set('Content-Type', $attachment['mimetype']);
// Display images in browser and force download for other file types // Display file types in browser and force download for others
if (strpos($attachment['mimetype'], 'image') !== false if (strpos($attachment['mimetype'], 'image') !== false
|| strpos($attachment['mimetype'], 'audio') !== false || strpos($attachment['mimetype'], 'audio') !== false
|| strpos($attachment['mimetype'], 'video') !== false || strpos($attachment['mimetype'], 'video') !== false

View File

@ -32,9 +32,7 @@
{% if _file.S_AUDIO_FILE %} {% if _file.S_AUDIO_FILE %}
<dl class="file"> <dl class="file">
<dt class="c-file-header"> <dt class="c-file-header">
<audio class="c-file-audio-controls" controls="controls" preload="metadata"> <audio src="{{ _file.U_DOWNLOAD_LINK }}" type="{{ _file.MIMETYPE }}" class="c-file-audio-controls" controls="controls" preload="metadata"></audio>
<source class="c-file-audio-source" src="{{ _file.U_DOWNLOAD_LINK }}" type="{{ _file.MIMETYPE }}">
</audio>
</dt> </dt>
{% if _file.COMMENT %} {% if _file.COMMENT %}
<dd class="c-file-comment">{{ _file.COMMENT }}</dd> <dd class="c-file-comment">{{ _file.COMMENT }}</dd>
@ -43,7 +41,7 @@
{% if _file.UPLOAD_ICON %} {% if _file.UPLOAD_ICON %}
<span class="o-icon c-file-icon">{{ _file.UPLOAD_ICON }}</span> <span class="o-icon c-file-icon">{{ _file.UPLOAD_ICON }}</span>
{% endif %} {% endif %}
<a class="c-file-actions-link postlink" href="{{ _file.U_DOWNLOAD_LINK }}" download>{{ _file.DOWNLOAD_NAME }}</a> <a class="c-file-actions-link postlink" href="{{ _file.U_DOWNLOAD_LINK }}">{{ _file.DOWNLOAD_NAME }}</a>
<span class="c-file-actions-meta">({{ _file.FILESIZE }} {{ _file.SIZE_LANG }}) {{ _file.L_DOWNLOAD_COUNT }}</span> <span class="c-file-actions-meta">({{ _file.FILESIZE }} {{ _file.SIZE_LANG }}) {{ _file.L_DOWNLOAD_COUNT }}</span>
</dd> </dd>
</dl> </dl>
@ -52,9 +50,7 @@
{% if _file.S_VIDEO_FILE %} {% if _file.S_VIDEO_FILE %}
<dl class="file"> <dl class="file">
<dt class="c-file-header"> <dt class="c-file-header">
<video class="c-file-video-controls" controls="controls" preload="metadata"> <video src="{{ _file.U_DOWNLOAD_LINK }}" type="{{ _file.MIMETYPE }}" class="c-file-video-controls" controls="controls" preload="metadata"></video>
<source class="c-file-video-source" src="{{ _file.U_DOWNLOAD_LINK }}" type="{{ _file.MIMETYPE }}">
</video>
</dt> </dt>
{% if _file.COMMENT %} {% if _file.COMMENT %}
<dd class="c-file-comment">{{ _file.COMMENT }}</dd> <dd class="c-file-comment">{{ _file.COMMENT }}</dd>
@ -63,7 +59,7 @@
{% if _file.UPLOAD_ICON %} {% if _file.UPLOAD_ICON %}
<span class="o-icon c-file-icon">{{ _file.UPLOAD_ICON }}</span> <span class="o-icon c-file-icon">{{ _file.UPLOAD_ICON }}</span>
{% endif %} {% endif %}
<a class="c-file-actions-link postlink" href="{{ _file.U_DOWNLOAD_LINK }}" download>{{ _file.DOWNLOAD_NAME }}</a> <a class="c-file-actions-link postlink" href="{{ _file.U_DOWNLOAD_LINK }}">{{ _file.DOWNLOAD_NAME }}</a>
<span class="c-file-actions-meta">({{ _file.FILESIZE }} {{ _file.SIZE_LANG }}) {{ _file.L_DOWNLOAD_COUNT }}</span> <span class="c-file-actions-meta">({{ _file.FILESIZE }} {{ _file.SIZE_LANG }}) {{ _file.L_DOWNLOAD_COUNT }}</span>
</dd> </dd>
</dl> </dl>

View File

@ -688,18 +688,10 @@ dl.thumbnail dt a:hover img {
max-width: 100%; max-width: 100%;
} }
.c-file-audio-source {
/** placeholder */
}
.c-file-video-controls { .c-file-video-controls {
max-width: 100%; max-width: 100%;
} }
.c-file-video-source {
/** placeholder */
}
/* Post poll styles /* Post poll styles
---------------------------------------- */ ---------------------------------------- */
fieldset.polls { fieldset.polls {