3

As stated in Why doesn't Firefox support the MP3 file format in <audio>, Firefox does not support MP3 for <audio>. For some reason, a third-party website does not host files other than mp3, and uses code like the below for embedding mp3 files:

<object CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
        width="1" height="1">
    <param name="URL" value="media/audio.mp3">
    <param name="autoStart" value="true">
</object>

Since my computer-illiterate client does not use Windows but Ubuntu, this obviously does not work. Now since I have no access to the files on that server, I tried to create a Greasemonkey script that replaces all of these scripts by an <audio> script, but then Firefox 12 complains that MP3 files cannot be played with <audio>. Chromium cannot play it either.

As a workaround I tried replacing it by <embed> and using the VLC plugin, but this time Firefox crashes due to a segmentation fault.

So, I am looking for a method that allows the audio from MP3 files being played in the Firefox or Chromium browser from a userscript or extension. Any ideas?

Community
  • 1
  • 1
Lekensteyn
  • 64,486
  • 22
  • 159
  • 192
  • Computer illiterate Ubuntu user... I thought I'd never hear that combination of words in the same sentence. I think your only option may be to host OGG as well or stick with Flash. Flash does work in Ubuntu. – jamesmortensen May 07 '12 at 21:33
  • @jmort253 I clarified the question that I have no access to that server. Not all Ubuntu users are geeks, there are grannies and even girls using Ubuntu ;) I thought of proxying the data and using `ffmpeg` to convert it, bit that is really a last, ugly option. – Lekensteyn May 07 '12 at 21:38
  • I wonder if this question would have better luck on http://askubuntu.com or perhaps http://superuser.com? And you're right, Ubuntu has become more than just a geek's os, but still, it's funny to see that in the same sentence :) – jamesmortensen May 07 '12 at 21:58
  • @jmort253 That would restrict the question specifically to Ubuntu, but I'm more looking for the programmatic method from a userscript / extension context. E.g. is it feasible to decode MP3 using Javascript and use some API to play it? – Lekensteyn May 08 '12 at 08:06

1 Answers1

2

Honestly, audio playback is still one of the cases where (most unfortunately) Flash is a very good answer. The code for playing back audios in Flash is straight-forward, and every Flash implementation (not just Adobe's, including the FOSS alternatives available on Ubuntu) can handle it just fine.

Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
  • Am I not going to get issues with Flash policies? The server does not host a flash player nor does it have a crossdomain.xml file. I suppose I cannot put a .swf file in a userscript? – Lekensteyn May 07 '12 at 22:01
  • I was unable to find better alternatives, so I had to rely on Flash (unfortunately). – Lekensteyn May 14 '12 at 19:06