I've been struggling with SWF Tools for a few hours. I am trying to get an mp3 player working. I got the module installed & configured, and setup my input format with the SWF Tool filter. With the tag, I can see the embedded player in my page. So far so good.

But when I try to play the file I get a "file not found error". I checked my Media Directory URL and it is correct "http://mydomain.com/web/files" (drupal is installed under /web, and my upload directory is "files"). When I look at the 404 error, it is trying to retrieve the file from http://mydomain.com/%2Fmydomain.com/web/files/test.mp3

This is when trying to embed the file with: <.swf file="test.mp3">
(note I put in the '.' so my post will display correctly)

I tried <.swf file="http://mydomain.com/web/files/test.mp3"> and print swf('test.mp3'); but both of these do the same thing. I also tried <.swf file="/files/test.mp3"> and <.swf file="/web/files/test.mp3"> but then the flash player won't even display and I see these errors:
Could not display the flash because "files//files/test.mp3" does not appear to exist.
Could not display the flash because "files//web/files/test.mp3" does not appear to exist.

I've also tried the default mp3 player and 1 pixel out. And I tried various browsers on OS X and Windows XP. It doesn't make a difference.

I just want to make this work any way possible. I've been through the configuration screens many times and don't see what I could change to fix this path problem. I tried adding some apache mod_rewrite rules to fix the path but I can't seem to get it to match the %2F (BTW I also tried disabling all my mod_rewrite rules just in case that was somehow causing this problem).

I am completely stuck. Can anyone help? Do I have something misconfigured or is it possible I have a buggy version of drupal or php or a module or something?

Comments

adamj’s picture

Some more info. The generated embed tag looks like this:

<.embed width="30" height="31" swliveconnect="default" src="http://mydomain.com/web/sites/all/modules/swftools/shared/generic/generic_mp3.swf" wmode="opaque" bgcolor="#FFFFFF" scale="showall" quality="autohigh" loop="false" menu="false" play="true" name="" base="http://mydomain.com/web/files" salign="tl" FlashVars="autostart=false&file_url=http%3A/%252Fmydomain.com/web/files/test.mp3" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

Everything is correct except for the FlashVars attribute. That's supposed to be autostart="false&file_url=http://mydomain.com/web/files/test.mp3" but somehow it is getting partially URL encoded. It is very strange... why do most of the / characters come through ok? This is seeming more and more like a bug.

I am running Drupal 5.2 with PHP 5.1.4. I installed the latest available stable version of SWF Tools (5.x-1.1)

Any ideas?

adamj’s picture

I just found this: http://drupal.org/node/162379

Unfortunately it is not possible for me to upgrade Drupal, so I guess I will have to try some of the workarounds suggested in this other thread.

adamj’s picture

That link to the bug report in my last message is for the audio module. It basically the same problem but I don't think it applies here. I just wanted to find a quick way to get the SWF Tools module working, and here's what I did:

Edit the swftools.module file. Find the _swftool_get_flashvars_string() function.

Just above the line return $encoded;
I added this:
$encoded = str_replace('%3A/%252F', '://', $encoded);

Problem solved! Hopefully this will be corrected for real in an upcoming release of SWF Tools.

I feel silly replying to myself this whole thread, but maybe this info will help someone else. Good luck!