You are here

protected static function Brightcove::getUrlMetadata in Video Embed Brightcove 8

Extract metadata from the input URL.

Parameters

string $input: Input a user would enter into a video field.

string $metadata: The metadata matching the regex capture group to get from the URL.

Return value

string|bool The metadata or FALSE on failure.

3 calls to Brightcove::getUrlMetadata()
Brightcove::getIdFromInput in src/Plugin/video_embed_field/Provider/Brightcove.php
Brightcove::getPlayerId in src/Plugin/video_embed_field/Provider/Brightcove.php
Get the player ID from the input URL.
Brightcove::getPlayerName in src/Plugin/video_embed_field/Provider/Brightcove.php
Get the player name from the input URL.

File

src/Plugin/video_embed_field/Provider/Brightcove.php, line 186

Class

Brightcove
A Brightcove provider plugin.

Namespace

Drupal\video_embed_brightcove\Plugin\video_embed_field\Provider

Code

protected static function getUrlMetadata($input, $metadata) {
  preg_match('/^https?:\\/\\/players\\.brightcove\\.net\\/(?<player>[0-9]*)\\/(?<player_name>[\\S]*)_default\\/index\\.html\\?videoId\\=(?<id>[0-9]*)?$/', $input, $matches);
  return isset($matches[$metadata]) ? $matches[$metadata] : FALSE;
}