You are here

public static function BrightcoveUtil::getDefaultPlayer in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/BrightcoveUtil.php \Drupal\brightcove\BrightcoveUtil::getDefaultPlayer()
  2. 3.x src/BrightcoveUtil.php \Drupal\brightcove\BrightcoveUtil::getDefaultPlayer()

Helper function to get default player for the given entity.

Parameters

\Drupal\brightcove\BrightcoveVideoPlaylistCMSEntityInterface $entity: Video or playlist entity.

Return value

string The ID of the player.

2 calls to BrightcoveUtil::getDefaultPlayer()
brightcove_brightcove_playlist_view in ./brightcove.module
Implements hook_ENTITY_TYPE_view().
brightcove_brightcove_video_view in ./brightcove.module
Implements hook_ENTITY_TYPE_view().

File

src/BrightcoveUtil.php, line 398

Class

BrightcoveUtil
Utility class for Brightcove.

Namespace

Drupal\brightcove

Code

public static function getDefaultPlayer(BrightcoveVideoPlaylistCMSEntityInterface $entity) {
  if ($player = $entity
    ->getPlayer()) {
    return BrightcovePlayer::load($player)
      ->getPlayerId();
  }
  $api_client = self::getApiClient($entity
    ->getApiClient());
  return $api_client
    ->getDefaultPlayer();
}