Progress
new MediaAttachment video style :playable for mp4 to make videojs work with multiple files, hiding albums, hiding bookmark collections. may need tweaks on mediaattachment for mov and other formats : todo :
This commit is contained in:
@@ -306,11 +306,6 @@ class Account < ApplicationRecord
|
||||
username
|
||||
end
|
||||
|
||||
def excluded_from_chat_account_ids
|
||||
# : todo :
|
||||
# Rails.cache.fetch("exclude_account_ids_for:#{id}") { blocking.pluck(:target_account_id) + blocked_by.pluck(:account_id) + muting.pluck(:target_account_id) }
|
||||
end
|
||||
|
||||
def excluded_from_timeline_account_ids
|
||||
Rails.cache.fetch("exclude_account_ids_for:#{id}") { blocking.pluck(:target_account_id) + blocked_by.pluck(:account_id) + muting.pluck(:target_account_id) }
|
||||
end
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
# : todo : max per account
|
||||
class ChatConversationAccount < ApplicationRecord
|
||||
include Paginable
|
||||
|
||||
PER_ACCOUNT_APPROVED_LIMIT = 250
|
||||
|
||||
EXPIRATION_POLICY_MAP = {
|
||||
none: nil,
|
||||
|
||||
@@ -29,6 +29,7 @@ module AccountAssociations
|
||||
|
||||
# Media
|
||||
has_many :media_attachments, dependent: :destroy
|
||||
has_many :media_attachment_albums, dependent: :destroy
|
||||
has_many :polls, dependent: :destroy
|
||||
|
||||
# Push subscriptions
|
||||
|
||||
@@ -28,11 +28,11 @@ class MediaAttachment < ApplicationRecord
|
||||
enum type: [:image, :gifv, :video, :unknown]
|
||||
|
||||
IMAGE_FILE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp'].freeze
|
||||
VIDEO_FILE_EXTENSIONS = ['.webm', '.mp4', '.m4v'].freeze
|
||||
VIDEO_FILE_EXTENSIONS = ['.webm', '.mp4', '.m4v', '.mov'].freeze
|
||||
|
||||
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
|
||||
VIDEO_MIME_TYPES = ['video/webm', 'video/mp4'].freeze
|
||||
VIDEO_CONVERTIBLE_MIME_TYPES = ['video/webm'].freeze
|
||||
VIDEO_MIME_TYPES = ['video/webm', 'video/mp4', 'video/quicktime'].freeze
|
||||
VIDEO_CONVERTIBLE_MIME_TYPES = ['video/webm', 'video/quicktime'].freeze
|
||||
|
||||
BLURHASH_OPTIONS = {
|
||||
x_comp: 4,
|
||||
@@ -64,6 +64,23 @@ class MediaAttachment < ApplicationRecord
|
||||
file_geometry_parser: FastGeometryParser,
|
||||
blurhash: BLURHASH_OPTIONS,
|
||||
},
|
||||
playable: {
|
||||
convert_options: {
|
||||
output: {
|
||||
'loglevel' => 'fatal',
|
||||
'movflags' => 'faststart',
|
||||
'pix_fmt' => 'yuv420p',
|
||||
'vf' => 'scale=\'trunc(iw/2)*2:trunc(ih/2)*2\'',
|
||||
'vsync' => 'cfr',
|
||||
'c:v' => 'h264',
|
||||
'b:v' => '500K',
|
||||
'maxrate' => '1300K',
|
||||
'bufsize' => '1300K',
|
||||
'crf' => 18,
|
||||
},
|
||||
},
|
||||
format: 'mp4',
|
||||
},
|
||||
}.freeze
|
||||
|
||||
VIDEO_FORMAT = {
|
||||
@@ -170,9 +187,9 @@ class MediaAttachment < ApplicationRecord
|
||||
elsif IMAGE_MIME_TYPES.include? f.instance.file_content_type
|
||||
IMAGE_STYLES
|
||||
elsif VIDEO_CONVERTIBLE_MIME_TYPES.include?(f.instance.file_content_type)
|
||||
puts "tilly convert"
|
||||
{
|
||||
small: VIDEO_STYLES[:small],
|
||||
playable: VIDEO_STYLES[:playable],
|
||||
original: VIDEO_FORMAT,
|
||||
}
|
||||
else
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
class MediaAttachmentAlbum < ApplicationRecord
|
||||
|
||||
include Paginable
|
||||
|
||||
enum visibility: [
|
||||
:public,
|
||||
:private,
|
||||
], _suffix: :visibility
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :cover, class_name: 'MediaAttachment', optional: true
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user