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:
mgabdev
2020-12-22 12:11:22 -05:00
parent 6fbea0a59e
commit 34f6a1ab5b
28 changed files with 259 additions and 138 deletions

View File

@@ -0,0 +1,12 @@
# frozen_string_literal: true
class REST::AlbumSerializer < ActiveModel::Serializer
attributes :id, :title, :description, :count
belongs_to :cover, serializer: REST::MediaAttachmentSerializer
def id
object.id.to_s
end
end

View File

@@ -3,7 +3,7 @@
class REST::MediaAttachmentSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :id, :type, :url, :preview_url,
attributes :id, :type, :url, :preview_url, :source_mp4,
:remote_url, :text_url, :meta,
:description, :blurhash, :file_content_type
@@ -33,6 +33,18 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
end
end
def source_mp4
if object.type == "image" || object.type == "gifv" || object.type == "unknown"
return nil
else
if object.needs_redownload?
media_proxy_url(object.id, :playable)
else
full_asset_url(object.file.url(:playable))
end
end
end
def remote_url
object.remote_url.presence
end