You are here

public function BrightcoveVideo::getVideo in Brightcove Video Connect 8.2

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

Returns the data stored on this video media as object.

@todo Decide whether we want to have our own custom domain value object.

Return value

\Brightcove\Item\Video\Video|null Brightcove video entity or null if not exist.

File

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

Class

BrightcoveVideo
Defines video field type for media.

Namespace

Drupal\media_entity_brightcove\Plugin\MediaEntity\Type

Code

public function getVideo(MediaInterface $media) {

  /** @var \Drupal\brightcove\Entity\BrightcoveVideo $video */
  if ($video = $media->{static::FIELD_NAME}->entity) {
    $cms = BrightcoveUtil::getCmsApi($video
      ->getApiClient());
    $brightcove_video = $cms
      ->getVideo($video
      ->getBrightcoveId());
    return $brightcove_video;
  }
  return NULL;
}