Add constants to track media player height/width (#38755)
This commit is contained in:
parent
9717dc64d0
commit
c589530e22
6
app/helpers/media_player_helper.rb
Normal file
6
app/helpers/media_player_helper.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module MediaPlayerHelper
|
||||||
|
PLAYER_HEIGHT = 380
|
||||||
|
PLAYER_WIDTH = 670
|
||||||
|
end
|
||||||
@ -14,7 +14,7 @@
|
|||||||
detailed: true,
|
detailed: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
frameRate: meta.dig('original', 'frame_rate'),
|
frameRate: meta.dig('original', 'frame_rate'),
|
||||||
height: 380,
|
height: MediaPlayerHelper::PLAYER_HEIGHT,
|
||||||
inline: true,
|
inline: true,
|
||||||
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer)].as_json,
|
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer)].as_json,
|
||||||
preview: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.file.url(:small),
|
preview: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.file.url(:small),
|
||||||
@ -25,7 +25,7 @@
|
|||||||
- elsif @media_attachment.gifv?
|
- elsif @media_attachment.gifv?
|
||||||
= react_component :media_gallery,
|
= react_component :media_gallery,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
height: 380,
|
height: MediaPlayerHelper::PLAYER_HEIGHT,
|
||||||
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer).as_json],
|
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer).as_json],
|
||||||
standalone: true do
|
standalone: true do
|
||||||
%video{ autoplay: 'autoplay', muted: 'muted', loop: 'loop' }
|
%video{ autoplay: 'autoplay', muted: 'muted', loop: 'loop' }
|
||||||
@ -38,9 +38,9 @@
|
|||||||
duration: meta.dig(:original, :duration),
|
duration: meta.dig(:original, :duration),
|
||||||
foregroundColor: meta.dig('colors', 'foreground'),
|
foregroundColor: meta.dig('colors', 'foreground'),
|
||||||
fullscreen: true,
|
fullscreen: true,
|
||||||
height: 380,
|
height: MediaPlayerHelper::PLAYER_HEIGHT,
|
||||||
poster: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.account.avatar_static_url,
|
poster: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.account.avatar_static_url,
|
||||||
src: @media_attachment.file.url(:original),
|
src: @media_attachment.file.url(:original),
|
||||||
width: 670 do
|
width: MediaPlayerHelper::PLAYER_WIDTH do
|
||||||
%audio{ controls: 'controls' }
|
%audio{ controls: 'controls' }
|
||||||
%source{ src: @media_attachment.file.url(:original) }
|
%source{ src: @media_attachment.file.url(:original) }
|
||||||
|
|||||||
@ -38,8 +38,8 @@
|
|||||||
= opengraph 'twitter:player', player_medium_url(media)
|
= opengraph 'twitter:player', player_medium_url(media)
|
||||||
= opengraph 'twitter:player:stream', full_asset_url(media.file.url(:original))
|
= opengraph 'twitter:player:stream', full_asset_url(media.file.url(:original))
|
||||||
= opengraph 'twitter:player:stream:content_type', media.file_content_type
|
= opengraph 'twitter:player:stream:content_type', media.file_content_type
|
||||||
= opengraph 'twitter:player:width', '670'
|
= opengraph 'twitter:player:width', MediaPlayerHelper::PLAYER_WIDTH
|
||||||
= opengraph 'twitter:player:height', '380'
|
= opengraph 'twitter:player:height', MediaPlayerHelper::PLAYER_HEIGHT
|
||||||
- if player_card
|
- if player_card
|
||||||
= opengraph 'twitter:card', 'player'
|
= opengraph 'twitter:card', 'player'
|
||||||
- else
|
- else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user