drupal 5.1
audio 1.3
getid3 1.7.7 ( and tried 1.7.8b2 )

I can upload mp3 fine, but when I try to upload a wav:

-the upload page doesn't have a fieldgroup for metadata ( same for mp3s)
- The file uploads but gives me two errors 1) unable to determine file format, and 2) This file is not compatible with the Flash audio player. Flash can only play MP3 files with a sample rate of 11, 22 or 44KHz.
- On the newly uploaded file, 'Click to play' leads to a broken quicktime page, no flash player loads
- I have the 1pixelout player selected for wav files
- i tried to use the getid3 demo.browse app and was able to navigate to twhere audio.module uploaded my files and was able to see that getid3 did recognize the file correctly.

thanks,

Comments

meecect’s picture

well, I've been looking at the code, and I think the 'wav' support is very confusing. I guess it will only accept wav files that are actually mp3 files?

So I modified it a bit to work the way I _think_ it should. I added a player .inc file called 'embedded.inc' . This player can be registered to handle wav files and 'riff' files ( what getid3 recognizes wav files as) and will put the mediaplayer control on the pages with wav's, much akin to how the 1pixelout player shows up for mp3's.

Another change you may need to make is on the getid3 settings page, uncheck the default 'write to file' columns. Otherwise, the module will attempt to write id3 tags to the file _regardless of type_. That's why people ini other threads were compaining about wav files unable to be downloaded and played after uploading, because the file is corrupt after writing id3 tags to a perfectly good wav.

A better solution would be to change the audio_getid3 module to only write tags to files that actually can have tags. I may write a patch to just that, actually.

Another thing to do would be to support macs somehow, but I haven't gotten that to work yet for embedded wavs. Btw, this will probably work for wma's as well with a small modification.

embedded.inc:

<?php

function audio_embedded_audio_player() {
  $items['embedded'] = array(
    'module'      => 'audio',
    'title'       => t('Embedded'),
    'description' => t('Tries to use embedded audio players'),
    'url'         => t(''),
    'preview'     => '',
    'formats'     => array('wav', 'mp3', 'riff'),
    'theme_node'  => 'audio_embedded_node_player',
  );
  return $items;
}

function theme_audio_embedded_node_player($node, $options = array()) {
  // make sure it's compatible with the flash player
  //if (!audio_is_flash_playable($node)) {
  //  return NULL;
  //}

  $source = check_url($node->url_play);
  //$url = base_path() . drupal_get_path('module', 'audio') .'/players/1pixelout.swf';
  $flashvars = audio_query_string_encode($options);

$output = <<<EOT
 <!-- begin embedded WindowsMedia file... -->
      <OBJECT id='mediaPlayer' width="320" height="45" 
      classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' 
      codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'
      standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>
      <param name='fileName' value="$source">
      <param name='animationatStart' value='true'>
      <param name='transparentatStart' value='true'>
      <param name='autoStart' value="false">
      <param name='showControls' value="true">
      <param name='loop' value="false">
      <EMBED type='application/x-mplayer2'
        pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
        id='mediaPlayer' name='mediaPlayer' displaysize='4' autosize='-1' 
        bgcolor='darkblue' showcontrols="true" showtracker='-1' 
        showdisplay='0' showstatusbar='0' videoborder3d='-1' width="320" height="45"
        src="$source" autostart="false" designtimesp='5311' loop="false">
      </EMBED>
      </OBJECT>
      <!-- ...end embedded WindowsMedia file -->
    <!-- begin link to launch external media player...
        <a href="http://servername/path/to/media.file" style='font-size: 85%;' target='_blank'>Launch in external player</a>
     ...end link to launch external media player... -->

EOT;

  return $output;
}

drewish’s picture

Status: Active » Closed (duplicate)

this is a duplicate of an existing issue: http://drupal.org/node/162321 lets keep the conversation in one place.

Ashford’s picture

No hacking or extra files required. I found a freeware program called Switch to convert files -- wav can convert to mp3 with one click of the button. A reasonable priced shareware upgrade is available for those who need more power and options.

http://www.nch.com.au/switch

I converted my .wav file before uploading and all is working sweet. I am using Drupal 4.7, but it should not make any difference since the problem was between the Player and the file and not the Drupal module.

I hope this works for everyone. It is so easy.

Ashford

lainel’s picture

Can someone zip this? So we can download the file and upload it?

I haven't got a clue where to add this patch.