This module can be used to manage galleries or albums of videos that are hosted on sites such as Youtube, Dailymotion, Google Videos, Yahoo Videos, Veoh, MSN (or Bing) Videos, Vimeo, MySpace or MetaCafe.
It is also possible to deal with videos stored on your web server. Supported formats are mkv, divx, avi, mp4 (using the divx web player plugin) or flv (JarisFLVPlayer), ogg (cortado applet), wmv (Silverlight VideoPlayer.xap or Windows Media Player), ...
HVA manages 3 levels: category, video album (or gallery) and video itself. It allows embedding videos one by one, in fancybox galleries (default mode) or in paged list .
Make sure your users have the appropriate permissions. If you are
not using the access restriction option (see settings), the
"HostedVideoAlbums: Normal user" permission will be enough
to use the module. In the settings tab, you can choose which tabs
will be displayed for the normal user. Only the administrator and
users with the "HostedVideoAlbums: Advanced" permission
will have access to settings tab.
If you wish to define
level-specific permissions, activate the access restriction option in
the settings tab and give the "HostedVideoAlbums: Manage
name_of_level" permission to the appropriate users.
To use this module, you will need to create the 3 levels (ie category, album and video). First, you will have to create the categories in the "Categories" tab, then create the video albums in the "Video Albums" tab and then the videos themselves in the "Video" tab.
For categories, all you need to provide is the display name of the
category, and optionnaly its alias (used with the "alias"
parameter) and its description.
For albums, you will also provide
a name, an alias (optional), the category to which the album is
attached, a description (optional), a language (in the form fr or
en-US), and the default width and height of the videos in this album
(used when the width or height of the video is not set).
For videos, you need to provide a name, an alias (optional), the album to which the video is attached, a description (optional), the video site where the video is hosted, the video identifier (see below), optionally the width an height of the video (if not set, the default one of the album is used), and finally a thumbnail for preview (see below for details on thumbnails)
For Youtube, the video id is the last part of the
url after "v=". For instance, in
http://www.youtube.com/watch?v=7SZtGvXkEIw, it's "7SZtGvXkEIw".
For
Dailymotion, it's the last part of the url after the
last "/". For instance, in
http://www.dailymotion.com/video/xcqa0g_cornershop-who-fingered-rock-n-roll_music,
it's "xcqa0g_cornershop-who-fingered-rock-n-roll_music".
For
Yahoo videos, it's also the last part of the url
after the last "/". For instance, in
http://video.yahoo.com/watch/7095687/18465878, it's "18465878".
For
Google videos, it's the last part of the url after
"docid=". For instance, in
http://video.google.com/videoplay?docid=7521423388637542657#, it's
"7521423388637542657#"
For Veoh, it's
the last part of the url after the last "/". For instance,
in
http://www.veoh.com/browse/videos/category/music/watch/v555658setkP3D8,
it's "v555658setkP3D8".
For MSN or Bing Videos,
use "msn video" and look in the embedding code for
"player.v=...", the video id is the hexa string after
"player.v". For instance, in
"player.v=fcc409a0-a8b0-4243-83b2-ff4a5eb3a86e", the id is
"fcc409a0-a8b0-4243-83b2-ff4a5eb3a86e"
For metacafe,
it's the numeric part in the url. For instance, in
"http://www.metacafe.com/watch/4474839/pasta_013/", it's
4474839
For MySpace, it's the part after
"videoid=" in the url. For instance, in
"http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=104317949",
it's 104317949
For Vimeo, it's the last part in
the url. For instance, in "http://vimeo.com/10875088", it's
10875088
To insert a video hosted on your own site, choose the "local.XXX" type depending on the video kind:
divx (avi, divx, mkv): local.divx
flash video (flv): local.flv
quicktime (mov): local.mov
windows media (wmv): local.wmv or local.silverlight
ogg vorbis (ogg) : local.ogg
The video id is the complete filename from the cmsms site root (for instance, if the movie is in the "MyMovies" directory at the cmsms site root and is named "MyMovie.avi", the id is "/MyMovies/MyMovie.avi".
The width and height of videos can generally be found in the "embed" code of the video sites. For each of these sites, either directly in the page or by clicking on a link in the page (youtube & google videos) or by clicking on the export button in the video (dailymotion), you will be provided with a piece of html code containing a width and a height.
For most of the hosted videos, HVA is able to derive automatically the thumbnail image of the video. This is the case for youtube, dailymotion, yahoo videos, google videos, vimeo, veoh, metacafe and myspace. So you don't need to provide a thumbnail for these videos.
It's not the case for msn video (if someone can tell me how to do this, he's welcome) and for all local videos. For all of them, you must provide a thumbnail (if not, a default thumbnail is provided). To provide a thumbnail, when entering the video parameters, click on the little directory icon near the thumbnail field, then either choose an existing image or upload it from your local disk. The image will be automatically resized to 120x90. You can arrange your thumbnails in sub directories (for instance one directory per album). The default directory where thumbnails are stored is upload/images/HVAThumbs.
To call the module, simply use the following tag:
{cms_module
module="HostedVideoAlbums" what="<level>"}
If you omit the what parameter, the whole list of videos
will be displayed. It is equivalent to:
{cms_module
module="HostedVideoAlbums" what="video"}
{cms_module module="HostedVideoAlbums" what="category"} will display the categories list.
{cms_module module="HostedVideoAlbums" what="album"} will display the albums list, whatever the category.
You may also ask for elements who belong to a specific
parent:
{cms_module module="HostedVideoAlbums"
parent="alias_of_parent"}
The alias can be a category or
an album alias.
You may finally ask for a specific element:
{cms_module
module="HostedVideoAlbums" alias="alias_of_item"}
You will need to create a default category anyway. Name it for
instance "default" then create all your albums in this
category and use the
{cms_module module="HostedVideoAlbums"
what="album"} to display all the albums.
Same, if you
don't need the video albums, create a default album in the default
category and link all your videos to this album. Then insert the
videos using
{cms_module module="HostedVideoAlbums"
what="video"}
You may limit the number of items to be shown on one
page:
{cms_module module="HostedVideoAlbums"
nbperpage="5"}
In the template, you can build the page
menu using the following tags (see ListLinks or ListVideos
templates):
{$page_showing}, {$page_totalitems},
{$page_pagenumbers}, {$page_next}, {$page_previous}
To get a list of item that meet specific criteria, you can create
a query using the queries tab of the admin panel, and call them using
the "query" parameter:
{cms_module
module="HostedVideoAlbums" query="5"}
If the option to allow manuel sql queries is enabled (see
"Settings" tab), you may also provide the sql query
directly with the query parameter. For example:
{cms_module
module="HostedVideoAlbums" what="video"
query="A.date_modified > '2009-03-15' AND A.active = 1"}
The
query parameter can only hold the WHERE clause of the query, and
should not include the WHERE command itself. To avoid problems, the
prefix "A." should be used before field names (where
applicable, the "B." prefix can be used to specify criteria
on the parent's fields).
Although the abstraction layer is not
easily prone to injections, remember that activating this option
means giving a sql opening within the templates and be careful.
You can choose for each level which template will display this level.
By default, for the category level, only one template is provided:
ListLinks. This template displays in a bulleted list, for each
category, the name of the category and it's description. The name is
an hyperlink to the page displaying all the albums of the
category.
At the album level, you also use ListLinks which will
display in a bulleted list, for each album of the category, the name
of the album and its description. The name is an hyperlink to the
page displaying all the videos of the album.
At the video level,
you can choose between FancyVideoGallery, ListLinks and ListVideos:
FancyVideoGallery (which is the default choice) will display videos as thumbnails. When clicking on a thumbnail, a fancybox will appear and play the video. On the fancybox, left and right arrows allows to change to the next or previous video.
ListLinks will display as usual in a bulleted list, for each video of the album, the name of the video and its description. The name is an hyperlink to the page displaying the video which is displayed using the "detail template" which is by default DisplayVideo.
ListVideos will display directly in the album's page, for each video of the album, the name of the video, its description and the video itself.
It's quite simple to add a new hosting site!
First, you must have a look at the "embedding code" of this site and locate what is the form of the video id and where it should be inserted in the url (movie parameter of the embedding code). Then just add the new site name in the "Sites" tab then edit the EmbedVideo template and add just before the {/if} line a set of lines in the form:
(WARNING: Don't modify directly the EmbedVideo template, make a copy as it might be rewritten by the next module version)
{elseif $item->site_namevalue=="<the new
site name>"}
{assign var="movie"
value="<begining of the url>`$item->videoid`<end of
the url>"}
Look at the other cases to find the inspiration :)
If
you do nothing for the thumbnails of new types of videos or sites,
you will need to provide the images manually.
It may be
considerably more complex to take into account automatically the
thumbnails for hosted videos sites. For this, we must modify (a copy
of) FancyVideoGallery template and add lines of the form (eg
vimeo)
{elseif $item->site_namevalue=="vimeo"}
{$aswf}"http://vimeo.com/moogaloop.swf?clip_id={$item->videoid}&server=vimeo.com&show_title=true&show_byline=1&color={$item->color1}&fullscreen={$item->fullscreen_int}">
{$img}{php}
$item= $this->get_template_vars('item');
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/".$item->videoid.".php"));
$url = $hash[0]['thumbnail_small']; echo "'$url'";
{/php}>
The way to automatically deduce
the url of the thumbnail is different for each site and you must
investigate to find out how to ...
These are special actions you can use in the module declaration to create sitemaps, breadcrumbs and so on...
To embed a video inside an HVA template, you can use the
"embedvideo" action:
{cms_module
module="HostedVideoAlbums" action="embedvideo"
item=$item}
The "item=$item" parameter is mandatory.
You may use the action "link" to create a link to
the default action, using the same parameters:
{cms_module
module="HostedVideoAlbums" action="link"
what="video" random="1"}
would create a link
to a random element of this level.
You may use the action "sitemap" to create a
video sitemap:
{cms_module module="HostedVideoAlbums"
action="sitemap"}
You can select the levels using the
"what" parameter, and may select more than one using "|"
: what="level1|level2".
Other available parameters for
this action are "mode" (google, urllist or frontend),
"detailpage" and "inline".
This will help you include the module entries to a google sitemap, provided that your elements are all displayed on the same page.
*** If you are using the google sitemap generator module ***
Open your sitemap generator (gsitemap.php), and just before the
closure of the urlset (echo ' </urlset>'.
"\\n";), add the following lines:
$modulename = "HostedVideoAlbums";
if( isset($gCms->modules[$modulename]) && $gCms->modules[$modulename]["active"] && $themodule = $gCms->modules[$modulename]["object"]){
// HERE YOU MUST PUT THE ID OR ALIAS OF THE PAGE USED TO DISPLAY THE MODULE ELEMENTS:
$detailpage = "MYPAGE";
$params = array("mode"=>"google", "detailpage"=>$detailpage);
$themodule->DoAction("sitemap", "", $params);
}Of course, enter a detailpage, be it an id or page alias.
Note that you could also use the "what" parameter to specify which levels you wish to see displayed (you can specify several levels with "level1|level2" and so on). Otherwise, all levels will be displayed.
*** If you are using the SiteMap Made Simple module ***
Simply put the code above in a UDT (user-defined-tag), and call
the UDT at the end of your sitemap's template, just before </urlset>.
You may use the action "search" to display a
search form:
{cms_module module="HostedVideoAlbums"
action="search"}
Use the "searchmode"
parameter to switch between advanced (default) and simple mode. You
may specify the level in which to search using the "what"
parameter. You cannot use the advanced search mode in all levels at
the same time.
The following parameters can be used with the
search action: what, limit, nbperpage, orderby, detailpage,
listtemplate, inline, searchmode.
See
HostedVideoAlbums/templates/search.tpl to modify the search form.
This module has been originally created with CTLModuleMaker and
modified after, and is released under the GNU
Public License.
Parameters for the Vimeo, MetaCafe and MySpace
sites are inspired from the webvideos module.
The local flash
player is JARIS : Web Page: http://jaris.sourceforge.net/, Project
Page: https://sourceforge.net/projects/jaris/