VideoLightbox is a desktop application (for Mac and Windows) that generates a video gallery from a list of YouTube, Vimeo and other video streaming services.
All you need to do is feed it the URL of the service and the ID of the video to add to the gallery; it gives examples for each of the services that it supports on the input form.
You can select a number of templates for formatting the thumbnails, as well as the lightbox overlay for the player.
It then uploads the HTML page it has generated and the necessary support files to a specified remote location with its built-in FTP client. The list of videos is saved on your hard drive for later addition or deletion of videos to the gallery.
I’ve created a snippet that will read in the HTML page, parse it and chop out the gallery code, load up all of the necessary .css and .js files, and also correct the generated paths to the thumbnails for the gallery. The snippet uses the resource alias as the filename, presuming you told the VideoLightbox application to use that as its filename (alias.html). It also presumes the file was loaded into the assets/media folder. It returns only the section of HTML for displaying the gallery and playing the videos. I found it necessary to configure the QuickManager+ plugin to be disabled for the page the gallery is on; it uses JQuery Tools with its own embedded JQuery library.
<?php
// load up the css and js files
$modx->regClientCSS('assets/media/engine/css/videolightbox.css');
$modx->regClientCSS('<style type="text/css">#videogallery a#videolb{display:none}</style>');
$modx->regClientCSS('assets/media/engine/css/overlay-minimal.css');
$modx->regClientStartupScript('assets/media/engine/js/jquery.tools.min.js');
$modx->regClientStartupScript('assets/media/engine/js/swfobject.js');
$modx->regClientStartupScript('assets/media/engine/js/videolightbox.js');
// read and parse the generated file
$path = 'assets/media/'; // where the files were uploaded
$filename = $modx->documentObject['alias']; // use the page's alias for the filename
$file = file_get_contents($path . $filename . ".html");
$gallery = explode('BODY', $file);
$div = $gallery[1]; // break out the relevant gallery HTML code
$div = ltrim($div, 'section -->'); // clean up the residual from the explode()
$div = rtrim($div, '<!-- End VideoLightBox.com');
$div = str_replace('src="data', 'src="'. $path . 'data', $div); // correct the image path
return $div;
?>
I have contacted the authors of the application to ask about modifying the HTML generated, but until and unless this can be looked into this snippet does the job.