Cofoundry plugin that adds integration with the YouTube video service.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
GitVersion.yml
LICENSE
README.md
appveyor.yml
build.cake
build.ps1

README.md

Cofoundry.Plugins.YouTube

Build status NuGet Gitter

This library is a plugin for Cofoundry. For more information on getting started with Cofoundry check out the Cofoundry repository.

Overview

This plugin adds a single data attribute [YouTube] that can be used to markup a property of type YouTubeVideo. This will show as a YouTube Video picker in the admin UI.

API Data

The YouTube api requires an api key, so by default only the YouTubeVideo.Id property is returned in the data model. This might be sufficient for most purposes (e.g. using oEmbed), but if you want to pull in more data such as the video title, description or thumbnail image then you'll need to add an api key to your configuration settings:

{
  "Cofoundry": {
    "Plugins": {
      "YouTube:ApiKey": "TODO:AddApiKey"
    }
  }
}

Once you've added this api key, the UI editor will automatically start pulling in extra data into your YouTubeVideo model.

Example

You can find a full example project named YouTubeExample in the solution in this repository, which contains a YouTubeVideo page block type.

Example Data Model

using Cofoundry.Domain;
using Cofoundry.Plugins.YouTube.Domain;
using System.ComponentModel.DataAnnotations;

public class YouTubeVideoDataModel : IPageBlockTypeDataModel, IPageBlockTypeDisplayModel
{
    [Required]
    [YouTube]
    public YouTubeVideo Video { get; set; }
}