5 * Contains \Drupal\video\Plugin\video\Provider\Vimeo.
8 namespace Drupal\video\Plugin\video\Provider;
10 use Drupal\video\ProviderPluginBase;
13 * @VideoEmbeddableProvider(
15 * label = @Translation("Vimeo"),
16 * description = @Translation("Vimeo Video Provider"),
17 * regular_expressions = {
18 * "/^https?:\/\/(www\.)?vimeo.com\/(?<id>[0-9]*)$/",
20 * mimetype = "video/vimeo",
21 * stream_wrapper = "vimeo"
25 class Vimeo extends ProviderPluginBase {
30 public function renderEmbedCode($settings) {
31 $file = $this->getVideoFile();
32 $data = $this->getVideoMetadata();
34 '#type' => 'html_tag',
37 'width' => $settings['width'],
38 'height' => $settings['height'],
40 'allowfullscreen' => 'allowfullscreen',
41 'src' => sprintf('https://player.vimeo.com/video/%s?autoplay=%d', $data['id'], $settings['autoplay']),
49 public function getRemoteThumbnailUrl() {
50 $data = $this->getVideoMetadata();
51 $video_data = json_decode(file_get_contents('http://vimeo.com/api/v2/video/' . $data['id'] . '.json'));
52 return $video_data[0]->thumbnail_large;