The SWF Tools input filter is included as part of the core SWF Tools module, so when you enable SWF Tools the filter is available. The input filter lets you generate flash content and access the various media player modules by using a simple syntax of the form [swf file="myFlash.swf"]
for a single file, or [swf files="Music1.mp3&&Music2.mp3&&...]
for a list of files.
To use the input filter you must first assign it to some input formats where it will be allowed to be used. To do this:
- go to Site configuration > Input formats
- choose Configure to add the filter to an existing input type, or choose Add input format to create a new format.
- Place a check next to the SWF Tools filter and then save the configuration.
By default the SWF Tools filter is given a weight of 10 which means it will be one of the last filters to run, and generally this is the best option. If you need to re-arrange the filters then use the Re-arrange option on the input filters configuration page.
The SWF Tools filter will need to come after any HTML corrector modules, or modules that strip tags. If the SWF Tools filter comes before these then there is a risk that the flash won't display. It can take some trial and error, but it is designed to work first time, as far as can ever be the case!
If you find you get some of the SWF Tools embedding content actually displaying on the page then double check the filter settings. If you have several filters with the same weight as SWF Tools then try weighting SWF Tools more heavily, or lighten the others.
Once the filter has been activated you can start adding flash content to pages by using the [swf]
format.
To add a single file simply write [swf file="myFile.swf"]
. Note - this will refer to a file in the default file directory of your site. If you want to refer to elsewhere then you can refer to sub-directories by using [swf file="subdirectory/anotherFile.swf"]
. If you want to refer to external files, or somewhere outside of the Drupal file system, then use a full path, such as [swf file="http://example.com/externalFile.swf"]
.
When you supply a filename to the SWF Tools filter then it will try to work out what to do with the file based on its extension. So swf files just get displayed, mp3 files are passed to the default mp3 player, and a list of flv's would go to the configured flv player.
To override the width and/or height, you can add them inside the brackets, such as [swf file="myFile.swf" width="400" height="250"]
.
To refer to a list of files replace [swf file="oneFile.swf"]
with [swf files="Music1.mp3&&Music2.mp3&&..."]
. Note that in the list of files double ampersands are used to separate each file! Behind the scenes SWF Tools will convert the list of files in to an appropriate format for the media player that is going to be used.
If you have used an earlier version of SWF Tools then existing nodes that use the format [swflist files="..."]
will still work. However, it is no longer necessary to use the [swflist]
syntax, unless you are using the Drupal 5 version, since just passing either file
or files
is enough to tell SWF Tools what to do.
Over-riding the embedding method
If necessary the default embedding method can be over-ridden by passing the parameter embed="{method}"
in the filter, where {method}
is the method name you want to use. The method name is an internal name that SWF Tools uses to identify available methods.
Method | Method name |
---|---|
Direct embedding | swftools_nojavascript |
SWF Object 2 | swfobject2_replace |
SWF Object 1.5 | swfobject_replace |
jQUery Flash | lutman_replace |
UFO | ufo_replace |
Forcing a specific media player
Sometimes you may want to force SWF Tools to use a specific player to play back a media item. This might occur if you want to use a player other than the default, or if the auto-detection of the media type is failing.
To force a specific player use the parameter player="{player}"
in the filter, where {player}
is the player name you want to use. The player name is an internal name that SWF Tools uses to identify available players.
Player | Player name |
---|---|
FlowPlayer | flowplayer_mediaplayer |
FlowPlayer 3 | swftools_flowplayer3_mediaplayer |
JW Image Rotator 3 | wijering_imagerotator |
JW Media Player 3 | wijering_mediaplayer |
JW Media Player 4 | wijering4_mediaplayer |
Simple Viewer | simpleviewer |
1 Pixel Out Player | onepixelout |
Forcing a specific action
Sometimes you may want to force SWF Tools to use a specific action to play back a media item. This might occur if the auto-detection of the media type is failing so the wrong action is being assigned.
To force a specific action use the parameter action="{action}"
in the filter, where {action}
is the action name you want to use. The action name is an internal name that SWF Tools uses to identify available actions.
Action | Action name |
---|---|
Display as an swf (no player) | swftools_swf_display_direct |
Play a single mp3 | swftools_mp3_display |
Play a list of mp3s | swftools_mp3_display_list |
Play a single flv | swftools_flv_display |
Play a list of flvs | swftools_flv_display_list |
Play a list of images | swftools_image_display_list |
Play a list of mixed media | swftools_media_display_list |
Specifying flashvars
If you want to send a string of flash variables to the movie then you can include this in the input filter by writing [swf file="myMovie.swf" flashvars="var1=Something&&var2=SomethingElse"]
Note that you have to use a double ampersand, and that you cannot include an unescaped quote in the flashvars string as this will confuse the filter!
Comments
Setting flash video player size using swf filter
It's possible, although not immediately obvious, to set other parameters for the video player such as height and width using the swf input filter like:
[swf file="flash_video_file.flv" params="width=400&&height=300"]
Base URL
Also helpful, if you've put your swf and xml in a subdirectory and it's not finding the xml try setting the base url to match:
[swf file="subdirectory/movie.swf" params="base=http://www.website.com/sites/default/files/subdirectory/"]
Any way to set these parameters as a percentage?
I tried params="width=50%&&height=50%" but that doesn't work. Any ideas?
Just use: [swf
Just use: [swf file="file.swf" width="950" height="480"]
;-)
Forcing a flash version
It would be worth to mention that you can force a flash version that is different from the default, by using:
[swf file="flash/myflash.swf" params="version=10.0.22"]
This square bracket
This square bracket replacement is my preferred option. I tried the hack below for the last month and TinyMCE leaves mce_bogus and mce_href attributes throughout all my other edited pages.
TinyMCE scrubbing
Even though I checked all the right options, TinyMCE was still scrubbing out my calls. Even though this has been discussed elsewhere, I couldn't find any newbie instructions for the new Drupal 6 WYSIWYG module with TinyMCE, so here you go:
(1) Edit /sites/all/modules/wysiwyg/editors/tinymce.inc
(2) Find "function wysiwyg_tinymce_settings($editor, $config, $theme) {" and add "'cleanup' => FALSE," to the end of it, so it looks like this:
Note: by doing this, you've completely turned off TinyMCE's scrubbing feature. This is not recommended by people who know better.
Ooh
And kittens will die, you hacker you!
Surely there's a GUI option to turn off clean-up?
--
https://www.codeenigma.com/
Thank you koppie, it works.
Thank you koppie, it works. It's dirty but it works :(
Is it the same with other editors ?
onepixelout
I just cannot figure out how to use my favored onepixelout-player. After installing swftools the generic player does work.
There is a directory modules/swftools/onepixelout. I uploaded the stand-alone onepixelout-player to this directory. When I browse to "admin/settings/swftools/handling" I get the message "Missing 1pixelout/player.swf". I tried some variations about placing the files in different sub-directories and naming them 1pixelout and onepixelout but swftools still won't find the player. Is there any help for this problem?
See the installation instructions
This documentation has a table that gives the path and name needed for each player.
download the onepixelout
download the onepixelout http://downloads.wordpress.org/plugin/audio-player.1.2.3.zip
extract the file and rename it to 1pixelout and put it into the sites/all/module/swftools/shared/
solved
Thanks.
1pixelout does work now.
swftools_get_media_url() issue ?
In config, I unset checking files and I'm using public file system.
If I write [swf file="test.swf"] then movie parameter is set to "http://www.domain.com/sites/default/files/".
Same behaviour if I write [swf file="/path/test.swf"] or [swf file="/sites/default/files/path/test.swf"].
"file" value is always omitted unless I set full path access to "test.swf".
What did I miss ??
Thank you.
Same problem
Hi,
I've got the same problem. Did you sort it?
Cheers
Zap
No. And it seems that nobody
No. And it seems that nobody care about this :(
I've just come across this
I've just come across this gotcha too - it's a bit of a usability problem, as your users will probably upload the FLV via the upload module and simply want to copy the path - minus your domain name if they're clever enough to use relative links - into the [swf file="/path/to/file.flv"] string.
The two solutions here are either to improve documentation so editors only insert filenames/paths relative to the Drupal files directory root, without a leading '/', or modifying the file to be better able to handle paths relative to the wwwroot.
I've cobbled together a patch file against 6.x-2.5 which does a few things to try and improve reliability, below, but I'm no coder, so it probably needs rewriting, but it has allowed me to specify the file URL as the path from the server root, i.e. with a leading slash: [swf file="/sites/www.kssdeanery.org/files/noodle.flv"].
At the moment, a correct path begins in your files directory, but you CANNOT have a leading slash, so you can't use / to "reset" your URL. e.g. "/foo/bar.flv" won't reset the URL to your base_url.
Anyway, here's how I think you can find out your path - go to:
admin/settings/swftools/handling
... and scroll down to "Media directory url". On my system, I see something like "http://www.example.com/sites/www.example.com/files" - note the lack of trailing slash; what you put in file="filename" is probably simply appended to this path.
Why is this bad? Two reasons I guess; the first is as mentioned above - generally, you want your users to think in terms of relative, portable and recognisable paths. I know that example.com/foo/bar/baz will work anywhere on example.com, and it's easy to make it work from another domain too simply by adding example.com to the start.
The second issue is that this problem is maybe caused by the assumption that Drupal users are comfortable with all their uploads being served from the site's files directory; this isn't always the case, and it's probably better for user interface standards to simply give the user the full path to the media - including the http://, etc (like upload module does on node/edit pages) and let them decide what to do with it.
Lastly, the error message "" should include the path the SWF Tools filter is resolving from the user's input in [swf file="/foo..."], and the directory it is using as a base dir. Even better, have it also explain using an example.
I cannot seem to get this to
I cannot seem to get this to work. I've set up SWF Tools to use SWFObject2 embedding, according to the swttools status report all ok. But when I add any of these snippets to a page it does not get replaced. I just get the code snippet in text on the page.
Any advice on what I'm doing wrong here ?
Many Thanks !
Just to check, have you
Just to check, have you enabled the [swf ...] insert filter in admin/build/modules, and ticked to enable the insert filter in your input format(s) via admin/settings/filters?
I have these enabled. I can
I have these enabled. I can use [swf file="sac1.flv"] but if I make a playlist [swf file="sac1.flv&&sac1.flv"] it errors out.
Could not display the flash because sites/default/files/sac1.flv&&sac2.flv does not appear to exist.
Same problem here...
Did you make it work?
Can I put in a parameter that
Can I put in a parameter that will make it output a download link as well as the player? And also, is there a full list somewhere of all the parameters that can be passed?
Zoe Neill-St. Clair
Drupalshank @ Affinity Bridge
http://www.AffinityBridge.com
Alternate text
Sounds like you want to put in alternate text/html that will display if flash fails to load... Have you found a solution to this problem using this input filter? I'd love to know. I know you can inject alternate html using the swf() php function call. But I don't want to use php input filter just for this purpose as it is a security issue. Does anyone know if there is a parameter that lets you insert alt text using this input filter? Should this be a feature request?
RTMP a remote mp4 using Flowplayer 3
Hi,
I have successfully set up RTMP streaming on flv files from a CDN. Also I have discovered that I can get Flowplayer 3 to play mp4 files by direct linking to the CDN but not with rtmp://, instead http://. This is financially a problem as each time the whole file is being downloaded. The problem comes about as SWF tools syntax defines 'swftools_flv_display' ok for flv... but what about 'swftools_mp4_display' this does not exist...!? So how do we get FLV tools to display the mp4 from a remote server??
Does this require PHP? If so I'm out of it! This issue is important as it is possible to get FAR superior compression with h.264/mpeg-4 as opposed to blocky flash.
Cheers,
Andy
Send custom variables in url
Is it possible, and if yes how, can I send variables from url to inside a flash swf. Something like this:
flash.swf?vars1=topo1|topo2|topo3&vars2=A
Thanks
Edu
Uploaded FLV
I created a Content Type for video and I created a filefield to upload and flv file. Is there anyway to make it play as an external url like a third party source?
Thanks
I'm trying to create a splash
I'm trying to create a splash page for a D6 site, using the Front Page module, and SWFtools. I need to display a flash video on the splash page, but nothing I'm trying even recognizes the video file. I've tried without SWFtools, using standard object embedding options, but neither the video nor a placeholder even appear. With swftools all I see is the [swf file="splashvideo.flv"] label and nothing else.
Any ideas?
Thanks!
Did you install flowplayer,
Did you install flowplayer, as I play all my flvs with this player using swftools
How can I make my flv loop
How can I make my flv loop continuously using the filter?
JW Media Player 4
Hi there,
am new to SWF Tools and I want to work with JW Media Player 4 using the SWF Input Filter. I've videos with different sizes and each video has an individual preview picture. Finally I want to use this player for mp3 too. My questions:
• How can I define a preview picture using the SWF Input Filter [swf file="…"]?
• How can I define a size using the SWF Input Filter?
• Is it possible to display mp4 videos with SWF Tools and JW Media Player 4?
I know JW Media Player and in HTML projects I've defined individual players for each video to have individual preview pictures, sizes and contents. I've installed SWF Tools and JW Media Player 4 and it works but without special features I mentioned above. Would be glad if anybody could help and tell me some strings I've to write into the SWF Input Filter [swf file="…"].
Thanks
Just use: [swf
Just use: [swf file="file.swf" width="950" height="480"]
To add custom alternative
To add custom alternative content with the input filter, include html_alt="" in your code.
Examples:
To load a movie with a set width and height with custom options: wijering4_mediaplayer, width, height, autoPlay and html_alt: