YouTube

This plug-in is using YouTube to store and convert your video files. Once installed movies uploaded to ImageVault will be stored on your configured YouTube account. This means ImageVault will be able to preview, publish and stream movies using the YouTube API. From the editors perspective there should be no difference between working with locally stored files or movies stored on YouTube.

Note: This example implementation is currently not working with the YouTube servers. Uploading a video does not longer work. YouTube has, since this plugin was written, deprecated the API used in this example. To make this plugin work, the authentication and API calls must be modified to use the new authentication protocol (oauth2 for devices) and implement calls to the YouTube API using the new YouTube API v3.

You are free to modify this example and provide an updated implementation yourself.

Sorry for the inconvenience /Team ImageVault

Installation

The required assembly, ImageVault.Core.YouTube.dll, is included in the normal installation. It is located in the bin folder under the Core Instance created (C:\ImageVault\Core{instance}\bin).

In order to activate the YouTube plug-in the following SQL script should be executed:

    --BEGIN PostInstallation
    BEGIN TRANSACTION
    --register InformationGenerator
    IF NOT EXISTS(SELECT * FROM dbo.[TypeRegistrations] WHERE Type=
    'ImageVault.Core.YouTube.YouTubeMediaInformationGenerator, ImageVault.Core.YouTube')
    BEGIN
    INSERT INTO dbo.[TypeRegistrations]([Type]) VALUES(
    'ImageVault.Core.YouTube.YouTubeMediaInformationGenerator, ImageVault.Core.YouTube')
    END
    --register storage
    IF NOT EXISTS(SELECT * FROM dbo.MediaStorageTypes WHERE Type=
    'ImageVault.Core.YouTube.Storage.YouTubeMediaStorage,ImageVault.Core.YouTube')
    BEGIN
    INSERT INTO dbo.MediaStorageTypes([Type],[Priority]) VALUES(
    'ImageVault.Core.YouTube.Storage.YouTubeMediaStorage,ImageVault.Core.YouTube',20)
    END
    --register converter
    IF NOT EXISTS(SELECT * FROM [dbo].[MediaConverterTypes] WHERE [Type]=
    'ImageVault.Core.YouTube.YouTubeConverter,ImageVault.Core.YouTube')
    BEGIN
        INSERT INTO [dbo].[MediaConverterTypes] ([Type] ,[Priority]) VALUES (
        'ImageVault.Core.YouTube.YouTubeConverter,ImageVault.Core.YouTube', 999)
    END
    COMMIT TRANSACTION
    --END PostInstallation

This will register the required types for storage, conversion and creation of media information.

Configuration

In order for the plug-in to be able to connect to YouTube a developer account is required. This should be configured in the config file for the Core service. The configuration file can be found here

C:\ImageVault\Core\{instance}\bin\ImageVault.Core.Host.exe.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <imagevault.core>
        <appSettings>

            <add key="YouTubeMediaStorage_Username" value="{YouTube-Username}" />
            <add key="YouTubeMediaStorage_Password" value="{YouTube-password}" />
            <add key="YouTubeMediaStorage_DeveloperKey" value="{YouTube-DeveloperKey}" />

        </appSettings>
    </imagevault.core>
</configuration>

The Developer key can be found by logging on to the following address https://code.google.com/apis/youtube/dashboard/gwt/index.html

Restart the Core service once the configuration file is updated.

Implementation

The source code for the connector is available as an example on how to extend ImageVault.

YouTubeContent.cs

Extends the ExternalMediaContent base class.

This is the implementation of a MediaContent that will be used internally to handle media files stored in YouTube

YouTubeMediaStorage.cs

Implements the IMediaStorage interface.

This class is responsible for deciding if it could store a file, and if asked to make sure the file is stored in YouTube.

YouTubeConverter.cs

Extends the MediaConverterBase base class which in turn implements the IMediaConverter interface.

Is responsible for converting a movie, which is done by asking the YouTube API for a thumbnail.

YouTubeMediaInformationGenerator.cs

Implements the IMediaInformationGenerator interface.

Generates media information like width, height and content type. Is also responsible for how the media should be published. In this case using an iframe containing the player code.

comments powered by Disqus