Add support for poster image

Created on 11 August 2016, over 8 years ago
Updated 29 February 2024, 10 months ago

Hi All, I'm working with Drupal8 and am trying to add a poster image based off the instructions in the Read Me. However, when I click on the config for the VideoJS field I don't see any option to reference my Image field for the poster. Has anyone got this Video Poster functionality to work?

I was able to modify some of the files in order to get it working with a text field, but it isn't ideal:

VideoJsPLayerFormatter.php added this block in the settingsForm function...

$element['poster'] = [
'#title' => t('Poster (Thumbnail)'),
'#type' => 'textfield',
'#default_value' => $this->getSetting('poster'),
'#required' => FALSE,
];

Added this line in the videojs.html.twig...

poster="{{ player_attributes.poster }}" {{ player_attributes.poster ? 'poster' : '' }}

Thanks in advance.

Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇺🇸United States tom_nguyen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States DamienMcKenna NH, USA

    One problem here is that there's an assumption on which field name should be used; should it be configurable or something? The main differences between #13 and #19 are in the image field name - #13 uses field_image whereas #19 uses field_media_image.

    FWIW we've been using #13 on a production site for a few years.

  • 🇺🇦Ukraine _shy Ukraine, Lutsk 🇺🇦

    Please, reroll the patch to the latest branch version.

  • Status changed to Needs work about 1 year ago
  • 🇺🇦Ukraine _shy Ukraine, Lutsk 🇺🇦
  • 🇺🇸United States wstocker

    Patch re-rolled and updated with Drupal core 9.5.x.

  • 🇮🇳India sakthi_dev

    The patch provided in #24 not patching the files correctly instead it's creating a patch file inside the directory. As per comment #22 added Needs Reroll to the tags.

  • 🇺🇸United States wstocker

    @sakthi_dev Whoops apologies wrong file. Here is the updated one.

  • Status changed to Needs review 10 months ago
  • 🇺🇸United States DamienMcKenna NH, USA
  • 🇺🇸United States wstocker

    Patch 26 applied, but to Damiens' point there were PHP errors surrounding the new field name in #20.

    We had been using patch #13 for several years which has field_image instead of field_media_image.

    I think making that configurable is a good idea, but for now, I re-rolled and created patch #28 using patch #13 to start and the errors disappeared.

    Patch applies clean to 8.x-1.x.

  • 🇺🇸United States wstocker

    Patch #28 is incompatible with D10 as it uses deprecated and removed file_create_url().
    Refactored so it is compatible with D10 and 3.x.

Production build 0.71.5 2024