Dailymotion.php in Video 8
File
src/Plugin/video/Provider/Dailymotion.php
View source
<?php
namespace Drupal\video\Plugin\video\Provider;
use Drupal\video\ProviderPluginBase;
class Dailymotion extends ProviderPluginBase {
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('//www.dailymotion.com/embed/video/%s?autoPlay=$d', $data['id'], $settings['autoplay']),
],
];
}
public function getRemoteThumbnailUrl() {
$data = $this
->getVideoMetadata();
return 'http://www.dailymotion.com/thumbnail/video/' . $data['id'];
}
}
Classes
Name |
Description |
Dailymotion |
Plugin annotation
@VideoEmbeddableProvider(
id = "dailymotion",
label = @Translation("Dailymotion"),
description = @Translation("Dailymotion Video Provider"),
regular_expressions = {
"@dailymotion\.com/video/(?<id>[^/_]+)_@i",
},
… |