ivopetkov/video-embed
Composer 安装命令:
composer require ivopetkov/video-embed
包简介
Video embed library
README 文档
README
Simple library that returns embed information for a given video url.
Supported video services: Dailymotion, Facebook, Flickr, Hulu, Kickstarter, The New York Times, Ted, Vimeo, Vine, YouTube.
Download and install
- Install via Composer
composer require ivopetkov/video-embed
- Download the zip file
Download the latest release from our GitHub page, unzip and include the autoload.php file.
Usage
$videoEmbed = new IvoPetkov\VideoEmbed('https://www.youtube.com/watch?v=Pwe-pA6TaZk'); // IvoPetkov\VideoEmbed Object // ( // [url] => https://www.youtube.com/watch?v=Pwe-pA6TaZk // [html] => <iframe width="480" height="270" src="https://www.youtube.com/embed/Pwe-pA6TaZk?feature=oembed" frameborder="0" allowfullscreen></iframe> // [width] => 480 // [height] => 270 // [duration] => // [title] => Where the Hell is Matt? 2012 // [description] => // [thumbnail] => Array // ( // [url] => https://i.ytimg.com/vi/Pwe-pA6TaZk/hqdefault.jpg // [width] => 480 // [height] => 360 // ) // [author] => Array // ( // [name] => Matt Harding // [url] => https://www.youtube.com/user/mattharding2718 // ) // [provider] => Array // ( // [name] => YouTube // [url] => https://www.youtube.com/ // ) // [rawResponse] => {"html": "\u003ciframe width=\"480\" height=\"270\" ... // ) $videoEmbed->setSize(800, 600); // will set a new width and height in the video html code
Documentation
Classes
IvoPetkov\VideoEmbed
Constants
const string VERSION
Properties
public string $url
The video url
public string $html
The video html code
public string|int $width
The video width
public string|int $height
The video height
public int $duration
The video duration
public string $title
The video title
public string $description
The video description
public array $thumbnail
An array containing an url and sizes for the video thumbnail image
public array $author
An array containing the name and the url of the author
public array $provider
An array containing the name and the url of the provider
public string $rawResponse
The raw response from the provider embed endpoint
Methods
public __construct ( [ string $url ] )
Creates a new VideoEmbed object and load it if an url is specified
Parameters
$url
The video url
Returns
No value is returned.
public void load ( string $url )
Loads the data for the url specified
Parameters
$url
The video url
Returns
No value is returned
public void setSize ( string|int $width , string|int $height )
Sets new width and height in the video html code
Parameters
$width
Thew new width
$height
Thew new height
Returns
No value is returned
License
Video Embed is open-sourced software. It's free to use under the MIT license. See the license file for more information.
Author
This library is created by Ivo Petkov. Feel free to contact me at @IvoPetkovCom or ivopetkov.com.
ivopetkov/video-embed 适用场景与选型建议
ivopetkov/video-embed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.94k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ivopetkov/video-embed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ivopetkov/video-embed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-25