jcisio/media-wrapper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jcisio/media-wrapper

最新稳定版本:2.0

Composer 安装命令:

composer require jcisio/media-wrapper

包简介

README 文档

README

Build Status Code Climate Test Coverage

Introduction

Quick start

Example:

include 'MediaWrapper/MediaWrapper.php';
$m = MediaWrapper::getInstance()->getWrapper('http://www.youtube.com/watch?v=vyfzw09jjEo');
// Print the thumbnail.
print $m->thumbnail();
// Print the full player.
print $m->player();
// Set default player options.
$m->player_options(array('width' => '200', 'height' => '100'));
// Print the full player again with new default options.
print $m->player();
// Override default options and print the full player.
print $m->player(array('height' => '120'));

Test with PHPUnit:

phpunit

or if you don't have PHPUnit:

Composer install --dev
vendor/phpunit/phpunit/phpunit

Use cases

MediaWrapper is extensible.

Write your own wrapper

You can look at the MediaWrapper/Wrapper folder for examples. Once you have your wrapper, include that file and register that wrapper using

MediaWrapper::getInstance()->register();

Override the output

You can extend a wrapper, keep the pattern and override the player() function. Do not forget to unregister the old wrapper so that only yours takes care of that pattern.

Responsive player

MediaWrapper in most cases uses the default player provided by each service. To make the player responsive (e.g. width = 100%), you can use CSS to make the iframe responsive. There are a lot of tutorials out there.

Another solution is to use the excellent and tiny Fitvids JS jQuery plugin to make all videos responsive. It takes care of your CSS.

统计信息

  • 总下载量: 151
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2013-09-26