5 * Contains \Drupal\video\Plugin\video\Provider\Instagram.
8 namespace Drupal\video\Plugin\video\Provider;
10 use Drupal\video\ProviderPluginBase;
13 * @VideoEmbeddableProvider(
15 * label = @Translation("Instagram"),
16 * description = @Translation("Instagram Video Provider"),
17 * regular_expressions = {
18 * "@^.*?instagram\.com\/p\/(?<id>(.*?))[\/]?$@i",
20 * mimetype = "video/instagram",
21 * stream_wrapper = "instagram"
24 class Instagram extends ProviderPluginBase {
28 public function renderEmbedCode($settings) {
29 $file = $this->getVideoFile();
30 $data = $this->getVideoMetadata();
32 '#type' => 'html_tag',
35 'width' => $settings['width'],
38 'allowfullscreen' => 'allowfullscreen',
39 'src' => sprintf('//instagram.com/p/%s/embed/?autoplay=%d', $data['id'], $settings['autoplay']),
42 '#type' => 'html_tag',
44 '#attributes' => array(
45 'type' => 'text/javascript',
46 'src' => '//platform.instagram.com/en_US/embeds.js',
58 public function getRemoteThumbnailUrl() {
59 $data = $this->getVideoMetadata();
60 return 'http://instagr.am/p/' . $data['id'] . '/media/?size=l';