2017 © Pedro Peláez
 

library app-media

Integration of the media library for a Ride application.

image

ride/app-media

Integration of the media library for a Ride application.

  • Friday, October 14, 2016
  • by ride-user
  • Repository
  • 8 Watchers
  • 0 Stars
  • 2,791 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 2 % Grown

The README.md

Ride: Media Implementation

This is the implementation of ride/lib-media in the Ride application layer., (*1)

The main interface if the DependencyMediaFactory which does the same as ride\library\media\SimpleMediaFactory except for the use of registered dependencies on media item factories. Check the README of ride/lib-media for further reference., (*2)

Parameters

  • google.api.key: API key for the google related api calls (Youtube, Geocode...)

Code reference

Instead of manually adding MediaItem factories in the createMediaItem method, you can add them as a dependency, these can either be simple dependencies like eg. for the VimeoMediaItemFactory:, (*3)

// ride/app-media/config/dependencies.json
{
    "dependencies": [
        // ...
        {
            "interfaces": "ride\\library\\media\\factory\\MediaItemFactory",
            "class": "ride\\library\\media\\factory\\VimeoMediaItemFactory",
            "id": "vimeo"
        }
        // ...
    ]
}

or you could add the clientId parameter, like eg. for the YoutubeMediaItemFactory:, (*4)

// ride/app-media/config/dependencies.json
{
    "dependencies": [
        // ...
        {
            "interfaces": "ride\\library\\media\\factory\\MediaItemFactory",
            "class": "ride\\library\\media\\factory\\YoutubeMediaItemFactory",
            "id": "youtube",
            "calls": [
                {
                    "method": "setClientId",
                    "arguments": [
                        {
                            "name": "clientId",
                            "type": "parameter",
                            "properties": {
                                "key": "google.api.key"
                            }
                        }
                    ]
                }
            ]
        }
        // ...
    ]
}

Code sample

<?php

use ride\application\media\DependencyMediaFactory;

use ride\library\dependency\DependencyInjector;

function testMediaFactory(DependencyInjector $dependencyInjector) {
    $dependencyMediaFactory = new DependencyMediaFactory($dependencyInjector);

    // create a MediaItem (eg. Vimeo)
    $vimeoMediaItem = $dependencyMediaFactory->createMediaItem('https://vimeo.com/130848841');

    // create a MediaItem which depends on a clientId, but is injected via the DependencyInjector (eg. Youtube)
    $youtubeMediaItem = $dependencyMediaFactory->createMediaItem('https://www.youtube.com/watch?v=njos57IJf-0');

    // ```
}

Installation

You can use Composer to install this module., (*5)

composer require ride/app-media

The Versions

14/10 2016

dev-master

9999999-dev

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

14/10 2016

dev-develop

dev-develop

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

14/10 2016

1.0.0

1.0.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

24/11 2015

0.5.0

0.5.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

21/11 2015

0.4.0

0.4.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

14/08 2015

0.3.1

0.3.1.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

03/06 2015

0.3.0

0.3.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

15/12 2014

0.2.0

0.2.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

22/05 2014

0.1.0

0.1.0.0

Integration of the media library for a Ride application.

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd