Create a video hosting site like YouTube

Last modified: April 10, 2009 - 09:54

Because YouTube uses the Flash video file format (FLV), you can use the swftools module and jw_media_player to create similar functionality (you need to convert your video files to FLV first. If you want the server to convert all files to FLV, you could use the FlashVideo module).

(modified from http://drupal.org/node/181998)

1. Download: http://ftp.drupal.org/files/projects/swftools-5.x-1.x-dev.tar.gz
2. Before you copy the module to your sites directory, change line 656 as follows:

Adding

$encoded = str_replace('%3A/%252F', '://', $encoded);

to

<?php
function _swftools_get_flashvars_string(&$flashvars) {

  foreach (
$flashvars AS $var => $value) {
   
$flashvars[$var] = str_replace(array('&', '=', '?'), array('%26', '%3D', '%3F'), $value);
  }
 
$encoded = drupal_query_string_encode($flashvars);

 
// '#' seems to encode as %2523, reverse this, using a more robust hex prefix..
 
$encoded = str_replace('%2523', '0x', $encoded);

 
// '://' seems to encode as %3A/%252F, reverse this back to '/'
$encoded = str_replace('%3A/%252F', '://', $encoded);

  return
$encoded;
?>

3. Install the Flash Node module or use input filter.
4. Download Jeroen Wijerings Flash media player here:
http://www.jeroenwijering.com/?item=JW_Media_Player
(You only need one file mediaplayer.swf)
Unzip it and rename the folder from jw_media_player to flash_media_player and place the folder in the following directory
http://youraddress/modules/swftools/shared/

The directories should now look like this, just to be sure:
http://youraddress/modules/swftools/shared/flash_media_player

5. Configure
/admin/media/swf/generic
Important: check "Autostart FLV for Generic Player." Even if you used the Wijering media player, you need to select this, otherwise it will not work.

/admin/media/swf/handling
Use Flash Media Player - Jeroen Wijering for all

/admin/media/swf/embed
Under "JavaScript Embedding," make sure these two are checked:
*Embed Flash Directly, don't use JavaScript replacement.
*All pages.

Check here for more info: http://www.thanhsiang.org/faqing/node/84

There are several other modules for Drupal that can help you host video:

 
 

Drupal is a registered trademark of Dries Buytaert.