You are here

public function Brightcove::html in Video Filter 8

HTML code of the video player.

Overrides VideoFilterBase::html

File

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

Class

Brightcove
Provides Brightcove codec for Video Filter.

Namespace

Drupal\video_filter\Plugin\VideoFilter

Code

public function html($video) {
  $html = '';
  $video_url = !empty($video['codec']['matches'][0]) ? $video['codec']['matches'][0] : '';
  if (!empty($video_url)) {
    $html .= '<div style="display: block; position: relative; max-width: 500px;">';
    $html .= '<div style="padding-top: 56.25%;">';
    $html .= '<iframe frameborder="0" src="' . $video_url . '"';
    $html .= ' allowfullscreen webkitallowfullscreen mozallowfullscreen';
    $html .= ' style="width: 100%; height: 100%; position: absolute;';
    $html .= ' top: 0px; bottom: 0px; right: 0px; left: 0px;"></iframe>';
    $html .= '</div></div>';
  }
  return $html;
}