Cómo crear un enlace o bloque para un video tipo Popup Lightbox desde Drupal 6
Hola, hace días estaba buscando esta solución y gracias a una amiga, ya les tengo la manera:
Block,
Function
Module Hook menu
Module thickbox
player libraries
That its,
1. Instalar Thickbox
2. Crear un block con el siguiente codigo <a href="//localhost/miweb/video" class="thickbox">Enlace abrir</a>
3. Una function hook menu que llame miweb/video
Así:
3.1 Crear una función en cualquier modulo ya sea propio o de los instalados este codigo:
function bunnerslideshow_menu() {
$items = array();
$items['video'] = array(
'title' => 'RSS feed',
'page callback' => 'get_video',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function get_video(){
$html = getPlayer("http://localhost/sites/default/files/video/videosubido.flv" ,"","400","330");
,"","400","330");
print $html;
}
/**
*Funcion que obtiene el embed de un video, debes instalar un directorio en /sites/all/libraries/jwplayer, este jwplayer lo descargas, google.com/ buscar
$video es la ruta absoluta del donde esstà el video
la obtuve con sql, pero la puedes poner fija
$dImg, esta es el preview del video
**/
function getPlayer($video,$dImg,$ancho, $alto , $iddiv=0){
$base_path=$GLOBALS['base_url']."/sites/all/libraries/jwplayer";
$player ="<object id=\"player".$iddiv."\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" name=\"player\" width=\"$ancho\" height=\"$alto\">
<param name=\"movie\" value=\"$base_path/player.swf\" />
<param name=\"allowfullscreen\" value=\"true\" />
<param name=\"allowscriptaccess\" value=\"always\" />
<param name=\"flashvars\" value=\"file=$video&image=$dImg&skin=$base_path/glow.zip\" />
<param name=\"wmode\" value=\"transparent\" />
<embed
type=\"application/x-shockwave-flash\"
id=\"player2\"
name=\"player2\"
src=\"$base_path/player.swf\"
width=\"$ancho\"
height=\"$alto\"
allowscriptaccess=\"always\"
allowfullscreen=\"true\"
flashvars=\"file=$video&image=$dImg&skin=$base_path/glow.zip\"/>
</object>";
return $player;
}
4. subir el video, capturar esa ruta
listo.
Block,
Function
Module Hook menu
Module thickbox
player libraries
That its,
1. Instalar Thickbox
2. Crear un block con el siguiente codigo <a href="//localhost/miweb/video" class="thickbox">Enlace abrir</a>
3. Una function hook menu que llame miweb/video
Así:
3.1 Crear una función en cualquier modulo ya sea propio o de los instalados este codigo:
function bunnerslideshow_menu() {
$items = array();
$items['video'] = array(
'title' => 'RSS feed',
'page callback' => 'get_video',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function get_video(){
$html = getPlayer("http://localhost/sites/default/files/video/videosubido.flv" ,"","400","330");
,"","400","330");
print $html;
}
/**
*Funcion que obtiene el embed de un video, debes instalar un directorio en /sites/all/libraries/jwplayer, este jwplayer lo descargas, google.com/ buscar
$video es la ruta absoluta del donde esstà el video
la obtuve con sql, pero la puedes poner fija
$dImg, esta es el preview del video
**/
function getPlayer($video,$dImg,$ancho, $alto , $iddiv=0){
$base_path=$GLOBALS['base_url']."/sites/all/libraries/jwplayer";
$player ="<object id=\"player".$iddiv."\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" name=\"player\" width=\"$ancho\" height=\"$alto\">
<param name=\"movie\" value=\"$base_path/player.swf\" />
<param name=\"allowfullscreen\" value=\"true\" />
<param name=\"allowscriptaccess\" value=\"always\" />
<param name=\"flashvars\" value=\"file=$video&image=$dImg&skin=$base_path/glow.zip\" />
<param name=\"wmode\" value=\"transparent\" />
<embed
type=\"application/x-shockwave-flash\"
id=\"player2\"
name=\"player2\"
src=\"$base_path/player.swf\"
width=\"$ancho\"
height=\"$alto\"
allowscriptaccess=\"always\"
allowfullscreen=\"true\"
flashvars=\"file=$video&image=$dImg&skin=$base_path/glow.zip\"/>
</object>";
return $player;
}
4. subir el video, capturar esa ruta
listo.

Comentarios
Publicar un comentario