Skip to content
This repository has been archived by the owner on Feb 6, 2019. It is now read-only.
/ AssetDistributor Public archive

PHP component that can publish digital assets (video, audio...) across multiple services. Currently supports YouTube, Vimeo and Dailymotion.

Notifications You must be signed in to change notification settings

bricev/AssetDistributor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AssetDistributor

Scrutinizer Code Quality Build Status

AssetDistributor is a PHP component that can publish digital assets (video, audio...) across multiple services.

Currently, AssetDistributor can publish videos across YouTube, Vimeo and DailyMotion. Feel free to help and integrate new Adapters for new services.

Vocabulary

  • Asset — describes a digital media of one of the following type : audio, document, image or video.

  • Adapter — implements a service to upload, update or delete Asset objetcs from.

  • AdapterCollection — contains multiple Adapter objects and is traversable

  • Owner — handles an AdapterCollection and the corresponding services account credentials.

Installation

The component may be added through composer :

composer require libcast/assetdistributor

Configuration

All your application oAuth credentials or any other configuration must be stored in a PHP configuration file. You may have a look on example/configuration.ini as an example.

Usage

First create an Owner called "me" to bear accounts credentials and an AdapterCollection

$cache = new \Doctrine\Common\Cache\FilesystemCache('/tmp'); // Doctrine Cache is a dependency
$owner = new Owner('me', $cache);

Then create an Asset from an existing file

$asset = AssetFactory::build(
    "$root/tests/video.mp4",        // path to file of a Flysystem\File object
    'My Video',                     // optional title
    'This is an awesome video',     // optional description
    ['test', 'asset-distributor']   // optional array of tags
);
$asset->setVisibility('private');

You may create an AdapterCollection manually:

/** @var string $configPath Path to the PHP configuration file */

$adapters = new AdapterCollection;
$adapters[] = new YouTubeAdapter($owner, $configPath);
$adapters[] = new VimeoAdapter($owner, $configPath);

You also can retrieve the AdapterCollection from the cache:

$adapters = AdapterCollection::retrieveFromCache($owner, $configPath);

Or you can create an AdapterCollection based on the Asset :

$adapters = AdapterCollection::buildForAsset($asset, $owner, $configPath);

Once created, the AdapterCollection must be affiliated to the Owner

$owner->setAdapters($adapters);

At this point, you may manipulate your Asset across all services like this:

// Upload the Asset on all services
$owner->upload($asset);

$asset->setTitle('Different title');
$asset->addTag('foobar');

// Update the Asset on all services
$owner->update($asset);

// Delete the Asset on all services
$owner->delete($asset);

About

PHP component that can publish digital assets (video, audio...) across multiple services. Currently supports YouTube, Vimeo and Dailymotion.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages