You are here

public function Coub::iframe in Video Filter 8

HTML5 video (iframe).

Overrides VideoFilterBase::iframe

File

src/Plugin/VideoFilter/Coub.php, line 25

Class

Coub
Provides Coub codec for Video Filter.

Namespace

Drupal\video_filter\Plugin\VideoFilter

Code

public function iframe($video) {
  $attributes = [
    'autostart' => !empty($video['autoplay']) ? 'autoplay=true' : 'autoplay=false',
    'originalSize' => !empty($video['originalSize']) ? 'originalSize=true' : 'originalSize=false',
    'startWithHD' => !empty($video['startWithHD']) ? 'startWithHD=true' : 'startWithHD=false',
    'muted' => !empty($video['muted']) ? 'muted=true' : 'muted=false',
  ];
  return [
    'src' => '//coub.com/embed/' . $video['codec']['matches'][1] . '?' . implode('&', $attributes),
    'properties' => [
      'allowfullscreen' => 'true',
    ],
  ];
}