You are here

public function BlazyVideoTrait::getAutoplayUrl in Blazy 7

Returns video embed URL with an autoplay parameter.

2 calls to BlazyVideoTrait::getAutoplayUrl()
BlazyFilter::buildImageItem in src/Plugin/Filter/BlazyFilter.php
BlazyVideoTrait::getMediaItem in src/Plugin/Field/FieldFormatter/BlazyVideoTrait.php
Gets the Media item thumbnail, or re-associate the file entity to ME.

File

src/Plugin/Field/FieldFormatter/BlazyVideoTrait.php, line 192

Class

BlazyVideoTrait
A Trait common for Media integration with field details.

Namespace

Drupal\blazy\Plugin\Field\FieldFormatter

Code

public function getAutoplayUrl($url) {

  // Adds autoplay for media URL on lightboxes, saving another click.
  if (strpos($url, 'autoplay') === FALSE || strpos($url, 'autoplay=0') !== FALSE) {
    return strpos($url, '?') === FALSE ? $url . '?autoplay=1' : $url . '&autoplay=1';
  }
  return $url;
}