Video and headphones issue - iphone

I have a custom video player that works very well. I discovered a problem and would like to know if this is a problem of iOS or is there a way to solve. When I'm watching and listening to the video with headphones on and take off my headphones, the sound continues, but the video freezes.
I am using MPMoviePlayerController for video and AVAudioPlayer for audio.
Tks for help

You can get a callback when headphones are unplugged from the device. This might be a good starting point.
Check out this SO question: Headphones unplugged during playback cause bug on iPhone app

Related

Ipod stops Playing while recording Audio

Recording the audio and playing the iPod at the same time, but iPod stops playing,while recording audio in iPhone application. Please help
This is normal, just tested it out on my iPhone 4, 5.0.1. It's probably to avoid possible interference between the output music and the mic, since, to my knowledge, the microphone and the speakers are right next to each other.

MPMoviePlayerViewController and background audio

I am having trouble playing audio inside a MPMoviePlayerViewController in the background. I can point it to mp3's just fine and listen to the audio, but when I go into the background, I don't hear audio anymore.
I set the plist entry to keep playing audio and set the audio session toAVAudioSessionCategoryPlayback. When I hit the home button, wait a few seconds, and go back to the app, the audio advanced as if it had kept playing, I just can't hear a thing when the app is in the background.
Any idea what causes this?
Thanks!
I just tested in the simulator, and it fails there. It does work fine on the device though. Must be a bug in the simulator.

IPad videos don't play after multiple runs

I'm working on an IPad application (iOS 3.2) that plays a couple of videos using the MediaPlayer framework. After running the app for a while videos don't play anymore. The video is loaded, meaning i can buffer through it but it's started in pause mode and cannot be set to played. Each time i press play it pauses again. After restarting the device videos behave normal again.
Does anyone have any idea why this strange behavior happens?
Found the solution that worked for me. If i set the MPMoviePlayerController's useApplicationAudioSession to NO then videos play normally.

iPhone 4.0 problem.. MPMoviePlayerViewController , AVAudio APIs

I'm making iphone program. The main function is playing video files, and recording sound.
OS 3.1.3 version is fine. But iPhone 4.0 makes problem!!
When I executed playing video (MPMoviePlayerController) and continuously recording sound (AVAudioRecorder), AVAudioRecorder doesn't work....
No recording..! ;o;
Somebody help!!
Check the useApplicationAudioSession property on MPMoviePlayerController. In iOS 3.1.x, the movie player was always getting its own system provided audio session. In iOS 4.0, it can now share the application session, and that's the default value as well. Try switching that property to NO before starting to play your movie.

iOS4 and audio playback during backgrounding

When my app is backgrounded, the audioplayer continues to play, but i cant hear any sound. When i open my app again, it plays from the point where it would have been had the app not been backgrounded at all. This shows that the app is playing in the background though it is not audible. Why could this be happening?
I have set the audio key in the info.plist for the UIBackgroundModes array. Also my audioplayer is set to the "AVAudioSessionCategoryPlayback" category with an override to allow for audio mixing. So what am i doing wrong that im unable to hear the audio even though it is playing in the background?
Could this be an issue with the simulator alone as i have not been able to test this on a device with iOS4 so iv only been testing it on the simulator.
It's an issue with the simulator most likely. I implemented what you stated and it works just fine on the device: Entering background on iOS4 to play audio