Comunidad de diseño web y desarrollo en internet online

Reproductor de video para mi web

Citar            
MensajeEscrito el 25 Mar 2010 10:46 pm
Hola.
Tengo que poner videos en mi web.
Y nesecito de un reproductor que tenga una lista con los videos que quiero que se vean.
Nesecitaría de algún tutorial para hacerlo. O el nombre de algún programa.
Espero su ayuda.
Gracias...

Por Klorp

43 de clabLevel



 

msie8
Citar            
MensajeEscrito el 26 Mar 2010 09:32 pm
Bueno si quieres videos en tu web seria mejor que los colocaras via youtube haciendo un canal propio puedes tener tu playlist y te funcionaria de maravilla

si quieres mas bien que tus videos esten en tu servidor busca por reproductores de video en flash que te solucionarian eso rapidamente....


espero te sirva


bye :cool: :cool:

Por luisj135

7 de clabLevel



 

Bogota - Colombia

firefox
Citar            
MensajeEscrito el 28 Mar 2010 07:46 pm
Otra opción si quieres es vimeo que es como youtube pero a mi gusto es más vistoso.

Un abrazo.

Por RraS

25 de clabLevel



Genero:Masculino  

Madrid

firefox
Citar            
MensajeEscrito el 29 Mar 2010 07:02 am
Hola,

Si lo que deseas es que alguien de fuera vea videos que estan en tu servidor utilizando paginas de php creadas por ti, hay un buen ejemplo sería el siguiente.

<?php

// Class for use with PHP5 scripts only
// Based on Douglas Borella Iaintsky 10/2007 [email protected]

