Search code examples
jqueryjplayer

Firefox and Opera are HTML5 browsers, why are they using jPlayer's Flash fallback?


I have read the FAQ and could not find answer to my problem.

http://jplayer.org/support/

My requirement is if flash is not present in Firefox/Opera/Chrome browsers it should use the HTML5 "audio" to play the audio files.

Here is how my code looks like

/*Following code creates URL for M4A and OGG from MP3 url*/
var _oggurl = _url.substring(0, _url.lastIndexOf("."))+".ogg";
var _m4aurl = _url.substring(0, _url.lastIndexOf("."))+".m4a";

$('#jquery_audioPlayer').jPlayer("setMedia", {mp3:_url, m4a:_m4aurl, oga:_oggurl});
$('#jquery_audioPlayer').jPlayer("supplied", "mp3, m4a, oga");
$('#jquery_audioPlayer').jPlayer("play");

I have converted the audio in 3 different formats mp3, m4a and ogg and passing the arguments to jPlayer. Still when the flash plugin is removed from browser the audio does not play. I have checked the audio by embedding it seperately using audio tag of HTML5 (without jPlayer) and it plays correctly.

What changes should I incorporate to make it work correctly.

Thanks for any help.


Solution

  • Ok I figured the solution. I was not passing "supplied" during initialization of jPlayer. It does not cause any issue while using the flash solution but cause issue with HTML5 audio.

    $("#jquery_audioPlayer").jPlayer({
    swfPath: "../js",
    supplied: "oga, m4a, mp3",
    solution: "html, flash",
    wmode: "window"
    });