Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to set volume on an AudioPlayer object?

Hi everyone,

since I didn't find an answer in the forum, I'll give this post a try. Is there a way to control the volume for an audio stream?

I looked it up in the documentation but it seems an Ti.Media.createAudioPlayer object does not have a volume control. Maybe theres another way to do this?


— asked May 14th 2010 by Sascha Glabasnia
  • audioplayer
  • stream
  • volume

5 Answers

  • Created a module based on Ludovic Lecerf suggestions. Can be found here: https://github.com/moreli/Titanium-Module-Volumeslider

    — answered July 18th 2011 by Eli Mor
  • Hi,

    I have a feeling the guidelines say this should be set by the user on the device and not by an app. Different levels might by applied depending on whether the headphones are being used, for example.

    There is a .volume property, but I think this is just 'get' rather than 'set' - so you could show a volume level indicator, but no means to control it via your app.

    — answered May 14th 2010 by Kosso
  • Anyone find the answer to this? I spent two days build an app that will stream a live radio feed only to discover that you cannot control the audio volume for a live stream using the slider (or buttons for the matter).

    — answered July 28th 2010 by Steve Yerkes
  • Hi Eli,

    Thanks for creating the volumeslide module.

    One question, does it work in simulation mode?

    I have set everything up correctly and volumeSlider.value it outputting correctly, but the volume doesnt change in the simulator..

    I havent got an account with apple to test it on the device just yet.


    — answered January 23rd 2012 by Jay J
    1 Comment
    • Jay, this does not work on a simulator. It will only work on an actual device. The simulator does not show the view of the slider. As mentioned in this StackOverflow Post

      — commented January 23rd 2012 by Eli Mor
  • Hi,

    There is a way to make a MPVolumeView object, it's an UISlider object but only used for change the system volume. More info : http://www.ludoviclecerf.com/blog/2011/05/20/appcelerator-make-volume-slider-audioplayer

    — answered May 21st 2011 by Ludovic Lecerf
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.