How to play audio and video together in iphone - iphone

I want to play some videos with audio from different audio files. For this i am playing a video(using MPMoviePlayerController) and i am playing an audio(using AVAudioPlayer).
When i play my code through simulator it works fine (the video with my audio file specified). When i run the application in device it doesn't work like that. It plays video but sound file is not getting played. How can i play an audio and a video together ?

This has been discussed before and I don't think anyone's figured it out yet:
Play audio and video at a same time in iPhone application
how can we play audio and video together in ipod/iphone?
Which format support the audio file with a playing video?

Related

How to mute MPMoviePlayerController sound in iPhone

I have two kinds of media,
video with sound
recorded voice audio
I want to play recorded voice audio with video but mute video sound.
To play these medias, I used the MPMoviePlayerController for video and the AQPlayer for recorded audio.
Is it possible?
If so, Anyone has an idea, Please?

Replay option not displaying youtube video in UIWebView?

Currently i am trying to play one youtube video in my application UIWebView. On first time playing, the video is playing perfectly and i can able to see and listen both video & audio, but when the video played completely and i select replay option present in video screen,the video is not displaying anything(its just displaying black screen) but i can able to hear audio.
Where i am going wrong, How to fix this problem ?
Tools used : XCode: 4.3.2, iOS :5.1

Recording Video while playing a video on iPhone?

i am trying to record a video from front camera of iPhone using AVFoundation class while user watches a video...with the help of WWDC 2010 samples i am able to record the video using front camera when the video is not playing but when i try to record it while user plays a video in MPMovieViewController the video does not get recorded..When i use MPMovieViewController does it starts on a different thread due to which i am not able to record the video in the background?? is playing the video in a UIWebview will be a better option??
Try using NSThreads. You should find some info about them in tutorials.

Play video's audio track when enter background?

I'm using mpmovieplayer to play video on ios 4, and I want to keep the audio playing when my app enter background, but it doesn't work. I thing it's because video player use GPU to render video on screen and this is not allowed by apple when app enter background.
So, is there any way to do that? There are some apps have this feature, and they seems just use the mpmovieplayer, is it work by detach the video layer of mpmovieplayer?
Thanks for your answer!
You'll need to have separate audio file and video file for this. Play both when you need to play video and just the audio when app gets into background.

help me pick the right iPhone audio class - MPMoviePlayer vs AVAudioPlayer vs MPMusicPlayer

Does anyone know of a good tutorial on the distinction between the MPMoviePlayer vs AVAudioPlayer vs MPMusicPlayer?
I want to play audio from an mp3 file available at an external URL.
Ideally it is played in an iPod-like audio view. I toyed with MPMoviePlayer but it appears to be more suitable for video, as when audio starts a "movie playing" message displays, the controls disappear and a white quicktime splash page displays.
I would like the standard ipod audio controls to display all the time, and to customize the image behind them.
Here's a great little group of articles from Ray Wenderlich. Not specifically what you're after but might come in handy.
Audio 101 for iPhone Developers: Playing Audio Programmatically
Audio 101 for iPhone Developers: File and Data Formats
Audio 101 for iPhone Developers: Converting and Recording