drmonkeyninja/cakephp-video-helper

CakePHP 插件,用于嵌入 YouTube 和 Vimeo 视频

安装数: 60,311

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 2

分支: 6

开放问题: 5

类型:cakephp-plugin

3.0.3 2018-02-09 12:38 UTC

README

License Build Status

此插件提供视频助手,用于生成嵌入来自 YouTube、Vimeo、Dailymotion、BBC 播放器和 Wistia 的视频的标签。

要求

master 分支有以下要求:

  • CakePHP 3.0.0 或更高版本。
  • PHP 5.3.0 或更高版本。

VideoEmbed for CakePHP 2.x

如果您想在 2.x 应用程序中使用 VideoEmbed,可以使用插件的最新 2.x 版本(请参阅 2.x 分支)。

安装

可以使用 Composer 安装此插件:

composer require drmonkeyninja/cakephp-video-helper:3.*

或者将插件复制到您的 app/Plugin 目录,并将插件的目录重命名为 'VideoEmbed'。

然后,将以下行添加到您的 bootstrap.php 中以加载插件。

CakePlugin::load('VideoEmbed');

使用方法

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
));

以下设置中,有些仅适用于 Vimeo,如果视频位于 YouTube、Dailymotion 或 Wistia,则会被忽略。