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:
12
app/serializers/rest/album_serializer.rb
Normal file
12
app/serializers/rest/album_serializer.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user