Can you give some examples of the errors that it's causing? I have a feeling the embed tag may be the biggie...but I'm sure there's others. I can't say I've ever checked the audio module for compliance...a good thing to be aware of.
The manual solution would be to insert the player manually into the nodes, via a node-audio.tpl.php file or thru contemplate. Then you'd have total control over the tags it's outputting.
-Rob Feature
Geeks and God Co-Host
www.bobchristenson.com
The errors that occur are as you say mostly related to the fact the the embed tag.
The Validation Page for the front page of the new site, which has one audio player on can be seen by clicking on the link above.
I'm not that sure what the standards compliant way of embedding Flash in a site is? I have in the past always just used the embed tag, but it seems this isn't XHTML compliant.
Thanks
Andy
I continued to play with the code and hunt around and have found a solution which seems to work with all the major browsers and is still XHTML strict compliant.
Within template.php add the following function (this is a tweaked version of the code from Matt's site:
function phptemplate_audio_1pixelout_node_player($node, $options = array()) {
//Insert the flash player script
drupal_add_js(path_to_theme().'/swfobject.js', 'theme');
//Insert the individual flash player
// make sure it's compatible with the flash player
if (!audio_is_flash_playable($node)) {
return NULL;
}
$options['soundFile'] = check_url($node->url_play);
$url = base_path() . drupal_get_path('module', 'audio') .'/players/1pixelout.swf';
$flashvars = drupal_query_string_encode($options);
$output = <<<EOT
<span id="flashfixme$node->nid"><script type="text/javascript">
var so = new SWFObject("$url", "audioplayer", "290", "24", "7", "#353535");
so.addParam("$url");
so.addParam("quality", "high");
so.addParam("wmode", "transparent");
so.addParam("menu", "false");
so.addParam("pluginurl","http://www.macromedia.com/go/getflashplayer");
so.addParam("flashvars","$flashvars");
so.write("flashfixme$node->nid");
EOT;
//For those times when there is noscript
$output .= "</script></span><noscript><div>";
$output .= theme_audio_1pixelout_node_player($node, $options);
$output .= "</div></noscript>";
return $output;
}Then edit the 1pixelout.inc file and remove the following line:
<embed src="$url" flashvars="$flashvars" width="290" height="24" />You will also need to upload the swfobject.js file to your theme directory.
I haven't noticed any problems with this solution, and it still removes the double click requirement within IE.
Hope this is useful to someone!
Andy
This isn't quite a solution. For browsers like firefox that accept the embed tag swfobject puts an embed tag in the browser. So, even though drupal is creating compliant code swfobject isn't. You can see this in firefox with firebug.
Matt Farina
Geeks and God Co-Host
www.mattfarina.com
Being xhtml compliant many be a bad thing here. There's a reason that the audio module, google, and many others are using the embed tag which makes them non-compliant. It's a compatibility issue (amung other things).
There's a nice writeup over at http://www.alistapart.com/articles/flashembedcagem....
The audio module xhtml compliance conversation is over at http://drupal.org/node/149197.
Matt Farina
Geeks and God Co-Host
www.mattfarina.com
I can see your point and have read through the writeup you mentioned. The compatibility issue doesn't really worry me as over the last year we have had only one visitor visit the site with a version of Netscape below 7.2 (and the method I am using works fine on 7.2 and above) and having tested it on the older 7.02, the flash does not appear, but as I have the download link displayed below anyway it degrades very neatly.
I have been testing the site using the very useful service provided by browsercam.com, and there are only a few browsers that fail to display the flash content and most of those fall apart all together!
The code I am using doesn't work for:
Netscape 6.2.3 - Doesn't do the transparent background
IE4 on Win98 - Whole site dies!
Netscape 4.78 - Seems to ignore all css!
IE5.2 on OSX - Layout gone mad!
All browsers on Fedora Core 4 seem to ignore the transparent background.
I see what you mean about SWFObject putting the Embed tag back in but am confused as to why this doesn't get detected when you do the compliance test?
In some ways having SWFObject use the Embed tag give you the best of both worlds as any browser that has javascript has access to the embed tag, but the page still registers as XHTML Strict. Which means you only have compatibility issues with computers which don't have javascripting available and need the embed tag!
I personally think that if you are going to claim to be complaint then you need to make sure you validate as such. I find it very annoying when sites have compliance links on there site, which once you follow them produce a long list of errors! This solution maintains backwards compatibility with most browsers, whilst passing the XHTML Strict Compliance test.
I hope someone else finds all of this useful...
Andy
There's a reason we don't claim compliance ;-)
You list some good reasons and did some good testing. The reason the compliance test didn't detect SWFObject is that it doesn't look at the page after javascript has altered it. Just before. So, the changes SWFObject makes havn't happened when the compliance is tested.
Matt Farina
Geeks and God Co-Host
www.mattfarina.com
Thankyou for you very interesting site!
I have been rewriting our Church's website which I previously wrote around Wordpress, the main motivation for this was to better integrate audio into the site.
Wordpress Site: http://www.warwickbaptists.org.uk
Drupal Site: http://www.warwickbaptists.org.uk/beta
I am using the Audio Module which is excellent, but doesn't produce strict xhtml compliant code.
I stumbled upon your article on removing the double click needed in IE, but sadly this hasn't helped me make the site fully standards compliant.
I have managed thus far to fix all the issues in the theme, and other plugins that were causing the site to be invalid, but any page which has the flash 1pixelout player causing the page to produce multiple errors.
Anyone have any ideas?
Thanks
Andy
Andy
Warwick Baptist Church - The Kemps' Blog