jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => Topic started by: juribabarov on 06.03.2016 22:45:21

Title: downloadsite needs too long for loading [not jD]
Post by: juribabarov on 06.03.2016 22:45:21
Hello,

i have multiple download categories and they all works fine.
However, one of them, with only 7 entries per page needs too long for loading. It's about mp3 audio files with the html5 audio player. In other categories it works how it should.

This category with 4 downloads needs ~0.45sec
http://efg-coesfeld.de/medien/downloads/category/3-vortrag

This category with 7 downloads per page needs ~30sec
http://efg-coesfeld.de/medien/downloads/category/2-predigt-gottesdienst

I already reduced the number of items. But always the last audio files won't load fast and i have to wait for some time. Downloading the files while the site is loading works well.

The audio files works also. Does the audio player make trouble or is it some adjustments in jdownloads configuration?

Thanks
Title: Re: downloadsite needs way too long for loading
Post by: ColinM on 07.03.2016 01:08:11
Hi
I tried both links and both take the same amount of time, certainly less than a second.  I cleared the browsers cache and repeated - still very fast.
So I do not think this is a jD problem.

I had used Firefox so I thought to try other browsers.  Microsoft Edge was fine, maybe a fraction slower.  Chrome also appeared to load at same speed but was then 'busy' for some time.  I could not change the page with Chrome as something was going on.  Repeated several times. Then I cleared Chromes cache and suddenly it was as fast as the others! Stange!!
But not jD.

Colin
Title: Re: downloadsite needs way too long for loading
Post by: juribabarov on 07.03.2016 14:50:17
Thanks for the reply and testing.

Now I also tried Firefox and IE and it works fine with them. Only Chrome makes some trouble.
So it really has to do with something else.

Anyway thanks for checking.
Title: Re: downloadsite needs too long for loading [not jD]
Post by: ColinM on 07.03.2016 17:36:27
Hi
I have done a bit more research on the web.  A good reference seems to be
http://stackoverflow.com/questions/17004658/chrome-only-loading-6-html5-audio-tags
which matches your problem.

The problem seems to be the attempt by Chrome to simultaneously preload. The solution would perhaps be to use <audio controls preload="none">
Presently jD has <audio controls="">

This code is generated in jdownloadshelper.php around line 720 which currently reads:
$player = '<'.$playertype.' style="width: 100%;" '.'controls>';
If you change this to
$player = '<'.$playertype.' preload="none" style="width: 100%;" '.'controls>';
Then that should make Chrome better.  If you could try that, if possible, and let us know if it works!
Please note this area of code is actively being worked on for responsive behaviour.

Colin
Title: Re: downloadsite needs too long for loading [not jD]
Post by: juribabarov on 08.03.2016 14:33:09
Hi Colin,

thanks for the tip.
I tried to change the setting in preload="none" and had to clear joomlas cache. It worked :)

Now nothing preloads and the time of the mp3 file isn't displayed. I changed the option to preload="metadata". Now chrome doesn't preload the files as the other browsers but shows the time of the mp3 file.

In the code:
if ($playertype == 'video'){
            $player = '<'.$playertype.' style="width: 100%;" '.'controls preload="metadata">';
        } else {
            $player = '<'.$playertype.' style="width:'.(int)$jlistConfig['html5player.audio.width'].'px; "'.' controls preload="metadata">';
        }

therefore my problem is solved.  Thanks for the support!

juri
Title: Re: downloadsite needs too long for loading [not jD]
Post by: ColinM on 09.03.2016 06:14:53
Hi
In the next release of jD (v42) the browser type in use is checked and if it is Chrome it will generate preload="metadata"
Colin
Title: Re: downloadsite needs too long for loading [not jD]
Post by: juribabarov on 25.05.2016 15:02:39
Hello, me again :)

today I updated my site and noticed the same problem as last time.
In the file "jdownloadshelper.php" the code was changed only for the video-player.

if ($playertype == 'video'){
            $browser = self::getBrowser();
            if ($browser['name'] == 'Chrome'){ 
                // special handling for chrome browsers
                $player = '<'.$playertype.' preload="metadata" style="width: 100%;" '.'controls>';
            } else {    
                $player = '<'.$playertype.' style="width: 100%;" '.'controls>';
            }
        } else {
            $player = '<'.$playertype.' style="" '.'controls>';
        }


I added preload="metadata" also to the mp3-player:

if ($playertype == 'video'){
            $browser = self::getBrowser();
            if ($browser['name'] == 'Chrome'){ 
                // special handling for chrome browsers
                $player = '<'.$playertype.' preload="metadata" style="width: 100%;" '.'controls>';
            } else {    
                $player = '<'.$playertype.' style="width: 100%;" '.'controls>';
            }
        } else {
            $player = '<'.$playertype.' preload="metadata" style="" '.'controls>';
        }

Now all works again, also in chrome.
Maybe this could be added in a future patch.
Title: Re: downloadsite needs too long for loading [not jD]
Post by: Arno on 26.05.2016 09:09:35
Okay. Is done for next version.