from :http://blog.csdn.net/sxsoul/article/details/8467836
[[UIDevice currentDevice] setProximityMonitoringEn
//建议在播放之前设置yes,播放结束设置NO,这个功能是开启红外感应
//添加监听
defaultCenter] addObserver:self
//处理监听触发事件
-(void)sensorStateChange:(NSNotificationCenter *)notification;
{
([[UIDevice currentDevice] proximityState] == YES)
is close to user");
sharedInstance] setCategory:AVAudioSessionCategoryPl
error:nil];
is not close to user");
sharedInstance] setCategory:AVAudioSessionCategoryPl
error:nil];
}
//初始化播放器的时候如下设置
sessionCategory = kAudioSessionCategory_MediaPlayback;