×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    15

    How to change the sound volume

    Hi all

    When I play an mp3 file the sound volume is allways 0. How can I raise the volume?

    This is my code. I tried several values for the volume attribute with no result. Is there any link with the audio/x-mpeg attributes?

    I'm using the N97.

    Code:
    function playSound (file) {
    	var node = document.createElement ("object");
    
    	node.setAttribute ("type","audio/x-mpeg");
    	node.setAttribute ("data", file);
    	node.setAttribute ("width", "0");
    	node.setAttribute ("height", "0");
    	node.setAttribute ("autoplay", true);
    	node.setAttribute ("volume", "100");
    
    	document.body.appendChild (node);
    }
    Thanks in advanced.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to change the sound volume

    Hi lgmenu,

    did you solve this? If not: are you testing with the device in "Silent" profile?

    Pit

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    15

    Re: How to change the sound volume

    Hi jappit

    Not yet. I'm using the normal profile. The widget allways start with volume at 0. I can use the hardware keys to raise the volume but it's a bit annoying.

    any ideas?

    Thanks for reply.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,168

    Re: How to change the sound volume

    could be that the volume is between 0 and 10 as well, and any invalid value is ignored. Anyway, just guessing here..

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    15

    Re: How to change the sound volume

    Hi

    I've tried several values like "5" or "5%" without result.

    Thanks for reply.

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: How to change the sound volume

    Hi,

    Try like this.
    /*
    ** Get the max volume and expected value from Setting and then set it.
    */
    TInt Vol = ((iPlayUtility->MaxVolume() * iVolumeSetting.Volume()) / 10);
    iPlayUtility->SetVolume(Vol);

  7. #7
    Registered User
    Join Date
    May 2008
    Posts
    15

    Red face Re: How to change the sound volume

    Hi Mahbub,

    Doesn't work. I've try this:
    Code:
    var node = document.createElement ("object");
    node.id="audioplayer";
    node.setAttribute ("type","audio/x-mpeg");
    node.setAttribute ("data", file);
    node.setAttribute ("width", "0");
    node.setAttribute ("height", "0");
    node.setAttribute ("autoplay", true);
    node.setAttribute ("volume", "50");
    document.body.appendChild (node);
    	
    var obj = document.getElementById ("audioplayer");
    
    try {
        var x = v.maxVolume();
    } catch (ex) {
        alert ("Problem: " + ex);
    }
    This returns

    Code:
    TypeError: Value undefined (result of expression v.maxVolume) is not object.
    Thanks for reply.

  8. #8
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: How to change the sound volume

    Hi,

    I am not sure in is there any special steps to initialize in web runtime (I was talking in Symbian way..).
    In Symbian it works. In Symbian, after initilization we can set the volume. I think it should be the same here as well. You can see there is an example in SDK and follow that.

Similar Threads

  1. How to control the phone sound device volume?
    By Joney.Zhang in forum Symbian
    Replies: 2
    Last Post: 2008-11-24, 07:33
  2. Howto unmute/max sound volume on 40 series device?
    By skipperkongen in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-09-14, 01:34
  3. Is it possible to control the volume sound from proprietary app
    By fjorge_ht in forum Symbian Media (Closed)
    Replies: 4
    Last Post: 2007-06-06, 10:15
  4. Sound Volume n73
    By rpillet in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-08-23, 13:24
  5. Nokia Smart Expert - solve this sound problem
    By tsoh_tan in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2003-10-30, 04:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×