mumbl icon indicating copy to clipboard operation
mumbl copied to clipboard

MP3 doesn't work in browsers other than Chrome and Safari

Open NV opened this issue 14 years ago • 7 comments

Demo stops working when I comment out line 22:

playlist.location + encodeURIComponent(playlist[i]) + ".ogg", "audio/ogg; codecs=vorbis",

I expect mumbl to fallback into SoundManager when MP3 does not supported, but it doesn't seem to work. It still trying to play music with HTML 5 Audio.

Firefox (doesn't work):

>>> mumbl.player
1
>>> mumbl.interface
<audio autoplay="">
>>> mumbl.interface.canPlayType("audio/mpeg")
""

Chrome (works well):

>>> mumbl.interface.canPlayType("audio/mpeg")
"maybe"

NV avatar Oct 28 '10 22:10 NV

In a future version, I will iterate through every audio type provided to mumbl, and then if none of them are supported, switch to using SM2. I'll close this bug once I make said fix.

Honestly though, you should be providing an vorbis version too. Many people (including me) have flash player blocked or disabled by default, so falling back to SM2 should be a last resort.

eligrey avatar Oct 28 '10 23:10 eligrey

So, how can I fallback into SM2 now? I'm not sure I'm able to have vorbis version of files.

NV avatar Oct 28 '10 23:10 NV

Run the following code before including mumbl if you want to use SM2 instead of HTML5 in browsers that don't support MP3 (untested).

if (self.HTMLAudioElement && self.HTMLAudioElement.prototype.canPlayType) {
    if (!document.createElement("audio").canPlayType("audio/mpeg")) {
        HTMLAudioElement.prototype.canPlayType = null;
    }
}

Why can't you use vorbis versions of the files?

eligrey avatar Oct 28 '10 23:10 eligrey

That works, thank you!

In that case I have to convert MP3 files into OGG vorbis. I have to do it every time I add new music file.

NV avatar Oct 29 '10 00:10 NV

In a future version, I will iterate through every audio type provided to mumbl, and then if none of them are supported, switch to using SM2.

I'll tackle it tomorrow unless you have fixed it first.

NV avatar Oct 29 '10 01:10 NV

I'd be very grateful if you did, as I'm too busy atm to do anything more than adding that slice(0) in my last fix. :)

Please note that this won't be a trivial fix, as all 3 platforms are completely separate in their implementations due to wildly differing APIs, and you would have to somehow add support for SM2 in the HTML5 one.

eligrey avatar Oct 29 '10 01:10 eligrey

I'm sorry, it's much more complicated than I thought.

I tried to use latest version of SM2 with soundManager.useHTML5Audio = true. http://github.com/NV/mumbl/compare/mp3. It doesn't work well.

NV avatar Oct 29 '10 18:10 NV