You are here

public static function Html5::getIdFromInput in Video Embed HTML5 8

1 call to Html5::getIdFromInput()
ProviderUrlParseTest::testUrlParsing in tests/src/Unit/ProviderUrlParseTest.php
@dataProvider urlsWithExpectedIds

File

src/Plugin/video_embed_field/Provider/Html5.php, line 190

Class

Html5
A Html5 provider plugin.

Namespace

Drupal\video_embed_html5\Plugin\video_embed_field\Provider

Code

public static function getIdFromInput($input) {
  $pattern = "/(?:(\\/)|(?:(?|http|https|ftp)(?|\\/\\/))).*(mp4|ogg|webm)/i";
  $matches = array();
  preg_match($pattern, $input, $matches);

  // Make sure there are values.
  if ($matches && isset($matches[2])) {
    return array(
      $input,
      $matches[2],
    );
  }
  return FALSE;
}