5 * Contains \Drupal\video\Plugin\video\Provider\Vine.
8 namespace Drupal\video\Plugin\video\Provider;
10 use Drupal\video\ProviderPluginBase;
13 * @VideoEmbeddableProvider(
15 * label = @Translation("Vine"),
16 * description = @Translation("Vine Video Provider"),
17 * regular_expressions = {
18 * "@(?<=vine.co/v/)(?<id>[0-9A-Za-z]+)@i",
20 * mimetype = "video/vine",
21 * stream_wrapper = "vine"
24 class Vine extends ProviderPluginBase {
28 public function renderEmbedCode($settings) {
29 $file = $this->getVideoFile();
30 $data = $this->getVideoMetadata();
32 '#type' => 'html_tag',
35 'width' => $settings['width'],
36 'height' => $settings['height'],
38 'allowfullscreen' => 'allowfullscreen',
39 'src' => sprintf('https://vine.co/v/%s/embed/simple?autoPlay=%d', $data['id'], $settings['autoplay']),
47 public function getRemoteThumbnailUrl() {
48 $data = $this->getVideoMetadata();
50 $vine = file_get_contents("http://vine.co/v/{$id}");
51 preg_match('/property="og:image" content="(.*?)"/', $vine, $matches);
52 return ($matches[1]) ? $matches[1] : false;