Using the FlashVideo Hook System
With the FlashVideo module becoming more widely accepted within the Drupal community, there has been many requests to introduce a common API to allow for an interface for other modules to interact with. As of version 2.2, FlashVideo now introduces a complete API that allows for other plugins to hook into the conversion process allowing for specific conversion functionality. What this creates is a video conversion module that is no longer tied to the defaulted FFMPEG conversion utility. Now, a plugin can be created to hook into the FlashVideo module and insert its very own conversion utility, while at the same time, upholding the FlashVideo video handling functionality. This is all done by utilizing two new hooks introduced in version 2.2. These hooks are described as follows...
- flashvideo_submit - Gets invoked when the user presses the Submit Button upon node insertion and update
Parameters:- $node - Standard Drupal Node.
- $params - The Default Parameters passed from the FlashVideo Module. See Table Below for the whole list of parameters to override.
- flashvideo_get_params - Invoked before the conversion routine is called allowing the plugin to override the parameters.
Parameters:- $file - Standard Drupal File Object.
- $flags - Flags that can be set by the plugin to allow for conversion control within the FlashVideo module.
- $params - The Default Parameters passed from the FlashVideo Module. See Table Below for the whole list of parameters to override.
- $params - The overridden parameters.
FlashVideo Parameter List. : The following is a list of all parameters that can be overridden by using these hooks.
| Parameter Name | Type | Description |
|---|---|---|
| output_dir | Text | Used to command the output directory. This is relative to the system files directory. |
| cmd_path | Text | Used to specify the CWD path to the conversion utility executable. Be sure to include the executable in the path. Example /usr/bin/ffmpeg |
| video_args | Text | The arguments given to the conversion utility executable to generate a video. The same format should be used as in the FlashVideo Settings. |
| thumb_args | Text | The arguments given to the ffmpeg executable to generate a thumbnail. The same format should be used as in the FlashVideo Settings. |
| thumbsize | Text | The thumbnail size specified in the following format "WIDTH x HEIGHT". Example 130x100 |
| thumbwidth | Integer | The thumbnail width. |
| thumbheight | Integer | The thumbnail height. |
| thumbtime | Text | The amount of time to delay before taking a snapshot of the video. Denoted as "00:00:00" |
| thumbsecs | Integer | The amount of seconds to delay before taking a snapshot of the video. |
| thumbext | Text | The extension of the output thumbnail. Example: For JPG's this would be jpg |
| videoext | Text | The extension of the output video. Example: For output FLV's, this would be flv |
| videomime | Text | The mime type of the output video. |
FlashVideo API Functions
Along with those hooks, the FlashVideo module has also standardized the conversion routine so that calling it outside of the cron job is a simple task. Because of this change, the old function _perform_ffmpeg has been deprecated, and has been replaced with a more complete function called flashvideo_convert. Here is the information needed to convert any Drupal Video using this new method.
- flashvideo_convert - More standard conversion routine to convert a video file into the Flash Format.
Parameters:- $file - A Standard Drupal File Object.
- $node_type - The current node type doing the conversion.
- $params - An array of parameters... Used to override functionality. Leave blank if you wish to use defaults.. See Table Above for the whole list of parameters to override.
Along with the simplified conversion routine, the FlashVideo module provides two additional functions used to easily retrieve any video or thumbnail in the system. These routines are described as the following...
- flashvideo_get_video - Retrieves any Flash Video given the provided parameters.
Parameters:- $node - A Standard Drupal Node Object.
- $params - An array of parameters... Leave blank if you wish to use the default (First uploaded video of the given node).
- index - Within a given node, this is the video index within that node.
- node - The Node ID of any Drupal node.
- fids - A string of File ID's to play in the format '34-21-35'. Note: You must have the flashvideo_playlist.php file in your root to use this feature.
- file - The file name of the file you wish to show. Path is relative to the system files Directory.
- autostart - String 'true' or 'false' to automatically play the video
- width - Integer video width in pixels.
- height - Integer video height in pixels.
- id - String YouTube or Google Video ID.
- flashvideo_get_thumbnail - Retrieves any Flash Video thumbnail given the provided parameters.
Parameters:- $node - A Standard Drupal Node Object.
- $params - An array of parameters... Leave blank if you wish to use the default (First uploaded video of the given node).
- index - Within a given node, this is the video index within that node.
- node - The Node ID of any Drupal node.
- fids - A string of File ID's to play in the format '34-21-35'. Note: You must have the flashvideo_playlist.php file in your root to use this feature.
- file - The file name of the file you wish to show. Path is relative to the system files Directory.
- width - Integer video width in pixels.
- height - Integer video height in pixels.
- id - String YouTube or Google Video ID.




what is the php syntax to
what is the php syntax to use the parameters? in particular for flashvideo_get_video?
i want to get a video of from an already exisitng node