A simple module that allows you to embed youtube, google video, or remove .flv video files via the "Add Items" interface for any album.
I was faced with a need to share Home Video Clips with family and friends all over the world. I don't have the internet bandwidth to stream these videos directly from my server at home where my Gallery2 installation resides. My only option was to host my Home Videos on sites outside my home, and embed them as items in my gallery album pages directly. Other posts suggested ways of doing this that involved pasting the embedded video player code directly in the description field of a photo item in gallery. This was tedious, and I was seeking a faster, more automated way, of adding video content in a similar fashion. This module attempts to automate that exact process.
This module extends ItemAddPlugin. It takes, as input, a URL in the "Add Items" interface of Gallery to a youtube, googlevideo, or remote .flv file, and adds an embedded video object in a gallery item to that URL. It uses the youtube API to extract the title, description, and thumbnail for a youtube video URL. It also parses the raw HTML of the video page for google videos (since no google video API exists yet) to get this same information for those URLs.
There are no additional external PHP library dependencies or .ini changes required, and no direct patches needed to the underlying Gallery2 framework for this module to function properly, with 1 patch exception if you want to edit the items after they are added to your albums. Because this module is still using the "embed videos via html in the description field of a gallery photo item", there is a patch that must be made to the modules/core/classes/GalleryUtilities.class if you want to edit the item after it has been added to your gallery. If you don't want to edit the item after it has been added to your gallery, no patch is required. The process of editing the item will remove the embedded markup in the description field if this patch is not made, and your site is not configured to allow for rawHTML in the description field. This gallery forum post mentions the patch which consists of the following steps:
1) Comment out line 859 in modules/core/classes/GalleryUtilities.class like this: /* $html = $parser->parse($html); */
2) Make sure that "Site Admin -> General -> Embedded Markup" is set to "Raw HTML".
For versions 2.2.4 and later of gallery2, it has been reported that these modifications need to be made in order to get the video embedding to work at all (not just for editing/updating as in previous gallery2 versions).
The EmbedVideo module also relies on the "Thumbnail Manager" module for a default thumbnail to use for remote .flv or .swf files that can be added to the site. If you don't have this module installed, you will need to define a valid URL to a valid thumbnail to use for these types of links by setting the flvThumbnail variable in the module.
Despite my best efforts to create bug free code, you may come across something that doesn't quite work right. If you can't get the module to work as advertised, or get an error you don't understand, the module has a built in debug mode that can help. Under your site admin, click on the "Embed Video" link, and add a parameter called "debugOutput" and set it to "true". Proceed to add the video URL that is giving you the trouble. The resulting webpage will be full of debug information about the process it underwent to add your video. Right click on the webpage that is shown in this debug mode, and save it as a local .html file on your system. Next, add it as a file attachment in a post you make to the message forum. I will look at your attached html file, and get back to you with any insight I may have.
2007-06-12 - 1.0.0 - Initial Release
2007-06-23 - 1.0.1 - Fixed bug related to override parameters not trumping default parameters & youtube URL match being too restrictive.
2007-06-28 - 1.0.2 - Added remote file "does not exist check". Fixed google video title parsing bug. Added support for metacafe.com & video.yahoo.com. Added new useRemoteSize & autoStart parameters.
2007-07-01 - 1.0.3 - Added thumbnail resize capability for thumbnails used from remote video servers.
2007-07-09 - 1.0.4 - Fixed google video size issues. Improved debug output.
2007-08-30 - 1.0.5 - Added support for .swf file types. Added parameter to control disabling/enabling youtube embedded related videos. Improved thumbnail sizing logic.
2007-10-31 - 1.0.6 - Added support for watermarking the thumbnails of the embedded videos
2007-11-17 - 1.0.7 - Added support for adding revver, dailymotion, and divshare embedded videos. Added support for adding youtube embedded videos without a youtube developer ID. Fixed default watermark alignment.
2007-11-28 - 1.0.8 - Added support for StickAm and Myspace embedded videos. Added new wordwrap parameters for summaries and descriptions.
2008-04-17 - 1.0.9 - Added support for high quality youtube video urls. Updated dailymotion parsing algorithms. Added support for adding vimeo.com videos. Added support for new youtube API (GDATA) and deprecated youtubeDevId entry.
2008-05-28 - 1.1.0 - Fixed google video thumbnail parsing algorithm. Added support for generic site embed video content.
2008-09-13 - 1.1.1 - Added ".mp4" type to supported remote embedded types. Added support for "youtube.com/v/" style video URLs. Fixed myspace video parsing algorithm.
2008-09-23 - 1.1.2 - Loosened URL pattern matching, dropping "www." and ".com" expectations. Fixed stickam and vimeo video parsing algorithms.
2009-02-01 - 1.1.3 - Fixed google video thumbnail parsing algorithm. Added code to remove trailing whitespace from url.
2009-06-17 - 1.1.4 - Fixed dailymotion parsing algorithm. Added new allowFullScreen youtube parameter. Fixed google video thumbnail parsing algorithm.
2009-10-13 - 1.1.5 - Added support for Animoto embedded videos. Added new centerVideo parameter.
2010-10-02 - 1.1.6 - Fixed vimeo and dailymotion embedded video parsing algorithms. Added urlencode to youtube api feed.