Twitch.php in Video Filter 8
File
src/Plugin/VideoFilter/Twitch.php
View source
<?php
namespace Drupal\video_filter\Plugin\VideoFilter;
use Drupal\video_filter\VideoFilterBase;
class Twitch extends VideoFilterBase {
public function iframe($video) {
$attributes = [
'autoplay' => !empty($video['autoplay']) ? 'autoplay=1' : 'autoplay=0',
'time' => !empty($video['time']) ? 'time=' . $video['time'] : '',
];
return [
'src' => '//player.twitch.tv/?channel=' . $video['codec']['matches'][1],
'parameters' => [
'scrolling' => 'no',
],
];
}
public function options() {
$form = parent::options();
$form['time'] = [
'#title' => $this
->t('Time (optional)'),
'#type' => 'textfield',
'#description' => $this
->t('Start time'),
];
$form['autoplay'] = [
'#title' => $this
->t('Autoplay (optional)'),
'#type' => 'checkbox',
];
return $form;
}
}
Classes
Name |
Description |
Twitch |
Provides Twitch codec for Video Filter. |