VideoEmbed

A CakePHP plugin that provides a helper for embedding YouTube, Vimeo and Dailymotion videos into View templates.

Requirements

  • CakePHP 2.x.

Installation

This plugin can be installed using Composer:-

composer require drmonkeyninja/cakephp-video-helper

Alternatively copy the plugin to your app/Plugin directory and rename the plugin’s directory ‘VideoEmbed’.

Then add the following line to your bootstrap.php to load the plugin.

CakePlugin::load('VideoEmbed');

Usage

echo $this->Video->embed($video['Video']['url'], array(
    'width' => 450,
    'height' => 300,
    'failSilently' => true // Disables warning text when URL is not recognised
));

// Advanced usage
echo $this->Video->embed($video['Video']['url'], array(
    'width' => 450,
    'height' => 300,
    'allowfullscreen' => 1,
    'loop' => 1,
    'color' => '00adef',
    'show_title' => 1,
    'show_byline' => 1,
    'show_portrait' => 0,
    'autoplay' => 1,
    'frameborder' => 0
));

Some of these settings are applicable only to Vimeo if the video is on Youtube or Dailymotion they are ignored.

The Details