Maslosoft Framework Logo Maslosoft Framework Documentation
Flexible Application Foundation


Video Thumbnail Renderer

This renderer will get video thumbnail from available providers and display thumbnail associated to this video.

Supported providers:

  • YouTube
  • Vimeo

Usage

To use this provider, add @FormRenderer annotation with VideoThumb as parameter:

/**
 * @Label('Thumbnail')
 * @FormRenderer(VideoThumb)
 *
 * @see VideoThumb
 * @var string
 */
public $videoThumb = '';

The value should be URL of video, and will result in video thumbnail.

Please note that thumbnail dimensions are not limited, so either wrap form with reasonable container or restyle with CSS

The result of using this renderer in form is a video thumbnail from the Metallica's Enter The Sandman music video:

*

Paste here video url from YouTube or Vimeo

Code used to render this form

$model = new Video;
$model->url = 'https://www.youtube.com/watch?v=CD-E-LDc384';
echo ActiveForm::widget([
	'model' => $model
])->renderFields('url', 'videoThumb');