1
0
puyopuyotetr.is/app/views/media/player.html.haml
Claire 29124990a2 Merge commit '7335a43b6dac0e82c305ce4dec9db4da114c769e' into glitch-soc/merge-upstream
Conflicts:
- `app/helpers/application_helper.rb`:
  Upstream reworked how CSS classes for the document's body are computed.
  Slight conflict due to glitch-soc's different theming system.
  Updated as upstream did.
2024-09-06 19:25:31 +02:00

47 lines
2.3 KiB
Plaintext

- content_for :header_tags do
= render_initial_state
= flavoured_javascript_pack_tag 'public', crossorigin: 'anonymous'
- content_for :body_classes, 'player'
:ruby
meta = @media_attachment.file.meta || {}
- if @media_attachment.video?
= react_component :video,
alt: @media_attachment.description,
blurhash: @media_attachment.blurhash,
detailed: true,
editable: true,
frameRate: meta.dig('original', 'frame_rate'),
height: 380,
inline: true,
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),
src: @media_attachment.file.url(:original),
width: 670 do
%video{ controls: 'controls' }
%source{ src: @media_attachment.file.url(:original) }
- elsif @media_attachment.gifv?
= react_component :media_gallery,
autoplay: true,
height: 380,
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer).as_json],
standalone: true do
%video{ autoplay: 'autoplay', muted: 'muted', loop: 'loop' }
%source{ src: @media_attachment.file.url(:original) }
- elsif @media_attachment.audio?
= react_component :audio,
accentColor: meta.dig('colors', 'accent'),
alt: @media_attachment.description,
backgroundColor: meta.dig('colors', 'background'),
duration: meta.dig(:original, :duration),
foregroundColor: meta.dig('colors', 'foreground'),
fullscreen: true,
height: 380,
poster: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.account.avatar_static_url,
src: @media_attachment.file.url(:original),
width: 670 do
%audio{ controls: 'controls' }
%source{ src: @media_attachment.file.url(:original) }