class Vimeo in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/video/Provider/Vimeo.php \Drupal\video\Plugin\video\Provider\Vimeo
Plugin annotation
@VideoEmbeddableProvider(
id = "vimeo",
label = @Translation("Vimeo"),
description = @Translation("Vimeo Video Provider"),
regular_expressions = {
"/^https?:\/\/(www\.)?vimeo.com\/(?<id>[0-9]*)/",
},
mimetype = "video/vimeo",
stream_wrapper = "vimeo"
)
Hierarchy
- class \Drupal\video\ProviderPluginBase implements ContainerFactoryPluginInterface, ProviderPluginInterface
- class \Drupal\video\Plugin\video\Provider\Vimeo
Expanded class hierarchy of Vimeo
1 string reference to 'Vimeo'
- VimeoStream::getName in src/
StreamWrapper/ VimeoStream.php - Returns the name of the stream wrapper for use in the UI.
File
- src/
Plugin/ video/ Provider/ Vimeo.php, line 20
Namespace
Drupal\video\Plugin\video\ProviderView source
class Vimeo extends ProviderPluginBase {
/**
* {@inheritdoc}
*/
public function renderEmbedCode($settings) {
$file = $this
->getVideoFile();
$data = $this
->getVideoMetadata();
return [
'#type' => 'html_tag',
'#tag' => 'iframe',
'#attributes' => [
'width' => $settings['width'],
'height' => $settings['height'],
'frameborder' => '0',
'allowfullscreen' => 'allowfullscreen',
'src' => sprintf('https://player.vimeo.com/video/%s?autoplay=%d', $data['id'], $settings['autoplay']),
],
];
}
/**
* {@inheritdoc}
*/
public function getRemoteThumbnailUrl() {
$data = $this
->getVideoMetadata();
$video_data = json_decode(file_get_contents('http://vimeo.com/api/v2/video/' . $data['id'] . '.json'));
if (is_object($video_data[0])) {
return $video_data[0]->thumbnail_large;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ProviderPluginBase:: |
protected | property | File object to handle | |
ProviderPluginBase:: |
protected | property | An http client. | |
ProviderPluginBase:: |
protected | property | Additional metadata for the embedded video object | |
ProviderPluginBase:: |
protected | property | Additional settings for the video widget | |
ProviderPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
ProviderPluginBase:: |
protected | function | Download the remote thumbnail to the local file system. | |
ProviderPluginBase:: |
public | function | Get the URL to the local thumbnail. | |
ProviderPluginBase:: |
protected | function | Determines the URI for a video field. | |
ProviderPluginBase:: |
protected | function | Get the ID of the video. | |
ProviderPluginBase:: |
protected | function | Get the input which caused this plugin to be selected. | |
ProviderPluginBase:: |
protected | function | Get the input which caused this plugin to be selected. | |
ProviderPluginBase:: |
public | function | ||
ProviderPluginBase:: |
public | function | Create a plugin with the given input. | |
Vimeo:: |
public | function |
Get the URL of the remote thumbnail. Overrides ProviderPluginInterface:: |
|
Vimeo:: |
public | function |
Render embed code. Overrides ProviderPluginInterface:: |