mcfedr/youtubelivestreamsbundle

用于获取直播流列表的包

安装: 98

依赖者: 0

建议者: 0

安全性: 0

星星: 0

关注者: 3

分支: 0

开放问题: 0

类型:symfony-bundle

3.0.0 2016-09-07 19:44 UTC

This package is auto-updated.

Last update: 2024-08-29 04:08:56 UTC


README

用于发送推文作为推送通知的包

Latest Stable Version License Build Status SensioLabsInsight

安装

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"
        }
    ]
}