From: Mikael Nordfeldth Date: Mon, 14 Apr 2014 12:06:11 +0000 (+0200) Subject: HTML5 video/audio support in attachments X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=90a593718f664609bc8c646951b6b8844242a5db;p=quix0rs-gnu-social.git HTML5 video/audio support in attachments --- diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index 209f551c85..4d7bb7a7ca 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -322,14 +322,6 @@ class Attachment extends AttachmentListItem break; case 'application/ogg': - case 'audio/ogg': - case 'audio/x-speex': - case 'video/mpeg': - case 'audio/mpeg': - case 'video/mp4': - case 'video/ogg': - case 'video/quicktime': - case 'video/webm': $arr = array('type' => $this->attachment->mimetype, 'data' => $this->attachment->url, 'width' => 320, @@ -341,6 +333,24 @@ class Attachment extends AttachmentListItem $this->out->elementEnd('object'); break; + case 'audio/ogg': + case 'audio/x-speex': + case 'video/mpeg': + case 'audio/mpeg': + case 'video/mp4': + case 'video/ogg': + case 'video/quicktime': + case 'video/webm': + $mediatype = common_get_mime_media($this->attachment->mimetype); + $this->out->elementStart($mediatype, + array('class'=>'attachment_player', + 'controls'=>'controls')); + $this->out->element('source', + array('src'=>$this->attachment->url, + 'type'=>$this->attachment->mimetype)); + $this->out->elementEnd($mediatype); + break; + case 'text/html': if ($this->attachment->filename) { // Locally-uploaded HTML. Scrub and display inline. diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 5c7695cbc6..11956f054b 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -832,7 +832,7 @@ float:left; clear:both; } -#attachment_view img { +#attachment_view img, #attachment_view .attachment_player { max-width:480px; max-height:480px; }