-2

如何在 ios 中将音频播放器静音?按下主页按钮时也静音?以及如何为 ios 设置音频会话?

4

1 回答 1

0

静音

[timeraudioPlayer setVolume:0.0];

对于音频会话

  AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    NSError *err = nil;
    [audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:&err];
    if(err)
    {
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return;
    }
    [audioSession setActive:YES error:&err];
    err = nil;
    if(err){
        NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
        return;
    }
于 2013-10-29T05:22:52.000 回答