Return system (media) volume
Hi,
Errm might be a silly question, but how do i return the system media volume? The one you get when your in the app playing back a file and you use the volume controls on the side. I've got a looping sound object and getVolume() returns the volume value of that object (which defaults to 0.5). I see that Ti.Media has a property volume but that seems to return nothing (at least i get no exceptions or anything when i call it in an alert). The api docs don't return anything else for "volume" and i really need to be able to control this (i would be very surprised and disappointed if i could not)
2 Answers
-
I dont know if there exists some other way, but I wrote a micro-module for Android that handles the volume stuff… I used it to make up a custom slider that works in sync with volume hardware buttons…
If interested, write to annakozy2007(at)gmail.com… or you can write it yourself, it's really small and it's my first module whatsoever :)))
It uses AudioManager class like this (read the API for AudioManager in developer.android.com):
private AudioManager audio; public VolumeModule(TiContext tiContext) { super(tiContext); audio = (AudioManager) tiContext.getActivity().getSystemService(Context.AUDIO_SERVICE); } // Methods @Kroll.method public void volumeUp() { Log.d(LCAT, "volume up"); audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE,1); }
etc.
-
hey i need some help !
I search like something like your code you post !I want to modified Media Control for using inside Titanium !
So I have to (play/pause/back-forward/vol-up/down) code … could you post you module sources / eg. link me
your packed sources (module) ?also i need to route sound (android) to titanium socket stream (does i need also module java code ? )