X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fvideo%2Fsrc%2FPlugin%2Fvideo%2FProvider%2FInstagram.php;fp=web%2Fmodules%2Fcontrib%2Fvideo%2Fsrc%2FPlugin%2Fvideo%2FProvider%2FInstagram.php;h=461c78eeba927a99d184545af88926b3941a3c3a;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/video/src/Plugin/video/Provider/Instagram.php b/web/modules/contrib/video/src/Plugin/video/Provider/Instagram.php new file mode 100644 index 000000000..461c78eeb --- /dev/null +++ b/web/modules/contrib/video/src/Plugin/video/Provider/Instagram.php @@ -0,0 +1,62 @@ +(.*?))[\/]?$@i", + * }, + * mimetype = "video/instagram", + * stream_wrapper = "instagram" + * ) + */ +class Instagram extends ProviderPluginBase { + /** + * {@inheritdoc} + */ + public function renderEmbedCode($settings) { + $file = $this->getVideoFile(); + $data = $this->getVideoMetadata(); + return [ + '#type' => 'html_tag', + '#tag' => 'iframe', + '#attributes' => [ + 'width' => $settings['width'], + 'height' => '100%', + 'frameborder' => '0', + 'allowfullscreen' => 'allowfullscreen', + 'src' => sprintf('//instagram.com/p/%s/embed/?autoplay=%d', $data['id'], $settings['autoplay']), + ], + '0' => array( + '#type' => 'html_tag', + '#tag' => 'script', + '#attributes' => array( + 'type' => 'text/javascript', + 'src' => '//platform.instagram.com/en_US/embeds.js', + 'async', + 'defer' + ), + '#value' => '', + ), + ]; + } + + /** + * {@inheritdoc} + */ + public function getRemoteThumbnailUrl() { + $data = $this->getVideoMetadata(); + return 'http://instagr.am/p/' . $data['id'] . '/media/?size=l'; + } +} \ No newline at end of file