Solved

jPlayer master volume

Posted on 2013-05-31
3
835 Views
Last Modified: 2013-06-06
I have just come across jPlayer.

I want to create an ipad webapp which has 6 different audio clips on one page.

The iPads will be locked in holders so the user wont be able to get to the ipad volume buttons and the webapp will be locked in guided access mode.

I want to have 1 master volume on the page.

Can this be done? Either using the jPlayer or some ipad webapp code.

Any Advice?

Steve
0
Comment
Question by:Steve Tinsley
  • 2
3 Comments
 
LVL 25

Assisted Solution

by:clockwatcher
clockwatcher earned 500 total points
ID: 39213309
The jPlayer has a volume method:

   $('#jquery_jplayer_1').jPlayer("volume", volume);

You just need to set the volume of each instance of your player.
$(document).ready(function () {
    $("#slider").slider({
        max: 100,
        min: 1,
        step: 1,
        change: function (event, ui) {
            volume = ui.value / 100;
            $('#jquery_jplayer_1').jPlayer("volume", volume);
            $('#jquery_jplayer_2').jPlayer("volume", volume);
        }
    });
    $("#jquery_jplayer_1").jPlayer({
        ready: function (event) {
            $(this).jPlayer("setMedia", {
                mp3: "http://www.mostlywrong.info/2.mp3",
            });
        },
        swfPath: "http: //jplayer.org/latest/js",
        supplied: "mp3"
    });
    $("#jquery_jplayer_2").jPlayer({
        cssSelectorAncestor: "#jp_container_2",
        ready: function (event) {
            $(this).jPlayer("setMedia", {
                mp3: "http://www.mostlywrong.info/1.mp3",
            });
        },
        swfPath: "http: //jplayer.org/latest/js",
        supplied: "mp3"
    });

});

Open in new window


Here's an example fiddle: http://jsfiddle.net/7V86t/3/  -- use the master volume slider and it will adjust the volume for both players.
0
 

Author Comment

by:Steve Tinsley
ID: 39215072
Thanks for the solution! Works perfectly in Safari!

I am trying to get it working on an iPad in mobile safari but the volume command doesn't work.
I have added the jQuery UI Touch Punch jQuery script which makes jQuery UI work on an iPad.  I can verify the slider is working by adding an alert on change.

Do you have any idea? Is this anything you could help with?

Steve
0
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 39215181
Googling around a bit and found this:

https://groups.google.com/forum/?fromgroups#!topic/jplayer/QHTeNakQyLA

It appears that the iPad doesn't allow you to change the volume from a webpage.  One guy is resorting to sampling things at different volume levels and switching the source if it's an iPad.  I'm sure that's not what you wanted to hear but unfortunately as it stands now it doesn't look like you'll be able to control the volume through a web app.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Javascript Case Expression 7 29
Trying to redirect after event in javascript 3 21
jquery progress bar 3 40
how can i apply an assert arrayEqual function ? 2 24
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now