Help:How To Embed a YouTube Video/Details

From Drunkapedia
Jump to: navigation, search

This page documents how to use the older YouTube video extension (which was adapted to embed videos from several other sites) on any page using simple code. The video is not uploaded to ACCWiki, but embedded, meaning it is stored on YouTube, then called from there to be viewed on ACCWiki. Clicking the YouTube logo in the lower right of a playing video will take you to the YouTube page for that video.

What video sites are supported?

This extension allows the embedding of videos from YouTube, Google Video, Archive.org, Blip.tv and GameTrailers.com, as well as Tangler forums.

How do I add a YouTube video?

To add a YouTube video, you need the id code for the video. The easiest way to find this is to look at the URL of the You Tube page for the video. The string of letters and numbers after "v=" in the URL is the id code. So for the URL: http://www.youtube.com/watch?v=lVuXnUr2VUQ the id code would be lVuXnUr2VUQ. If you aren't sure what to use, you can add the whole url in place of the id code.

YouTube videos are embedded using two tags, with the id code for the video you want to show between them:

<youtube>id code</youtube> 

"id code" is the code from the URL. So in our example, you would use:

<youtube>lVuXnUr2VUQ</youtube> 

Can I display the video at a smaller size?

You can change the width and height of the video box, to a maximum of 640x385 pixels. For best results, the height should be about 3/5 (60%) of the width. Some examples of good ratios include 200x120, 375x275, and 500x300.

If you specify width and height, and those settings are not in proportion to the YouTube screen, then you will have empty space around the video. In most cases, the width determines the screen size in this situation.

  • Width is controlled with width="xxx", where xxx is the number of pixels. The default is 640 pixels.
  • Height is controlled in the same way with height="xxx". The default is 385 pixels.

A full example would be:

<youtube width="200" height="120">lVuXnUr2VUQ</youtube>
width="500" height="300":

<youtube width="500" height="300">lVuXnUr2VUQ</youtube>

width="375" height="225":

<youtube width="375" height="225">lVuXnUr2VUQ</youtube>

width="200" height="120":

<youtube width="200" height="120">lVuXnUr2VUQ</youtube>

Can I add a caption?

You can add a caption to a video using the image thumbnail styles. You can use all normal wikitext formatting in your caption.

The basic form is:

<div>
<div class="thumbcaption">CAPTION</div>
<youtube width="200" height="120">ID</youtube>
</div>

This code places the caption, in a smaller font, below the video:

<div class="thumb tright" style="width:256px;"> 
<div class="thumbinner">
<youtube width="200" height="120">ID</youtube>
<div class="thumbcaption">
CAPTION
</div>
</div>
</div>

Can I center the video, or move it to the right?

This is an important caption.

<youtube width="200" height="120">lVuXnUr2VUQ</youtube>

You can control video placement using the image thumbnail style.

In this example you can add a video with a width of 250px, float it to the right of the page, and add a caption at the top. Simply edit the ID and CAPTION and pixel sizes to suit.

<div class="thumb tright" style="width:256px;">
<div class="thumbinner">
<div class="thumbcaption">CAPTION</div>
<youtube width="200" height="120">ID</youtube>
</div>
</div>

Other usable video sites

The video extension also supports several other video hosting sites. Replace "id" with the unique identifier each site uses in their URLs.

Google Video
  • <gvideo gvid="id" width="width" height="height" />
  • <gvideo width height>id</>
Archive.org audio and video
  • <aovideo aovid width height />
  • <aoaudio aoaid width height />
GameTrailers.com video
  • <gtrailer gtid="id"/>
  • <gtrailer>id</gtrailer>
Tangler forum
  • <tangler tid gid />
  • <tangler> tid | gid </tangler>
  • <tangler>id=xxx|gid=xxx</tangler>

Examples of embedded video