Hi, I am asking especially because of http://pdsounds.org/ (a public domain sound library) which only supports mp3 uploads atm, which is bad for sounds..

AFAIK there's no flash/java app player, that supports vorbis, wav and flac, so I ask for the Audio module to allow users to up- and download such file formats.

CommentFileSizeAuthor
#11 cortado-player-4-audio.zip143.3 KBnargonne
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

seaAudio’s picture

Wikipedia is using ogg for audio now. I did some testing yesterday of the Video module, which uses the Cortado player. I successfully uploaded and downloaded and played in the browser ogg audio, but since there is no support for playlists, walked away from it.

pyutaros’s picture

I'm not certain I follow this. Is ogg supported by the audio module, or do you have to include your own player that will handle it? If so how would one do that?
Thanks,
Jonathan

seaAudio’s picture

OGG is a supported type of the audio module, but not supported by the flash players. If you want to serve OGG, I think your 2 options are.

1) Use the video module or
2) Use the audio module for basic content management (if needed for searches and stuff) and use an embed tag using a OGG player (Cortado, etc).

pyutaros’s picture

Thanks for the reply seaAudio. Where would that embed tag go? In the body of the node? Would I need to alter the module itself? Would it make more sense to try and hack the module to include Cortado as one of the defined players? I have to say, if I can't serve it up, it ain't supported in my mind.
Thanks again,
Jonathan

seaAudio’s picture

The embed would go right in the body of the node. I wouldn't bother hacking the module, but mostly because that's beyond my skills/needs.

-s

pyutaros’s picture

I'll try out the embed as a temporary workaround. I am interested in incorporating Cortado into the module however. I may open a new issue just for that. The obvious biggest obstacle is that Cortado is Java and the other players are Flash.

drewish’s picture

Priority: Critical » Normal

if someone wants to write a player plugin for the cortado player i'd love to review the patch.

FAF’s picture

I had an issue with ogg tags, so I'm going back to mp3. Simply cannot make it work... spend tooooo much time trying. I have hundreds of ogg files on the server, too bad. Ogg tag support, during the import, broke at one point. The support for ogg is not maintained as much as mp3, I believe.

There are some restrictions in the Getid3 as well, like PHP with safe_mode=on dosen't support ogg tags, and other PHP safety procedures interfere with Getid3 ability to read the tags.

I prefer ogg, but what is the use if you run into bugs here and there, because ogg has low priority?

Flac and wav are nice, if you have the space/bandwidth.

Cortado was discussed about a year ago in this list, there was interest, but it never progressed from there.

pyutaros’s picture

I have the interest, and will likely have some time for this in March. I will submit when I have completed.

Leeteq’s picture

Subscribing.

nargonne’s picture

FileSize
143.3 KB

I made a simple player for the audio module that'll playback OGG files using the cortado player. Here are the steps to get it working:

0. Make sure you have Java installed and enabled for your browser

1. Download http://www.flumotion.net/jar/cortado/cortado-ov-stripped-0.2.2.jar

2. Rename the jar file to cortado.jar and put it into the audio/players/ folder (../modules/audio/players/cortado.jar)

3. Create a file called cortado.inc (../modules/audio/players/cortado.inc) and paste in the code below.

4. Additionally, you may want to edit each of the other player files and remove ('wav', 'ogg') references from the 'formats' => array('ogg') line. These Flash players DO NOT support OGG or WAV files so saying they do is very confusing.


<?php

function audio_cortado_audio_player() {
  $items['cortado'] = array(
    'module'      => 'audio',
    'title'       => t('Cortado Java Applet'),
    'description' => t('Use cortado.jar audio player for OGG files'),
    'url'         => t(''),
    'preview'     => '',
    'formats'     => array('ogg'),
    'theme_node'  => 'audio_cortado_node_player',
  );
  return $items;
}

function theme_audio_cortado_node_player($node, $options = array()) {
  global $base_url;
  $source = check_url($node->url_play);
  $player = $base_url . '/' . drupal_get_path('module', 'audio') .'/players/cortado.jar';
  
  // Get playtime of song in seconds
  $playtime = $node->audio_fileinfo['playtime'];
  list($min, $sec) = split(':',$playtime);
  if ($min) {
    $min = (int)$min * 60;
  }
  $duration = (int)$min + (int)$sec;
  
  $output = <<<EOT
  
  <div id="cortado-player">
    <!--[if !IE]>-->
    <object classid="java:com.fluendo.player.Cortado.class" type="application/x-java-applet" archive="$player" height="20" width="250">
      <!-- Konqueror browser needs the following param -->
      <param name="archive" value="$player" />
      <param name="url" value="$source" />
      <param name="audio" value="true" />
      <param name="video" value="false" />
      <param name="bufferSize" value="200"/>
      <param name="seekable" value="true" />
      <param name="duration" value="$duration" />      
      <param name="autoPlay" value="false" />
      <param name="showStatus" value="show" />
      <param name="statusHeight" value="19" />
      <param name="userId" value="user" />
      <param name="password" value="test" />
    <!--<![endif]-->
    
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0" height="20" width="250">
      <param name="code" value="com.fluendo.player.Cortado.class" />
      <param name="archive" value="$player" />
      <param name="url" value="$source" />
      <param name="audio" value="true" />
      <param name="video" value="false" />
      <param name="bufferSize" value="200"/>
      <param name="seekable" value="true" />
      <param name="duration" value="$duration" />      
      <param name="autoPlay" value="false" />
      <param name="showStatus" value="show" />
      <param name="statusHeight" value="19" />
      <param name="userId" value="user" />
      <param name="password" value="test" />
    </object>
      
    <!--[if !IE]>-->	
    </object>
    <!--<![endif]-->
  </div>
  
EOT;
  
  return $output;
}

