You are here

public function BrightcoveVideo::thumbnail in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php \Drupal\media_entity_brightcove\Plugin\MediaEntity\Type\BrightcoveVideo::thumbnail()
  2. 3.x modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php \Drupal\media_entity_brightcove\Plugin\MediaEntity\Type\BrightcoveVideo::thumbnail()

Gets thumbnail image.

Media type plugin is responsible for returning URI of the generic thumbnail if no other is available. This functions should always return a valid URI.

Parameters

MediaInterface $media: Media.

Return value

string URI of the thumbnail.

Overrides MediaTypeInterface::thumbnail

1 call to BrightcoveVideo::thumbnail()
BrightcoveVideo::getField in modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php
Gets a media-related field/value.

File

modules/media_entity_brightcove/src/Plugin/MediaEntity/Type/BrightcoveVideo.php, line 159

Class

BrightcoveVideo
Defines video field type for media.

Namespace

Drupal\media_entity_brightcove\Plugin\MediaEntity\Type

Code

public function thumbnail(MediaInterface $media) {
  if ($thumbnail_info = $this
    ->getVideoEntity($media)
    ->getThumbnail()) {

    /** @var \Drupal\file\FileInterface $file */
    if ($file = $this->entityTypeManager
      ->getStorage('file')
      ->load($thumbnail_info['target_id'])) {
      return $file
        ->getFileUri();
    }
  }
}