class VideoPlayer {

private $errors = array(
1 => 'No archive joined.',
2 => 'Invalid extension.',
3 => 'File error.',
4 => 'The file does not exist.'
);
/**
* Error ocurred
* @var int
*/
private $error = 0;
/**
* url of the video
* @var String
*/
private $video = NULL;
/**
* Extension of the video
* @var String
*/
private $extension = NULL;
/**
* Accepted extensions for play
* @var mixed
*/
private $accepted_extensions = array('wmv','asx','flv','mov','rmv','rmvb','swf','mpg','mpeg');
/**
* Correct player
* @var String
*/
private $player = NULL;
/**
* Width of the player
* @var int
*/
private $width = 0;
/**
* Height of the player
* @var int
*/
private $height = 0;
/**
* If the player is autoplay or no
* @var String
*/
private $autoplay = 'false';
/**
* If the player show controls or no
* @var String
*/
private $controls = 'false';
/**
* Javascript for flash flv player
* @var String
*/
private $swfObject = NULL;

/**
* Class constructor
*
* @param String video // Url of the video
* @param int width // Width of the player
* @param int height // Height of the player
* @param String autoplay (true, false) // If the player is autoplay or no
* @param String constrols (true, false) // If the player show controls or no
*/
public function __construct($video, $width, $height, $autoplay = 'false', $controls = 'true') {

$this->video = $video;
$this->width = $width;
$this->height = $height;
$this->autoplay = $autoplay;
$this->controls = $controls;

if (!$this->verifyVideo()) { return false; }

if(!$this->verifyExtension()) { return false; }

}

/**
* Verify if archive exists
*
*/
private function verifyVideo() {

$video = isset( $this->video ) ? $this->video : false;

if( !$this->video || $this->video == '' ){
$this->error = 1;
return false;
} else {
return true;
}

}

/**
* Verify the video extension
*
*/
private function verifyExtension() {

$this->extension = end(explode('.', $this->video));

if (!in_array($this->extension, $this->accepted_extensions)) {
$this->error = 2;
return false;
} else {
return true;
}

}

/**
* Return the correct
*
*/
private function returnPlayer() {

/// Windows media player
if (in_array($this->extension, array('wmv', 'asx'))) {

$this->player =
'<object type="video/x-ms-wmv"
data="'.$this->video.'"
width="'.$this->width.'" height="'.$this->height.'">
<param name="src" value="'.$this->video.'" />
<param name="autostart" value="'.$this->autoplay.'" />
<param name="controller" value="'.$this->controls.'" />
</object>';

return true;

/// Real player
} else if (in_array($this->extension, array('rmv', 'rmvb'))) {

if ($this->controls == 'true') {
$control = 'all';
$control_ = 'controlpanel';
} else {
$control = 'false';
$control_ = 'false';
}

$this->player =
'<object id="myMovie" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
width="'.$this->width.'" height="'.$this->height.'">
<param name="src" value="'.$this->video.'">
<param name="console" value="video1">
<param name="controls" value="'.$control.'">
<param name="autostart" value="'.$this->autoplay.'">
<param name="loop" value="false">
<embed name="myMovie" src="'.$this->video.'" width="'.$this->width.'" height="'.$this->height.'"
autostart="'.$this->autoplay.'" loop="false" nojava="false" console="video1" controls="'.$control_.'">
</embed>
<noembed><a href="'.$this->video.'">Play first clip</a></noembed>
</object>';

return true;

/// Quick time
} else if (in_array($this->extension, array('mov'))) {

$this->player =
'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
width="'.$this->width.'" height="'.$this->height.'">
<param name="src" value="'.$this->video.'" />
<param name="controller" value="'.$this->controls.'" />
<param name="autoplay" value="'.$this->autoplay.'" />
<!--[if !IE]>-->
<object type="video/quicktime"
data="'.$this->video.'"
width="'.$this->width.'" height="'.$this->height.'">
<param name="autoplay" value="'.$this->autoplay.'" />
<param name="controller" value="'.$this->controls.'" />
</object>
<!--<![endif]-->
</object>';

return true;

/// Mpeg
} else if (in_array($this->extension, array('mpg', 'mpeg'))) {

$this->player =
'<embed src="'.$this->video.'" autostart='.$this->autoplay.'
loop=false controller='.$this->controls.'
width="'.$this->width.'" height="'.$this->height.'" />';

return true;

/// Flash video player
} else if (in_array($this->extension, array('flv'))) {

if ($this->swfObject || $this->swfObject != NULL) {
$this->player = '<script type="text/javascript" src="'.$this->swfObject.'"></script>';
} else {
$this->player = '<script type="text/javascript" src="http://www.ianitsky.com.br/_extras/phpclasses/flashplayer/swfobject.js"></script>';
}
$this->player .=
'<div id="MyMovie">
<a href="http://www.macromedia.com/go/getflashplayer">Baixe o flash player</a> para visualizar este.
</div>
<script type="text/javascript">
var s1 = new SWFObject("http://www.ianitsky.com.br/_extras/phpclasses/flashplayer/flvplayer.swf", "single","'.$this->width.'","'.$this->height.'","7");
s1.addParam("allowfullscreen","true");
s1.addVariable("file","'.$this->video.'");
s1.addVariable("showdigits", "'.$this->controls.'");
s1.addVariable("autostart", "'.$this->autoplay.'");
s1.write("MyMovie");
</script>';

return true;

/// Flash player
} else if (in_array($this->extension, array('swf'))) {

$this->player =
'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="'.$this->width.'"
height="'.$this->height.'">
<param name="movie" value="'.$this->video.'">
<param name="wmode" value="transparent">
<embed src="'.$this->video.'"
wmode="transparent"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash"
width="'.$this->width.'"
height="'.$this->height.'">
</embed>
</object>';

return true;

/// Error
} else {
$this->error = 3;
return false;
}

}

/**
* Return the errors if exist
*
* @return String
*/
public function getLastError(){

if ($this->error != 0) {
return $this->errors[$this->error];
} else {
return NULL;
}

}

public function setSwfObject($file) {

if (is_file($file)) {
$this->swfObject = $file;
return true;
} else {
$this->error = 4;
return false;
}

}

/**
* Return the player
*
* @return String
*/
public function player() {

if(!$this->returnPlayer()) { return false; }

return $this->player;

}

}

?>

Como ves no es mio, está sacado de la web. Para que funcione necesitarias lo siguiente:


<?php

// include shared code
include_once '../lib/VideoPlayer.php';

// Player contructor
$video_player = new VideoPlayer('video 001.mov', '400', '350', 'true');

if (!$video_player) {
die ($video_player->getLastError());
}

/*
* //Use this method if you use the JW flv player javascript source in your server
* //Download the javascript source in http://www.jeroenwijering.com/?item=JW_FLV_Player
* if(!$video_player->setSwfObject('jw_flv_player/swfobject.js')) {
* die ($video_player->getLastError());
* }
*/

/// Echo the player method for print the player plugin
if(!$player = $video_player->player()) {
die ($video_player->getLastError());
} else {
echo $player;
}

?>

Yo lo he probado, pero deberia sermejorarlo. Por ejemplo, si no se puede ver que te lo indique: No tienes el reproductor adecuado, ...

Espero que te sirva

Por ogeretal

1 de clabLevel



 

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.