This will enable HTML5 audio streaming with a Flash fallback for Firefox. This is for the D5 version of Audio, but I'm sure it could be modified for D6.

In your 1pixelout.inc file

$output = <<<EOT
<audio type="audio/mpeg" controls="controls" id="html5player" tabindex="0" preload="metadata">
	<source src="$node->url_play"/>
</audio>

<div id="player_fallback"></div>
<script>
var flashvars = {};
	flashvars = "$flashvars";
		
var params = {};
	params.movie = "$url";
	params.wmode = "transparent";
	params.menu = "false";
	params.quality = "high";
	params.Flashvars = "$flashvars";
	
if (document.createElement('audio').canPlayType) {
    if (!document.createElement('audio').canPlayType('audio/mpeg')) {
      swfobject.embedSWF(
        "/modules/audio/players/1pixelout.swf", 
        "player_fallback", 
        "700", 
        "24", 
        "9.0.0", 
        false, 
        flashvars, 
        params);
    }
  }
</script>
EOT;

  return $output;
}

Comments

wylbur’s picture

Version: 5.x-2.x-dev » 6.x-1.0-unstable6
Issue summary: View changes

We're working on a Drupal 6 site that uses Audio. Here's simple code to use the HTML5 audio tag within the 1pixelout player. By embedding the flash code within the audio tag, it degrades automatically. Browsers with HTML5 support play HTML5, while other browsers will see the flash code. I did not add support for browsers without HTML5 or flash support.

$output = <<<EOT
<audio type="audio/mpeg" controls="controls" id="html5player" tabindex="0" preload="metadata">
  <source src="$node->url_play"/>
    <object type="application/x-shockwave-flash" data="$url" width="290" height="24" >
    <param name="movie" value="$url" />
    <param name="wmode" value="transparent" />
    <param name="menu" value="false" />
    <param name="quality" value="high" />
    <param name="FlashVars" value="$flashvars" />
    <embed src="$url" flashvars="$flashvars" width="290" height="24" />
  </object>
</audio>
EOT;
djsilverfox’s picture

Hi, this looks like it helps my issue, but as a non programmer where do I put this code please ?

rschletty’s picture

Aha! This worked for me on my Drupal 6 site. I use SoundManager2 for my Audio pages. I used the above code in place of the existing $output code (lines 75-87) in the file sm2_audio.module (located in the folder sm2_audio within the soundmanager2 module.

Here is the result: http://www.topcatholicsongs.com/stronger-with-love

EDIT: Just discovered that the "Download audio file" text link (at the bottom of post) also plays the song (with timecode in text) rather than download the file! This is not good. Solution, anyone?

karnac’s picture

Issue summary: View changes
wylbur’s picture

Status: Active » Closed (outdated)
apaderno’s picture

Title: Solved - Enable HTML5 Audio & Firefox Flash Fallback for D5 Audio » Enable HTML5 Audio & Firefox Flash Fallback for D5 Audio

Drupal 6 is not supported anymore. That is why issues for a Drupal 6 version of a module are closed as outdated. In this case, the project doesn't have any version for Drupal 7; this feature request is not relevant for a Drupal 7 version, since it doesn't exist.