Volume function not working?

281 views
Skip to first unread message

Lorodion

unread,
Feb 22, 2010, 10:58:59 AM2/22/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hello,

I just tried this plugin out and I must say it's a great piece of
work!
I'm in the process of implementing it right now and have found one
probable bug. The volume function ($(id).jPlayer( "volume", Number:
percent ) : jQuery) only changes the volume bar and not the actual
volume of the sound, should be an easy fix I guess?

/ Jonathan

Mark P

unread,
Feb 22, 2010, 2:14:11 PM2/22/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hello Jonathan,

I will review this, but I did test the volume on all browsers and it
worked. It is possible that I missed it. To aid my review would you
please provide:

1) A dev URL of your project
2) Name the browsers you found this problem on.
3) What OS you use, Eg., Windows Vista

Best regards,
Mark P.

Lorodion

unread,
Feb 23, 2010, 7:20:16 AM2/23/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hi,

I have noticed that this error exists in Google Chrome 4.0.249.89 on
my Windows Vista (64-bit SP1) machine. If you can test it under the
same conditions you will notice that if you set the volume to (for
example) 50% you will lower the volume, even though default is 20%.
Changing the volume works fine in two other browsers I have tested,
namely: IE7 and Firefox 3.0.18.

My dev-url is: http://bigspin.se/myjam/

Thanks a lot for helping out!
/ Jonathan

Mark P

unread,
Feb 23, 2010, 4:23:18 PM2/23/10
to jPlayer: the CSS styleable jQuery audio player plugin
Hello Jonathan,

You appear to have found a problem with the volume. However, I would
describe the problem differently. The volume setting a has no effect
when changing to a new track using setFile, when using Chrome 4. So
setting the initial volume to 20% and then changing to 50% does lower
the volume, since the initial 20% setting has no effect and the volume
was actually at 100%.

My testing must have missed that the volume is not working correctly
in Chrome 4 (or Chrome 5 beta). Chrome 4 uses the HTML5 solution for
the audio, whereas IE7 and FF3 use the Flash solution. I will test
this on other HTML5 browsers to see if this affects those too.

Firefox 3.6 (while using HTML5 audio / OGG files works) with the
initial volume setting and carries the volume setting over when
changing track using setFile.

Safari 4 (while using HTML5 audio / MP3 files works) with the initial
volume setting and carries the volume setting over when changing track
using setFile.

I can confirm that this only affects the Chrome 4 browser. This
happens when using either MP3 files or OGG files when using the HTML5
audio solution. When {nativeSupport:false} the Flash is used and I can
confirm that this works correctly in Chrome 4.

This problem only affects Chrome 4 while using HTML5 audio.

I will investigate this problem and see if a fix can be found that
solves the Chrome 4 problem.
(Reviewing the previous release, 0.2.5, it was found that Chrome 4 has
the same problem with the volume.)

Thank you for reporting this problem Jonathan, I will let you know
when I find a solution.

If I was to make an educated guess though, it would be that Chrome 4
requires that the volume is set AFTER the src is defined.
ie., File jquery.jplayer.js: moving line 271:
self.config.audio.volume = self.config.volume/100;
...down to after line line 283 (Inside the if() { scope }):
self.config.audio.src = self.config.diag.src;

During my development, I have found that HTML5 audio is a little
peculiar in places and tends to need 'a little time to warm up'. While
Chrome 4 supports both OGG and MP3 files, it appears to perform worst
out of the three HTML5 browsers (1st:Safari4, 2nd:Firefox3.6,
3rd:Chrome4). In particular when changing the play head time to a new
value, or when stopping and then playing the track from the beginning.

Best regards,
Mark P.

Mark P

unread,
Feb 23, 2010, 4:56:51 PM2/23/10
to jPlayer: the CSS styleable jQuery audio player plugin
Well, my initial attempt to solve the problem did not work. ie., using
the code changes in the last post, moving the volume to after the src.

I will add this to the list of issues to be solved in jPlayer 1.0.1

Best regards,
Mark P.

Mark P

unread,
Feb 23, 2010, 5:34:08 PM2/23/10
to jPlayer: the CSS styleable jQuery audio player plugin
It appears that Chrome 4 ignores the audio.volume change at
initialization, whether before or after setting the src. Another point
to note is that after setting the audio.volume, if you set it again to
the same value, it has no effect. Or in other words, setting the
audio.volume to the same value twice means that the 2nd timeis
ignored... Even thought he 1st time did nothing. Chrome 4 must check
the current volume and ignore changing it to the same value.

I proved this by the brute force setting of the volume in the
if(audio.readyState >= 1) clause of the jPlayerController(). This
solution, while it did fix the volume, is not good since it causes the
first 100ms or so of the sound to be at 100% before changing to the
correct volume setting. This then affected: safari4, FF3.6 and
Chrome4.

I will continue to look for a solution, but it will not be until later
in the week.

Best regards,
Mark P.

Mark P

unread,
Feb 24, 2010, 8:04:46 AM2/24/10
to jPlayer: the CSS styleable jQuery audio player plugin
The problem with the volume in Chrome is a known issue... Known by
Chromium:

http://code.google.com/p/chromium/issues/detail?id=33023&q=audio%20volume&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner%20Mstone%20OS

I will continue to look into a solution in the meantime.
Best regards,
Mark P.

Mark P

unread,
Feb 24, 2010, 12:04:52 PM2/24/10
to jPlayer: the CSS styleable jQuery audio player plugin
_SOLUTION_

Comment out line 271:

// self.config.audio.volume = self.config.volume/100;

Add at end of setFile() event (eventsForHtmlAudio) inside the
{ scope } line 280:

self.config.audio.addEventListener("canplay", function(evt) {
self.config.audio.volume = self.config.volume/100;
}, false);

This solution appears to work across Chrome 4, Safari 4 and FF3.6.
I will test this some more of course, but expect that this change will
be in the next release as it is shown here.

Best regards,
Mark P.

On Feb 24, 1:04 pm, Mark P <mark.panaghis...@gmail.com> wrote:
> The problem with the volume in Chrome is a known issue... Known by
> Chromium:
>

> http://code.google.com/p/chromium/issues/detail?id=33023&q=audio%20vo...

Mark P

unread,
Feb 24, 2010, 2:00:40 PM2/24/10
to jPlayer: the CSS styleable jQuery audio player plugin
The fixed jquery.jplayer.js version 1.0.0a has been uploaded to
GitHub:
http://github.com/happyworm/jPlayer

I will be using GitHub to release minor patches.

Best regards,
Mark P.

Lorodion

unread,
Feb 25, 2010, 2:31:50 AM2/25/10
to jPlayer: the CSS styleable jQuery audio player plugin
Excellent, the update works great!

/ J

Reply all
Reply to author
Forward
0 new messages