mcfedr / youtubelivestreamsbundle
用于获取直播流列表的包
3.0.0
2016-09-07 19:44 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.2
- sensio/framework-extra-bundle: ^3.0
- symfony/symfony: ^3.1
Requires (Dev)
README
用于发送推文作为推送通知的包
安装
Composer
php composer.phar require mcfedr/youtubelivestreamsbundle
AppKernel
在您的 AppKernel 中包含此包,您还需要加载 AWSPushBundle
public function registerBundles()
{
$bundles = array(
...
new Mcfedr\YouTube\LiveStreamsBundle\McfedrYouTubeLiveStreamsBundle(),
路由
在您的 routing.yml 中设置控制器
mcfedr_you_tube_live_streams:
resource: "@McfedrYouTubeLiveStreamsBundle/Controller/"
type: annotation
prefix: /
配置
这是一个示例配置,您可以添加到您的 config.yml 中
mcfedr_you_tube_live_streams:
api_key: youtube api key
channel_id: id of the channel
cache_timeout: 3600 #cache for an hour
您可能希望在 config_dev.yml 中放置类似的内容
mcfedr_you_tube_live_streams:
cache_timeout: 0
用法
您可以得到您的直播流列表
GET /streams
{
"streams": [
{
"name": "Громадське ONLINE. 6 березня",
"thumb": "https://i.ytimg.com/vi/Ou7hfc_LAeY/hqdefault.jpg",
"videoId": "Ou7hfc_LAeY"
},
{
"name": "Hromadske ONLINE RU",
"thumb": "https://i.ytimg.com/vi/O5j1mifrhK4/hqdefault.jpg",
"videoId": "O5j1mifrhK4"
}
]
}