TXP Plugins
arc_youtube :: Jun 7, 05:50 PM
Easily embed Youtube videos and playlists in articles and customise the appearance of the player.
I am aware that there are other Youtube plug-ins for Textpattern out there, but I believe mine is a little different.
With arc_youtube you can customise the appearance of the player, setting its size, colour scheme, and apply a border. Videos can be associated with articles using a custom field and are identified using either the video’s ID or URL.
Installation
To install go to the ‘plugins’ tab under ‘admin’ and paste the plugin code into the ‘Install plugin’ box, ‘upload’ and then ‘install’. Finally activate the plugin. Please note that you will need to set-up a custom field to use for associating videos with articles, unless you choose to directly embed the new tag in the article text.
Syntax
<txp:arc_youtube />
<txp:arc_youtube video=“ta7VHKGuoJY” />
or,
<txp:arc_youtube video=“http://uk.youtube.com/watch?v=ta7VHKGuoJY” />
Usage
Video and playlists
| Attribute | Description | Default | Example |
|---|---|---|---|
| video | Youtube url1 or video ID for the video you want to embed | unset | video=“ta7VHKGuoJY” |
| playlist | Youtube playlist ID for the playlist you want to embed | unset | playlist=“2DBFB60D581AB901” |
| custom | Name of the custom field containing video IDs/urls associated with article | Youtube ID | custom=“video” |
1 The url can be either for an individual video or for a playlist.
Basics
| Attribute | Description | Default | Example |
|---|---|---|---|
| link | Set to ‘1’ to show a link to the Youtube video page below the player; the link text will be the URL or the text between opening and closing tags | 0 | link=“1” |
| label | Label for the video | no label | label=“Youtube video” |
| labeltag | Independent wraptag for label | empty | labeltag=“h3” |
| wraptag | HTML tag to be used as the wraptag, without brackets | unset | wraptag=“div” |
| class | CSS class attribute for wraptag | arc_youtube | class=“youtube” |
Customising the Youtube player
You can customise the appearance of the Youtube flash player using this plugin to define colours, size, and language settings.
| Attribute | Description | Default | Example |
|---|---|---|---|
| width | Width of video | 425 | width=“200” |
| height | Height of video | 344 | height=“150” |
| color1 | Six-digit hexadecimal colour code (if color1 and color2 are unset then the default Youtube colour scheme is used) | unset | color1=“2b405b” |
| color2 | Six-digit hexadecimal colour code | unset | color2=“6b8ab6” |
| border | ‘1’ to show border, ‘0’ to hide border | 0 | border=“1” |
| fs | ‘1’ to allow full screen, ‘0’ to disable full screen mode | 1 | |
| auto | ‘1’ to autoplay the video, ‘0’ to turn off autoplay (default) | 0 | |
| lang | Language code for player, by default this is set to English “en” | en | lang=“fr” |
Examples
Example 1: Use custom field to associate video with an article
<txp:arc_youtube custom=“Youtube” />
Example 2: Customise the appearance of the player and associate video with custom field
<txp:arc_youtube color1=“006699” color2=“54abd6” border=“1” custom=“Youtube” />
This will place a border around the player and change its colour scheme to a blue one. As example 1, the video is selected using an article’s custom field called ‘Youtube’.
Example 3: Small video player with fixed video
<txp:arc_youtube width=“200” height=“150” video=“ta7VHKGuoJY” />
Here the video is defined within the tag using the video attribute which has been given the value of Youtube’s video ID, alternatively this value could have been the video’s URL.
Example 4: Youtube page link below player
<txp:arc_youtube link=“1”>Link to Youtube page</txp:arc_youtube>
Example 5: Embed a playlist
<txp:arc_youtube video=“http://www.youtube.com/view_play_list?p=2DBFB60D581AB901” />
This embeds a Youtube playlist (a single player that cycles through the videos in the playlist). Alternatively the playlist ID can be used using the ‘playlist’ attribute:-
<txp:arc_youtube playlist=“2DBFB60D581AB901” />
Change-log
- v0.2 (7/6/9)
- now works with playlists
- new ‘auto’ attribute to enable video autoplay
- updated help documentation
In development
In order of importance:-
Ensure valid XHTML output, currently the plugin fails on this.Fixed as of version 0.1.2.- Ability to embed multiple videos.
Plugin details
Initial release: 12 November 2008
Current version: 0.2
[ download ]
Comment
Recent plugins
- arc_admin_comment_preview
- arc_youtube
- arc_article_file
- arc_recent_youtube
- arc_popular_category_cloud
Textpattern links
Textpattern forums
Textpattern's support forums.
Textpattern Resources
A directory of plugins, tutorials, and other resources for and by the Textpattern community.
TXP Tips
Tips, tutorials, and code to help build better Textpattern websites.
We Love TXP
Design gallery of sites using Textpattern.
Hello,
somehow the plugin seems not to work.
Did it according to your description and used following example
<txp:arc_youtube v=“V5BxymuiAxQ” />
but it does not show up.
Any ideas?
— Michael · Jan 13, 07:11 AM · #
Michael, the attribute needs to be video not v; so in your case it would be:-
<txp:arc_youtube video=“V5BxymuiAxQ” />
Does that help?
— Andy · Jan 13, 01:05 PM · #
Hi, Thanks a lot for this great plugin, really useful.
Is it possible to embed playlists?
— Giuseppe · Jun 4, 02:20 PM · #
Hi Giuseppe, I’ve just updated the plugin and have included the ability to embed playlists with the new version (v0.2). I hope this helps and I’m glad you are finding the plugin useful.
— Andy · Jun 7, 05:54 PM · #