tags:

views:

32

answers:

1

I'm using a MPMoviePlayerController to play some video, I get image, but as soon as I try to play a sound without the earphones, the volume control disappears with an animation. If I plug the earphones, or some external speakers, the volume control returns with an animation.

The app has been tested with an iPad iOS 3.2 and works fine, also with an iPod touch 2G iOS 3.0 and works fine too, but the problem comes with the iPhone 4, and iOS 4.1.

A: 

I found out it's because I hadn't set the Session category:

NSError *setCategoryError = nil; 
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError]; 

if (setCategoryError) { //handle error } 

http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Cookbook/Cookbook.html#//apple_ref/doc/uid/TP40007875-CH6-SW6

Leg10n