4images Forum & Community

4images Help / Hilfe => FAQ, Tips => Topic started by: V@no on January 17, 2009, 02:49:46 AM

Title: How to add FLV (Flash Video) support
Post by: V@no on January 17, 2009, 02:49:46 AM
Ok, this question become quiet popular at this forum. So here it is the answer.
In this tutorial we will use free for non-commercial usage JW FLV Media Player v4.3 (http://www.longtailvideo.com/players/jw-flv-player/).

1. Go to ACP (Admin Control Panel) -> Settings -> Scroll down and find Valid file extensions, add to the list flv (don't forget put comma). Save the settings.

2. Open includes/upload_definitions.php

Insert at the end of the file, above closing ?>
Code: (PHP) [Select]
$mime_type_match['flv'] = array("application/x-shockwave-flash", "application/octet-stream", "video/flv", "video/x-flv");


3. Create a new template: templates/<your template>/media/flv.html
with this code inside:
Code: (template) [Select]
<script type='text/javascript' src='swfobject.js'></script>
<div id='mediaspace'>This div will be replaced</div>
<script type='text/javascript'>
  var s1 = new SWFObject('player.swf','ply','470','320','9','#ffffff');
  s1.addParam('allowfullscreen','true');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('wmode','opaque');
  s1.addParam('flashvars','file=<?=urlencode("{media_src}")?>&autostart=true');
  s1.write('mediaspace');
</script>

4. Download the player from the link above.
NOTE At the time this tutorial is written the player's download page has "Include the JW Viral Plugin" checkbox, when checked, the downloaded package will have player-viral.swf file, instead of player.swf.
In this tutorial we'll use JW FLV Media Player 4.3 without the "JW Viral plugin" (checkbox at download page must be unchecked).

From the downloaded package take only player.swf and swfobject.js, upload them to the root of your 4images gallery (this is important, in my tests it didn't work when I uploaded these files into a subdirectory).

5. Create an templates/<your template>/icons/flv.gif icon (this icon will be showed when no thumbnail available)

6. Try upload a .flv file, if you get an error about Invalid file type, follow this (http://www.4homepages.de/forum/index.php?topic=7277.0) instructions