I tried setting the iPod volume level before, but it affected the volume of my app, which uses MPMusicPlayer. Any solution to this?
If your app is playing music locally (not affecting the iPod app) you can use MPMusicPlayerController to create an application music player and then set the volume property to whatever you want.
MPMusicPlayerController Class Reference
Related
In my app I have to play the siren sound on tapping the button, I can able to play it when ringer volume is set to some value, but my problem is when user kept their ringer volume to zero, how can I play it with maximum sound?
Officially you can't do this. As a smartphones user, I wouldn't appreciate to set my volume at 10% and have an app that rings at max volume.
You can however try to use Celestial.framework, but your application will be rejected from the App Store.
try this code ,it only work in device
[[MPMusicPlayerController applicationMusicPlayer] setVolume:setvalue];
Hi I am using MPMoviePlayerController to play a movie in my app. My client wants to boost the audio of the movie that should be greater than iOS system max volume. How to achieve this?
It's impossible to boost volume higher than iOS default settings.
If your client wants louder audio in a video, get them to edit the video content and up the volume of the video's audio (in the case that their video sound is very low).
For example: http://www.youtube.com/watch?v=OvLgQ61wJS8
For iOS, the device user is in control of the volume, you cannot apply sound volume larger than their defined volume or any volume at all if the device is muted.
What would the best method be for mixing background iPod music with sound effects? The sound effects need to be adjustable and sometimes much louder than the background music. When I use MPMusicPlayerController the volume is system-wide and reduces the effects volume as well. I have been reading about AVPlayer and AVAudipPlayer but can't seem to locate a viable solution.
Any help and suggestions would be greatly appreciated.
The problem is that you cannot play much louder sound over iPod music library because as you wrote iPod music use system volume. Unless the music files in your iPod library is compressed with very low volume.
Cocos 2D framework integrates very nice way how to mix-up more sound sources, but again it uses AVAudioPlayer for background music and Open AL for other sounds.
Have you looked at AVAudioSession Categories? I think that could help you with your problem. The docs at Apple.
i'm using the code of this link: http://blog.stormyprods.com/2008/09/proper-usage-of-mpvolumeview-class.html
it is working on an ipod touch, but NOT on iphones.
what can be the reason for that?
Two things:
I think iPhone OS 3.0 does a better job of syncing the MPVolumeView slider with changes to the system volume received from the buttons on side. So the workaround on that blog (listening for NSNotifications) may no longer be necessary.
On the iPhone, volume changes are contextual. If your app is currently playing sound, then hitting the volume buttons (or, presumably, MPVolumeView) affects the volume level of your app's audio. But if your app isn't producing sound, then you are just changing the ringer volume. This might explain why your current code works on touches, which don't have ringers.
You can easily play sounds and record sounds using the high level AVAudioPlayer. And you can play sounds using the same framework, while the iPhone screen is locked. Can you record sounds at that time?
Yes, of course, just set correct category....................................................................................................................................
""AVAudioSessionCategoryRecord
For recording audio; this category silences playback audio. Recording continues with the screen locked.
Available in iPhone OS 3.0 and later.
Declared in AVAudioSession.h.
AVAudioSessionCategoryPlayAndRecord
For recording and playback of audio—simultaneous or not—such as for a VOIP (voice over IP) application.
This category silences audio from other applications, such as the iPod. You can, however, modify this category to allow mixing by using the kAudioSessionProperty_OverrideCategoryMixWithOthers property. Your audio continues with the Ring/Silent switch set to silent and with the screen locked.