about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-12 14:29:10 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-12 14:29:10 +0200
commitcdc49c6b4b3b75844d66d645e09de4be294881da (patch)
treed12c0559955993f3e71279b337650f466f847489 /app/models
parent5e511acb82c21ac07e2bab92231f15f26e57b1e6 (diff)
Allow mp4 uploads, convert to WebM
Diffstat (limited to 'app/models')
-rw-r--r--app/models/media_attachment.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index 678968ce8..93c915b01 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -1,6 +1,6 @@
 class MediaAttachment < ApplicationRecord
   IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
-  VIDEO_MIME_TYPES = ['video/webm'].freeze
+  VIDEO_MIME_TYPES = ['video/webm', 'video/mp4'].freeze
 
   belongs_to :account, inverse_of: :media_attachments
   belongs_to :status,  inverse_of: :media_attachments
@@ -43,14 +43,19 @@ private
       }
     else
       {
-        small: {
-        convert_options: {
-          output: {
-            vf: 'scale="min(510\, iw):min(680\, ih)":force_original_aspect_ratio=decrease'
-          }
+        original: {
+          convert_options: {},
+          format: 'webm'
         },
-        format: 'png',
-        time: 1
+
+        small: {
+          convert_options: {
+            output: {
+              vf: 'scale="min(510\, iw):min(680\, ih)":force_original_aspect_ratio=decrease'
+            }
+          },
+          format: 'png',
+          time: 1
         }
       }
     end