Add constants to track media player height/width (#38755)
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / test (3.4) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.4) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Bundler Audit / security (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled

This commit is contained in:
Matt Jankowski 2026-04-21 07:10:45 -04:00 committed by GitHub
parent 9717dc64d0
commit c589530e22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
module MediaPlayerHelper
PLAYER_HEIGHT = 380
PLAYER_WIDTH = 670
end

View File

@ -14,7 +14,7 @@
detailed: true,
editable: true,
frameRate: meta.dig('original', 'frame_rate'),
height: 380,
height: MediaPlayerHelper::PLAYER_HEIGHT,
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),
@ -25,7 +25,7 @@
- elsif @media_attachment.gifv?
= react_component :media_gallery,
autoplay: true,
height: 380,
height: MediaPlayerHelper::PLAYER_HEIGHT,
media: [ActiveModelSerializers::SerializableResource.new(@media_attachment, serializer: REST::MediaAttachmentSerializer).as_json],
standalone: true do
%video{ autoplay: 'autoplay', muted: 'muted', loop: 'loop' }
@ -38,9 +38,9 @@
duration: meta.dig(:original, :duration),
foregroundColor: meta.dig('colors', 'foreground'),
fullscreen: true,
height: 380,
height: MediaPlayerHelper::PLAYER_HEIGHT,
poster: @media_attachment.thumbnail.present? ? @media_attachment.thumbnail.url : @media_attachment.account.avatar_static_url,
src: @media_attachment.file.url(:original),
width: 670 do
width: MediaPlayerHelper::PLAYER_WIDTH do
%audio{ controls: 'controls' }
%source{ src: @media_attachment.file.url(:original) }

View File

@ -38,8 +38,8 @@
= opengraph 'twitter:player', player_medium_url(media)
= opengraph 'twitter:player:stream', full_asset_url(media.file.url(:original))
= opengraph 'twitter:player:stream:content_type', media.file_content_type
= opengraph 'twitter:player:width', '670'
= opengraph 'twitter:player:height', '380'
= opengraph 'twitter:player:width', MediaPlayerHelper::PLAYER_WIDTH
= opengraph 'twitter:player:height', MediaPlayerHelper::PLAYER_HEIGHT
- if player_card
= opengraph 'twitter:card', 'player'
- else