Developed with love by KnpLabs Hire us for your project!
29

live-broadcast-bundle

by Martin1982

Live broadcasting planner and initiator

Live Broadcast Bundle

As we're stabilizing the bundle please note that database schema and config changes may occur

Build Status
SensioLabsInsight

Latest Stable Version
Total Downloads
Latest Unstable Version
License

Table of contents

About

The Live Broadcast Bundle will make it possible to plan live video streams to
various channels like Twitch, YouTube Live, Facebook Live, UStream and Live.Ly (referred to as Output or Channels).

As "Input" we support files, URL's or existing RTMP streams.

For more info you can view the latest recorded presentation below, check the demo project at https://github.com/Martin1982/live-broadcast-demo or read on;

IMAGE ALT TEXT

Prerequisites

The Broadcaster needs a few commands;

  • ffmpeg 3.x or higher

On Linux:
* ps
* kill

On Mac:
* ps
* grep
* kill

On Windows:
* tasklist
* taskkill

To test these prerequisites the Symfony command livebroadcaster:test:shell can be used after the installation described below.

Basic installation

This bundle will be made available on Packagist. You can then install it using Composer:

$ composer require martin1982/live-broadcast-bundle

Next, enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Martin1982\LiveBroadcastBundle\LiveBroadcastBundle(),
    );
}

Use Doctrine to update your database schema with the broadcasting entities, when upgrading it is recommended to use migrations.

To start the broadcast scheduler you can run the following command:

$ php app/console livebroadcaster:broadcast

To make broadcast planning available through an admin interface we've added support for the Sonata Admin bundle.

FFMpeg log directory

To view the output of FFMpeg you need to configure a log directory in your app/config/config.yml.

 live_broadcast:
    ffmpeg:
        log_directory: '%kernel.logs_dir%'

Event loop

You can use this configuration to set the event loop timer:

live_broadcast:
    eventloop:
        timer: 5

Thumbnailer setup

Setup the following config for thumbnails:

live_broadcast:
    thumbnail:
        upload_directory: '%kernel.root_dir%/../web/uploads/thumbnails'
        web_path: '/uploads/thumbnails'

Enabling Facebook Live

Create a Facebook app on https://developers.facebook.com with the following permissions:

  • user_videos
  • user_events
  • user_managed_groups
  • manage_pages
  • publish_actions
  • Live-Video API

Edit your app/config/config.yml with the following configuration:

live_broadcast:
    facebook:
        application_id: YourFacebookAppId
        application_secret: YourFacebookAppSecret

When using Sonata Admin; add the Sonata block to your blocks config:

sonata_block:
    blocks:
    sonata.block.service.facebookauth:
        contexts:   [admin]

Enabling YouTube Live

Login to https://console.developers.google.com/ and enable the 'YouTube Data API v3'.

Setup oAuth Credentials for your server. In case you're using the Sonata Admin from this
bundle the redirect URI's path is <your domain>/admin/channel/youtube/oauthprovider

Add the YouTube API info to your config.yml:

live_broadcast:
    youtube:
        client_id: YourGoogleOauthClientId
        client_secret: YourGoogleOauthClientSecret
        redirect_route: admin_martin1982_livebroadcast_channel_abstractchannel_youtubeoauth

When using Sonata Admin; add the Sonata block to your blocks config:

sonata_block:
    blocks:
    sonata.block.service.youtubeauth:
        contexts:   [admin]

Add these lines to your parameters.yml (used for generating a thumbnail URL)

parameters:
    router.request_context.host: broadcast.com
    router.request_context.scheme: https

Add new output platforms

Create a new Channel Entity in Entity/Channel that extends the AbstractChannel (e.g. ChannelNew)

Create a new StreamOutput service in Service/StreamOutput that implements the OutputInterface (e.g. OutputNew)

Configure the service with the output tag in Resources/config/services.yml

live.broadcast.output.new:
    class: Martin1982\LiveBroadcastBundle\Service\StreamOutput\OutputNew
    tags:
        - { name: live.broadcast.output, platform: 'New' }

To add support for Sonata admin; add a new form for the Channel in Admin/ChannelAdmin.php

protected function configureFormFields(FormMapper $formMapper)
{
    if ($subject instanceof ChannelNew) {
        $formMapper->add('...', 'text', array('label' => '...'));
    }
}

Next add the sub class for the channelAdmin in Resources/config/admin.yml for

sonata.admin.channel
    calls:
        - [setConfiguredSubclasses, [ { "Name": Martin1982\LiveBroadcastBundle\Entity\Channel\ChannelNew } ] ]
  • Update Windows tests
    By Martin de Keijzer, 8 months ago
  • Move Windows processes to the background when started
    By Martin de Keijzer, 8 months ago
  • Make scheduler testable to keep bug regression small
    By Martin de Keijzer, 8 months ago
  • Save end signal send before actually sending it (fire & forget)
    By Martin de Keijzer, 8 months ago
  • Better error handling in Google Services and the Event Loop
    By Martin de Keijzer, 8 months ago
  • Merge pull request #78 from Martin1982/feature/youtube-thumbnails
    By web-flow, 8 months ago
  • Minor inspection fixes: Change duplicate variable name, add return type, check for non-null value
    By Martin de Keijzer, 8 months ago
  • #77 PR comments
    By Paul Radt, 8 months ago
  • Make docs a bit easier on the eyes
    By Martin de Keijzer, 8 months ago
  • Set defaults for services based on the configuration defaults
    By Martin de Keijzer, 8 months ago
  • #77 Upload YouTube thumbnail for new live event
    By Paul Radt, 8 months ago
  • Add Symfony 4 support
    By Martin de Keijzer, 8 months ago
  • Add missing newlines
    By Martin de Keijzer, 8 months ago
  • Update loopable method
    By Martin de Keijzer, 8 months ago
  • Update README.md about inputs
    By Martin de Keijzer, 8 months ago
  • Update README.md and remove unused parameter eventloop.enabled
    By Martin de Keijzer, 8 months ago
  • Change headnote in README.md
    By Martin de Keijzer, 8 months ago
  • Merge pull request #76 from Martin1982/feature/suggest-doctrine-migrations
    By web-flow, 8 months ago
  • Suggest doctrine migrations (fixes #74)
    By Martin de Keijzer, 8 months ago
  • Merge pull request #73 from Martin1982/feature/merge-monitor-streams
    By web-flow, 8 months ago
  • Change minimal package version
    By Martin de Keijzer, 8 months ago
  • Add other YouTube API service tests
    By Martin de Keijzer, 8 months ago
  • Add some YouTube api tests
    By Martin de Keijzer, 8 months ago
  • Add final facebook service tests
    By Martin de Keijzer, 8 months ago
  • More facebook api tests
    By Martin de Keijzer, 8 months ago
  • Add more facebook tests
    By Martin de Keijzer, 8 months ago
  • Add more unit tests
    By Martin de Keijzer, 8 months ago
  • Add more unit tests
    By Martin de Keijzer, 8 months ago
  • Fix travis paths for phpcs
    By Martin de Keijzer, 8 months ago
  • Cleanup old code
    By Martin de Keijzer, 8 months ago