iPhone Playing a sound clip while recording a video using UIImagePickerController ... possible? - iphone

I'm using openAL to play sounds. I have a view controller that lets users upload a video. I want to give them a 1 minute warning sound so that they know to wrap things up. I tried using a call to SoundEngine_StartEffect(warningSound); but it just doesn't play anything. Is there a work around to this?

Did you try to set mix with others?
UInt32 doSetProperty = 1;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(UInt32), &doSetProperty);
It is in most cases a "must have", when trying to record and play at the same time.

Related

Record and play louder volume avaudio

I used the tutorial found here to record and playback a sound. The recording and playback work fine, but I can barely here the sound when I play it back. I've tried the following code:
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,
sizeof (audioRouteOverride),&audioRouteOverride);
I add it to my "play" method, right before I play the sound. I've also tried to add it to my viewDidLoad. Both of them make it so I can't here the playback at all. It seems to be working for others, but where should I add it?
I checked out SpeakHere, Apples example AVAudio app. The volume is very quiet. When I use the Voice Memos app, the recording is played back very very loud. Has anyone been able to play a recorded message and play it back that loud?
Try setting this property of AVAudioPlayer ...
#property float volume; /* The volume for the sound. The nominal range is from 0.0 to 1.0. */

Playing a movie file and then various audio files while movie is playing back. (iOS)

Is it possible to play some audio files while my movie is playing. I don't want it to interrupt or pause he movie. Just the audio to play at same time at various predetermined points.
Many Thanks,
-Code
You shouldn't have any problems with it.
If you want to synchronize or delay these players you should use
the code they provide in AvAudioPlayer Class Reference using
playAtTime: method.
Sadly MPMediaPlayback protocol doesn't provide the same method
so exact synchronizing with video is a bit harder task.
EDIT: RoLYroLLs mentions using MPMoviePlayerLoadStateDidChangeNotification to achieve this here and this approach seems promising.
Use two or three Audioplayer at same time . Play that audio when u need it

App vibrating but ring tone is not playing when makes app in sleep mode manually. iphone

Im implementing a fake call app.Im using a NSTimer for checking the time and it is working fine.The problem is when we press the sleep button,only vibration is working but ring tone is not playing.I tried this code but still ring tone is not playing.
AudioSessionSetActive(true);
// Set up audio session, to prevent iPhone from deep sleeping, while playing sounds
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty (
kAudioSessionProperty_AudioCategory,
sizeof (sessionCategory),
&sessionCategory
);
How can i solve this issue.please help.Thanks in advance
I am sorry but I think You can not show calling screen while device locked (deep sleep). The only way is to fire local notification to wake up your application manually by user. Something like : You have fake call now. Do you want to receive ? So when user press Yes and it will open your application and you will need to handle to show calling screen in appDelegate background methods.
I played with other Fake Call apps and they are doing same. We are not allowed to do any UI Changes in background. So this is the only way to achieve your goal to display calling screen.
Hope this help.
Edit:
I am not sure why vibrate is working. Did you set below property in your info.plist file ? Just to give it try. Not sure that will solve your problem. Just give it a try once. See attache picture. Set Required Background modes to App Plays Audio.

Combine two audio files together and play them in iPhone

I do not want any code but want to get a reference about my question mentioned below...
There is background music available and there is recording option in my app...
Once I start recording , application records my sound and when play button clicks , It will play the recording along with the background music...
I had use this Link but can not get as I want...
I think there is a mechanism like merging two audio files and make it one before playing....
How can I achieve this by coding... Is there any reference link or any sample code available?
Thnx in advance...
Most people mistake the one instance of AVAudioPlayer as the unit that plays the sound directly, but it doesnt. Mixing is done by the OS, not by the instance of AVAudioPlayer.
With other words:
No one says you can't have more then one AVAudioPlayer.
Create one for you background and let it play. Create another instance of AVAudioPlayer for you recorded sound and let it play. Voila

AVCaptureSession cancels background audio

Whenever I start an AVCaptureSession running with the microphone as an input it cancels whatever background music is currently running (iPod music for instance). If I comment out the line adding the audio input, the background audio continues.
Does anyone know of a way to record video clips with the microphone while continuing to allow background audio to play? I've looked around a lot, and can't seem to find any references to this behavior.
Thanks for any help!
Try setting kAudioSessionProperty_OverrideCategoryMixWithOthers as seen in https://stackoverflow.com/a/7426406/16572
Is the background music a looping track? -- if so you could make it a system sound and tell it to re-play when it finishes playing. The reason being you can only have tracks up to 30 seconds as a system sound.
Don't know if it helps -- but thats one approach :)
Cheers,
Michael
I had the same problem and used this in my app and it worked:
UInt32 audioRouteOverride = kAudioSessionCategory_AmbientSound;
AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,sizeof (audioRouteOverride),&audioRouteOverride);
I was able to record video and audio and at the same time play a sound out of the speakers.