drewish’s picture

the only thing that jumps out at me is that it seems like you could do with a much simpler

element in the theme_audio_cortado_node_player() function.
pyutaros’s picture

Thank you VERY much for taking this on. What version of JRE will I need for this. I have enable that player for OGG and WAV, but when I access a pre-existing ogg file, no player appears. I also tried updating the file, but I get an error when trying to submit. (The following errors where encountered while reading the file's ID3 tags: * Could not open file) I do not believe the error is related to your player add-on. I have tried in IE7 and FF3. I'll try uploading a new ogg file to see if it makes a difference.
Thanks,
Jonathan

nargonne’s picture

Thanks!

On windows down load the latest java from http://java.com/download
On mac get what software update gives you (version 5)
Make sure java is enabled in the browser

See this site for a working example in Drupal: http://n390.com/content/maxixa-john-williams

drewish is correct about the element being too much. I opted to use object tag so it'll validate xhtml strict but doing so requires different objects for IE and others.

Here is a more compressed version:

<?php

function audio_cortado_audio_player() {
  $items['cortado'] = array(
    'module'      => 'audio',
    'title'       => t('Cortado Java Applet'),
    'description' => t('Use cortado.jar audio player for OGG files'),
    'url'         => t(''),
    'preview'     => '',
    'formats'     => array('ogg'),
    'theme_node'  => 'audio_cortado_node_player',
  );
  return $items;
}

function theme_audio_cortado_node_player($node, $options = array()) {
  global $base_url;
  $source = check_url($node->url_play);
  $player = $base_url . '/' . drupal_get_path('module', 'audio') .'/players/cortado.jar';
 
  // Get playtime of song in seconds
  $playtime = $node->audio_fileinfo['playtime'];
  list($min, $sec) = split(':',$playtime);
  if ($min) {
    $min = (int)$min * 60;
  }
  $duration = (int)$min + (int)$sec;
 
  $output = <<<EOT
 
  <div id="cortado-player">
    <![if !IE]>
    <object classid="java:com.fluendo.player.Cortado.class" type="application/x-java-applet" archive="$player" height="20" width="250">
    <![endif]>
   
    <!--[if IE]>
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0" height="20" width="250">
      <param name="code" value="com.fluendo.player.Cortado.class" />
    <![endif]-->
      
      <param name="archive" value="$player" />
      <param name="url" value="$source" />
      <param name="audio" value="true" />
      <param name="video" value="false" />
      <param name="bufferSize" value="200"/>
      <param name="seekable" value="true" />
      <param name="duration" value="$duration" />     
      <param name="autoPlay" value="false" />
      <param name="showStatus" value="show" />
      <param name="statusHeight" value="19" />
      <param name="userId" value="user" />
      <param name="password" value="test" />
    </object>
  </div>
 
EOT;
 
  return $output;
}
asb’s picture

Hi Daniel,

thank you for improving support for Ogg Vorbis!

Sadly, with the current code, Ogg files still are not being playble, neither with 5.x-2.x-dev nor with 5.x-1.4, at least on my setup. Watchdog reports the following warning:

Page not found ... com/fluendo/player/Cortado.class

The path it is looking for this "com/fluendo/player/Cortado.class" is: http://www.mysite.tld/com/fluendo/player/Cortado.class. Your sample from #14 plays fine on the same computer (Opera 9.62/Win).

Thanks & greetings, -asb

nargonne’s picture

I remember this issue when I was fiddling around trying to get things working but I cannot remember exactly what the cause was. My best guess from memory is that it is something up with the path that $base_url puts out.

Try printing out the $player variable to be sure it's giving a correct path to the player:

$player = $base_url . '/' . drupal_get_path('module', 'audio') .'/players/cortado.jar';
print $player;

Also, be sure you follow the steps in #11 exactly. The cortado.jar and cortado.inc in the same folder ( ../modules/audio/players/ ).

My setup that works is Drupal 5.12 on LAMP web server.

asb’s picture

Hi,

thanks for your reply!

> Also, be sure you follow the steps in #11 exactly. The cortado.jar and cortado.inc in the same folder

Checked:

# ls /var/www/drupal/sites/all/modules/audio/players/c*
/var/www/drupal/sites/all/modules/audio/players/cortado.inc
/var/www/drupal/sites/all/modules/audio/players/cortado.jar

> Try printing out the $player variable to be sure it's giving a correct path to the player:

That gives me: http://www.mysite.tld/sites/all/modules/audio/players/cortado.jar - looks correct to me (Drupal in the server's root dir).

My setup is Drupal 5.12 on Debian GNU/Linux, MySQL, PHP, andy Lighttpd as web server. Maybe it's one of these pesty rewrite differences when using clean URLs?

Greetings, -asb