YouTube Plugin
A simple plugin interface with YouTube for October CMS.
Setup
- Clone or download the repo into
/bluhex/youtube
. - Run
composer update
to get the latest google client.
Usage
Settings
Key
: YouTube API key is needed to access the API.cached
: Time in minutes that the results should be cached forGetting an API Key
- Head on over to https://console.developers.google.com/project and either select your existing project or create a new one.
- Open the side bar and select 'API Manager'
- Select or search for YouTube Data API
- Click on 'Enable'
- Select 'Credentials' from the sidebar
- Select 'Create credentials' -> 'API key' -> 'Server key'
- Name the key whatever you like and enter your IP address into the 'Accept requests from these server IP addresses' and create
- Copy the new API Key into the settings and save.
Latest videos
Use the Videos
component to display a list of the latest videos for a channel. The component has the following properties available for config:
-
_id
: The YouTube channel id can be found over at https://www.youtube.com/account_advanced. -
_items
: Maximum number of videos to display, at this time there is no pagination support. -
_resolution
: The resolution of the thumbnail. YouTube isn't great about their thumbnails so there are 4 options:- Default: Thumbnail is resized into 120 x 90 with black bars added if needed to fill the aspect ratio.
- Medium (default option): Thumbnail is resized into 320 x 180 with black bars added if needed to fill the aspect ratio.
- High: Thumbnail is resized into 480 x 360 with black bars added if needed to fill the aspect ratio.
- Full Resolution is the absolute highest resolution provided by YouTube. This method isn't part of the API, but is the closest to the original thumbnail uploaded by the user.
Creating a custom partial
Under the / Partials
menu, create a new partial called latestVideos/default.htm
.
Inside the videos array each video object contains the following:
link
: URL of the videotitle
: Video titlethumbnail
: URL of the maximum resolution version of the thumbnaildescription
: Excerpt of the video descriptionpublished_at
: Carbon date of the publish date
Simple partial
{% set videos = __SELF__.videos %} {% for video in videos %} <a href="{{ video.link }}"> <img src="{{ video.thumbnail }}" alt="{{ video.title }}"> <span>{{ video.title }}</span> </a> {% endfor %}
Settings
Key
: YouTube API key is needed to access the API.cached
: Time in minutes that the results should be cached for
Getting an API Key
- Head on over to https://console.developers.google.com/project and either select your existing project or create a new one.
- Under "APIs" enable "YouTube data API v3"
- Go to Credentials and under "Public API access" select "Create a new key"
- Copy the new API Key into the settings and save.
Latest videos
Use the Videos
component to display a list of the latest videos for a channel. The component has the following properties available for config:
-
_id
: The YouTube channel id can be found over at https://www.youtube.com/account_advanced. -
_items
: Maximum number of videos to display, at this time there is no pagination support.
Creating a custom partial
Under the / Partials
menu, create a new partial called latestVideos/default.htm
. Inside the videos array each video object contains the following:
id
: YouTube ID of the videolink
: URL of the videotitle
: Video titlethumbnail
: URL of the maximum resolution version of the thumbnaildescription
: Excerpt of the video descriptionpublished_at
: Carbon date of the publish date
Simple partial
{% set videos = __SELF__.videos %} {% for video in videos %} <a href="{{ video.link }}"> <img src="{{ video.thumbnail }}" alt="{{ video.title }}"> <span>{{ video.title }}</span> </a> {% endfor %}
-
Richard Clark
Found the plugin useful on 7 Apr, 2019
Nice work Thx
-
Michael Wanyoike
Found the plugin useful on 15 Sep, 2016
Works great but conflicts with Google Analytics plugin. Something to do with Google\Auth\CacheInterface
-
GrCOTE7
Found the plugin useful on 20 May, 2016
Hi, all,
I endly succeed in do and work this plugin (I start with OC...)... But, is it possible, instead of have a channel in the page, to have a playlist ?
Yanks for your answer.
-
1.0.8 |
Fixed video links working over https but not thumbnails. Mar 23, 2016 |
---|---|
1.0.7 |
Full resolution thumbnails are now loaded over https Mar 23, 2016 |
1.0.6 |
Updated to the latest Google API Library Mar 07, 2016 |
1.0.5 |
Made thumbnail resolution selection easier Jun 09, 2015 |
1.0.4 |
Fixed caching issue causing no results to display Jun 09, 2015 |
1.0.3 |
Thumbnail resolution is now selectable Jun 08, 2015 |
1.0.2 |
Made YouTube client more accessible to third parties Apr 26, 2015 |
1.0.1 |
First version of Bluhex - YouTube Videos Mar 16, 2015 |