mirror of
https://github.com/chenasraf/nextcloud-forum.git
synced 2026-05-17 17:28:02 +00:00
feat: video playr support in attachments
This commit is contained in:
@@ -426,6 +426,27 @@ class BBCodeService {
|
||||
$escapedFileName,
|
||||
$escapedFileName
|
||||
);
|
||||
} elseif (str_starts_with($mimeType, 'video/')) {
|
||||
// Generate download URL for video (used as source)
|
||||
$videoUrl = $this->urlGenerator->linkToRouteAbsolute(
|
||||
'forum.file.download',
|
||||
['postId' => $postId, 'filePath' => $filePath]
|
||||
);
|
||||
|
||||
$escapedFileName = htmlspecialchars($fileName, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
$escapedUrl = htmlspecialchars($videoUrl, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
$escapedMimeType = htmlspecialchars($mimeType, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
|
||||
return sprintf(
|
||||
'<div class="attachment attachment-video">'
|
||||
. '<video controls preload="metadata" title="%s">'
|
||||
. '<source src="%s" type="%s" />'
|
||||
. '</video>'
|
||||
. '</div>',
|
||||
$escapedFileName,
|
||||
$escapedUrl,
|
||||
$escapedMimeType
|
||||
);
|
||||
} else {
|
||||
// Generate download URL for non-image files using proxy endpoint
|
||||
$downloadUrl = $this->urlGenerator->linkToRouteAbsolute(
|
||||
|
||||
@@ -65,6 +65,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
&-video {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
|
||||
video {
|
||||
max-width: 100%;
|
||||
max-height: 480px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--color-border);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
&-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user