如何在iOS中以绿色显示Voip应用程序的呼叫状态栏(双倍高度)?

时间:2013-12-24 12:35:56

标签: ios iphone voip statusbar in-call

我正在开发一个基于sip调用的应用程序,我想在后台发送呼叫,如果任何人开始呼叫并且退出应用程序。在这种情况下,我想在屏幕上显示呼叫持续时间。为此我正在使用in_call状态栏。但我使用的代码是将in_call状态栏的背景颜色设置为红色,我没有得到如何将其颜色更改为绿色也想要在其上显示计时器。我正在使用这个第一次我没有得到如何解决这个问题。这是我的代码。如果有人可以帮忙。我在 didFinishLaunchingWithOptions 方法上调用此方法

    +(void) startRecording {
    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;
    }


    NSMutableDictionary * recordSetting = [
        [NSMutableDictionary alloc] init
    ];

    [recordSetting setValue: [NSNumber numberWithInt: kAudioFormatLinearPCM] forKey: AVFormatIDKey];
    [recordSetting setValue: [NSNumber numberWithFloat: 44100.0] forKey: AVSampleRateKey];
    [recordSetting setValue: [NSNumber numberWithInt: 2] forKey: AVNumberOfChannelsKey];

    [recordSetting setValue: [NSNumber numberWithInt: 16] forKey: AVLinearPCMBitDepthKey];
    [recordSetting setValue: [NSNumber numberWithBool: NO] forKey: AVLinearPCMIsBigEndianKey];
    [recordSetting setValue: [NSNumber numberWithBool: NO] forKey: AVLinearPCMIsFloatKey];


    NSURL * url = [NSURL fileURLWithPath: @"/dev/null"];
    err = nil;
    AVAudioRecorder * recorder = [
        [AVAudioRecorder alloc] initWithURL: url settings: recordSetting error: & err
    ];
    if (!recorder) {
        NSLog(@"recorder: %@ %d %@", [err domain], [err code], [
            [err userInfo] description
        ]);
        UIAlertView * alert = [
            [UIAlertView alloc] initWithTitle: @"Warning"
            message: [err localizedDescription]
            delegate: nil
            cancelButtonTitle: @"OK"
            otherButtonTitles: nil
        ];
        [alert show];
        return;
    }

    //prepare to record
    [recorder setDelegate: self];
    [recorder prepareToRecord];
    recorder.meteringEnabled = YES;

    BOOL audioHWAvailable = audioSession.inputIsAvailable;
    if (!audioHWAvailable) {
        UIAlertView * cantRecordAlert = [
            [UIAlertView alloc] initWithTitle: @"Warning"
            message: @"Audio input hardware not available"
            delegate: nil
            cancelButtonTitle: @"OK"
            otherButtonTitles: nil
        ];
        [cantRecordAlert show];
        return;
    }

    // start recording
    [recorder record]; //recordForDuration:(NSTimeInterval) 40];
}

0 个答案:

没有答案