]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/attachmentlist.php
HTML5 video/audio support in attachments
[quix0rs-gnu-social.git] / lib / attachmentlist.php
index 209f551c85086a29b956594107b7c1dc11259f60..4d7bb7a7ca81cfbb515352b80d86390b5dbfbe75 100644 (file)
@@ -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.