about summary refs log tree commit diff
path: root/app/views/media/player.html.haml
blob: c1d630a63fa216224afa61eed8460b65f65573a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
- content_for :header_tags do
  = render_initial_state
  = javascript_pack_tag "locales", crossorigin: 'anonymous'
  - if @theme
    - if @theme[:supported_locales].include? I18n.locale.to_s
      = javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", crossorigin: 'anonymous'
    - elsif @theme[:supported_locales].include? 'en'
      = javascript_pack_tag "locales/#{@theme[:flavour]}/en", crossorigin: 'anonymous'
  = render partial: 'layouts/theme', object: @core
  = render partial: 'layouts/theme', object: @theme

:ruby
  meta = @media_attachment.file.meta || {}

- if @media_attachment.video?
  = react_component :video, src: @media_attachment.file.url(:original), preview: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.file.url(:small), frameRate: meta.dig('original', 'frame_rate'), blurhash: @media_attachment.blurhash, width: 670, height: 380, editable: true, detailed: true, inline: true, alt: @media_attachment.description, media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer)].as_json do
    %video{ controls: 'controls' }
      %source{ src: @media_attachment.file.url(:original) }
- elsif @media_attachment.gifv?
  = react_component :media_gallery, height: 380, standalone: true, autoplay: true, media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer).as_json] do
    %video{ autoplay: 'autoplay', muted: 'muted', loop: 'loop' }
      %source{ src: @media_attachment.file.url(:original) }
- elsif @media_attachment.audio?
  = react_component :audio, src: @media_attachment.file.url(:original), poster: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.account.avatar_static_url, backgroundColor: meta.dig('colors', 'background'), foregroundColor: meta.dig('colors', 'foreground'), accentColor: meta.dig('colors', 'accent'), width: 670, height: 380, fullscreen: true, alt: @media_attachment.description, duration: meta.dig(:original, :duration) do
    %audio{ controls: 'controls' }
      %source{ src: @media_attachment.file.url(:original) }