I would like to recording from microphone and playing i-pod library music at the same time.
so i try to code like this .
-( void ) SetUpAudioSession{
// getting mpobject
MPMusicPlayer *mp = [ MPMusicPlayerController applicationMusicPlayer ];
( or MPMusicPlayer *mp = [ MPMusicPlayerController iPodMusicPlayer ]; )
// getting player volume
defalutVolume = mp.volume;
// setting cagetory
UInt32 category = kAudioSessionCategroy_PlayAndRecord; AudioSessionSetProperty( kAudioSessionCategory_AudioCategory , sizeof( category ) , &category );
// override
category = 1;
AuidoSessionSetProperty( kAudioSessionProperty_OverrideCategoryMixWithOthers , sizeof( category ) , &category );
// setting active
AudioSessionSetActire( true );
}
- viewDidLoad{
// making volume slider.
MPVolumeView *volumeView = [ [ MPVolumeView alloc ] initWitFrame : CGRectMake( 25,315,270,30 ) ];
[ self.view addSubview: volumeView ]; [ volumeView release ];
[ self SetUpAudioSession ]
[ super viewDidLoad ]
}
1: Build this project and download to iPhone device.
2: Run this application and play ipod-muisc , and change volume.
3: Close this application.
4: Run ipod.
So , i can't change the value of volume slider. ( but i can change the volume.)
How do you propose to fix this problem?