iPhone SDK Question with Audio/Mic - objective-c

I am trying to do an app, to where when it launches, it will detect audio, and then play it back automatically. NO BUTTONS, nothing to press. Just a picture of something then, it listens for audio, then plays it back. Similar to the Talking Carl app in the App Store. Any ideas/help? Would appreciate it, if i could use the code with IB.

Work through this example:
http://www.iphoneam.com/blog/index.php?title=using-the-iphone-to-record-audio-a-guide&more=1&c=1&tb=1&pb=1
And then you'll want to put the code for recording and playing back the audio in the viewDidLoad method of whichever view is your main view.
One thing you might also want to consider is how long you want it to record before it plays it back? And also, you'll want to stop recording once the sound starts playing... and also you'll want to start recording again once the sound STOPS playing.... all these things to think about and learn about :)

Related

play audio in background on intervals iOS

So I am working on an app that requires different audio files to be played using an NSTimer every X amount of time. Yes, it needs to play the audio in the background as well, but I have had inconsistent results trying to do so. I have searched the web thoroughly to find a solution to this problem, but I have had no luck.
I have enabled background modes and checked off item 0(audio) and made sure it was in my info.plist. I have set the "App does not run in background" key to NO in the info.plist. In the viewDidLoad method of the VC, I have set the AVAudioCategory to categoryPlayback and set the AVAudioSession to active. I have also moved these lines of code around in different places of the app to look for different results, and the best results I have gotten is that the app will continue to run in the background sometimes and at other times it will suspend.
Through all of my searching, I have seen forums explaining how to play audio in the background. However, I have not found any solutions to playing short audio files in the background intermittently on different scheduled intervals.
I know of at least one app in the App Store that is able to do this, and they use the ducking feature of AVFoundation to duck audio playing in the background(Im not sure if other frameworks are able to duck background audio, such as AudioToolbox, but I would like to have ducking enabled for my app).
If anyone knows of any legal solution for my problem, your assistance would be greatly appreciated.

Playing a muted video without interrupting background music

My design calls for a video playing in the background of my login screen, exactly like 6snap has.
I would like to avoid the default behavior of stopping the user's music when the video starts to play. My video does not have sound.
I'm using:
<MediaElement Source="MyVideo.mp4" />
I tried setting IsMuted=true which didn't help. Does anyone have an idea how 6snap managed it?
Edit: currently trying the animated gif route. Using the ImageTools 3rd party library and having converted my MP4, it works fine. My 9 second 640x1136 3MB video became a 41MB GIF, so I have to reduce the quality drastically. Still trying to find a better way if possible.
You won't be able to do that with Background Audio and MediaElement, hence as MSDN says:
When a MediaElement control plays audio or video content, any background sounds or media already playing are halted. The app launches the playback experience when the user taps the control. Only one MediaElement control can operate at a time.
It's no matter you have no sound - when you start to play all background sounds/media are halted.
I'm not sure how the App you have mentioned achieved that, but maybe you can try with DirectX/XNA - thought I've not tried this and don't know if that would help.

start video record on view load in ios

I've looked through the Apple documentation but have seen no mention of how to do this, nevermind if it's even possible or not. I'd like to make it so that an iPhone/iPad begins video recording automatically when a certain view is loaded, and stops and saves when the view is dismissed. Is there any way that I can do this or am I just going to have to use the normal UI for video recording?
Use AVCaptureSession
https://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureSession_Class/Reference/Reference.html#//apple_ref/occ/cl/AVCaptureSession

Multiple videos on screen using MPMoviePlayerController

What I want to achieve here is a screen with 2 or more different videos on at a time. I know in the apple documentation it says you can't have more than one video playing at a time and thats fine, I don't want to do this.
All I want is to have the 2 videos on screen and when you press on it, it starts to play, you can go fullscreen if you want but as soon as you press on a different video, the old video stops and the new one starts.
I already have three MPMoviePlayerController set up with the correct position, size and video and the 3 boxes are all drawn to the screen but at the moment, only the last one to be drawn to screen can actually be watched.
Does anybody know if there is any way to achieve this or not and if so, how would I go about it?
Thanks,
Matt
As for as I know, you can only have one active movie player at the same time. It's a limitation from MPMoviePlayerController. Message in Apple documentation :
Note: Although you can create multiple MPMoviePlayerController objects
and present their views in your interface, only one movie player at a
time can play its movie.
Source : http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html

Dismiss a series of UILocalNotifications or an alternative approach to achieve the same functionality

I am building a small app that I can use to do Interval Training,
it schedules a series of UILocalNotifications, all scheduled at the same
time and all fired within a few minutes of each other.
The idea is that you put in your headphones and start a workout,
when you hear one kind of sound you rest and another kind of
sound you workout. I do this with localnotifications, it works
just fine. The reason for doing it like this and not just
having the app run with a timer is that I would like for
the Nike +iPod app to run in the foreground at the same time.
The notifications are just an alert and an OK button:
[notif setHasAction:NO];
So the idea is: Pop in the headphones, start my app, it schedules a series of notification - then start the Nike +iPod workout. When you hear the Notification sound, change from rest to workout or vice versa.
Ok, when the workout is over there are 15+ notifications on the screen and they need to be manually dismissed, this is a bit annoying and not at all user friendly.
My question is now if there is a way to post only sound notifications? OR make sure earlier notifications are removed as new ones pop up OR is there a different/better way of going about achieving the functionality of getting a "sound indicator" while the app is in the background?
Hope someone can lend a bit of experience or a good idea for an alternative:)
Thanks in advance.
I can't confirm how well this would actually work, but if you set the alertBody property on your UILocalNotification object to nil (this is the default value) when you create them, it should prevent an alert from appearing on screen as you fire them.
In addition, you might also want to set the hasAction property to NO, which prevents the user from seeing the action buttons (if you had an alert), or the slider (if they had the device locked).
But as for the actual stacked notification alerts - I don't believe there's any way to prevent them getting stacked. That's something which might be worth raising a Radar for, so Apple could consider allowing that to happen in future iOS versions.