jplayer / jPlayer

jPlayer : HTML5 Audio & Video for jQuery
http://jplayer.org/
Other
4.6k stars 1.47k forks source link

Fix: gracefull solution not used (e.g fail use Aurora for FLAC) #310

Open imShara opened 9 years ago

imShara commented 9 years ago

E.g fail use Aurora for FLAC if

What i need:

setMedia MP3 or OGA or FLAC jPlayer params {supplied:"mp3,oga,flac"}

If browser doesn't support format in html5 use aurora as solution {solution: "aurora", auroraFormats:"flac"}

And here is problem:

if {solution: "html,aurora", supplied:"mp3,oga,flac"} mp3: plays oga: plays flac: fail

if {solution: "html,aurora", supplied:"flac"} mp3: fail oga: fail flac: plays

if {solution: "aurora", supplied:"mp3,oga,flac"} mp3: fail oga: fail flac: plays

P.S

Please, check code around this place, i can't understand it. E.g

$.each(this.solutions, function(solutionPriority, solution) {
    if(solutionPriority === 0) { // Why first solution already desired?
        self[solution].desired = true;
    } else {
        var audioCanPlay = false;
        var videoCanPlay = false;
        $.each(self.formats, function(formatPriority, format) {
            if(self[self.solutions[0]].canPlay[format]) { // Why [0]? Maybe [solutionPriority]?
                if(self.format[format].media === 'video') {
                    videoCanPlay = true;
                } else {
                    audioCanPlay = true;
                }
            }
        });
        self[solution].desired = (self.require.audio && audioCanPlay) || (self.require.video && videoCanPlay);
    }
});
Phyks commented 8 years ago

Oops, I just saw this PR at the moment. I wrote a similar one (https://github.com/happyworm/jPlayer/pull/365), not sure which one is the best.

imShara commented 8 years ago

@Phyks, JPlayer is dead, use simple custom wrapper over audio tag and Aurora polyfill

Phyks commented 8 years ago

@imShara do you have any feedbacks on such solutions? Have you tried Howler.js for instance?

This issue affects Ampache a lot and we are hesitating between trying to fork and kind of patch jPlayer or just move to another solution.

imShara commented 8 years ago

@Phyks, I made myown simple solution with plain js api. Actually, we don't need any frameworks to play sound.