Available Plugins
Snapshot plugin
This plugins renders a JPG snapshot from a video frame. It sends the JPG data to a serverside script for processing and displays the returning URL.
This plugin is compatible with version 4.1 of the player.
Example
Here is an example of the snapshot plugin in action. Below is the string of flashvars used.
file=/player/testing/files/bunny.flv&plugins=snapshot&snapshot.script=http://www.jeroenwijering.com/test/snapshot/create.php
Configuration
The plugin is loaded with the flashvar plugins=snapshot. This will automatically load the latest version of the plugin straight off our servers. It offers two flashvars:
- snapshot.bitmap (true): Set this to false if you want to render the thumbnail serverside. The plugin will then not post the JPG data, but two variables: file (location of the video) and position (position of the snapshot in seconds).
- snapshot.script (undefined): the location of the serverside script (PHP,ASP,..) that processes the snapshot. It must echo the HTTP url of the resulting image, so the player can display the result to the user. Here's an example of such a script:
<?php
if(isset ($GLOBALS["HTTP_RAW_POST_DATA"])) {
$im = $GLOBALS["HTTP_RAW_POST_DATA"];
$rn = rand();
$fp = fopen('snapshots/'.$rn.'.jpg', 'wb');
fwrite($fp, $im);
fclose($fp);
if (exif_imagetype($rn.'.jpg') == IMAGETYPE_JPEG) {
echo 'http://www.myserver.com/snapshots/'.$rn.'.jpg';
exit();
}
}
echo "error";
?>
Note that both the retrieval of bitmap data and the loading of a serverside script are subject to the Crossdomain security restrictions of Flash. This means that a player on one domain cannot create a snaphot from a video on another domain. This player also cannot post the snapshot to a script on another domain. Both issues can be circumvented by placing a crossdomain.xml file at the server the video is loaded from and/or the server the script is loaded from.
Source code
The source code of this plugin can be obtained in a zip (click the zip links at the bottom) or through Subversion:
svn co http://developer.longtailvideo.com/svn/plugins/snapshot
If you don't have a Subversion client, check out Tortoise (Windows) or SC Plugin (MAC).
You don't need Adobe Flash to modify this plugin. Instead, you can edit the plugin with any text editor you like. The plugin can be compiled with the free, cross-platform MXMLC compiler. See our plugin compiling overview for more info.
