From a8b2df703f8c84c815f78ebfabdcf408514a1f3a Mon Sep 17 00:00:00 2001 From: ftao Date: Wed, 17 Jan 2018 19:50:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[Add]=E6=94=AF=E6=8C=81=E8=93=9D=E7=89=99?= =?UTF-8?q?=E9=9F=B3=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LFLiveKit/capture/LFAudioCapture.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LFLiveKit/capture/LFAudioCapture.m b/LFLiveKit/capture/LFAudioCapture.m index bb565fa4..7336ee16 100755 --- a/LFLiveKit/capture/LFAudioCapture.m +++ b/LFLiveKit/capture/LFAudioCapture.m @@ -87,7 +87,7 @@ - (instancetype)initWithAudioConfiguration:(LFLiveAudioConfiguration *)configura } [session setPreferredSampleRate:_configuration.audioSampleRate error:nil]; - [session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers error:nil]; + [session setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth error:nil]; [session setActive:YES withOptions:kAudioSessionSetActiveFlag_NotifyOthersOnDeactivation error:nil]; [session setActive:YES error:nil]; @@ -117,7 +117,7 @@ - (void)setRunning:(BOOL)running { dispatch_async(self.taskQueue, ^{ self.isRunning = YES; NSLog(@"MicrophoneSource: startRunning"); - [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers error:nil]; + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionInterruptSpokenAudioAndMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth error:nil]; AudioOutputUnitStart(self.componetInstance); }); } else { From f13933c76c769843182287eafb3ab439d256dbc1 Mon Sep 17 00:00:00 2001 From: ftao Date: Wed, 13 Feb 2019 11:03:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E4=BD=8E=E7=94=B5?= =?UTF-8?q?=E9=87=8F=E6=97=B6=E7=B3=BB=E7=BB=9F=E5=BC=B9=E7=AA=97=E5=90=8E?= =?UTF-8?q?=E4=BA=A7=E7=94=9F=E7=9A=84=E7=A8=8B=E5=BA=8F=E5=A4=B1=E7=84=A6?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=A7=86=E9=A2=91=E6=95=B0=E6=8D=AE=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E5=BD=95=E5=88=B6=E5=92=8C=E7=BC=96=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=95=B0=E6=8D=AE=E4=BE=9D=E7=84=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=EF=BC=8C=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=AB=AF=E5=AF=B9?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=90=88=E5=B9=B6=E4=BA=A7=E7=94=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=B7=AE=EF=BC=8C=E5=87=BA=E7=8E=B0=E9=9F=B3=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=B8=8D=E5=90=8C=E6=AD=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LFLiveKit/capture/LFVideoCapture.m | 6 +++--- LFLiveKit/coder/LFHardwareVideoEncoder.m | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LFLiveKit/capture/LFVideoCapture.m b/LFLiveKit/capture/LFVideoCapture.m index 7e42a3f5..5e9f6d55 100755 --- a/LFLiveKit/capture/LFVideoCapture.m +++ b/LFLiveKit/capture/LFVideoCapture.m @@ -47,8 +47,8 @@ - (instancetype)initWithVideoConfiguration:(LFLiveVideoConfiguration *)configura if (self = [super init]) { _configuration = configuration; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarChanged:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; self.beautyFace = YES; @@ -348,7 +348,7 @@ - (void)reloadMirror{ #pragma mark Notification -- (void)willEnterBackground:(NSNotification *)notification { +- (void)didEnterBackground:(NSNotification *)notification { [UIApplication sharedApplication].idleTimerDisabled = NO; [self.videoCamera pauseCameraCapture]; runSynchronouslyOnVideoProcessingQueue(^{ diff --git a/LFLiveKit/coder/LFHardwareVideoEncoder.m b/LFLiveKit/coder/LFHardwareVideoEncoder.m index 6c3d20fe..b0572000 100755 --- a/LFLiveKit/coder/LFHardwareVideoEncoder.m +++ b/LFLiveKit/coder/LFHardwareVideoEncoder.m @@ -32,8 +32,8 @@ - (instancetype)initWithVideoStreamConfiguration:(LFLiveVideoConfiguration *)con NSLog(@"USE LFHardwareVideoEncoder"); _configuration = configuration; [self resetCompressionSession]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterBackground:) name:UIApplicationWillResignActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationDidBecomeActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; #ifdef DEBUG enabledWriteVideoFile = NO; [self initForFilePath]; @@ -124,7 +124,7 @@ - (void)setDelegate:(id)delegate { } #pragma mark -- Notification -- (void)willEnterBackground:(NSNotification*)notification{ +- (void)didEnterBackground:(NSNotification*)notification{ _isBackGround = YES; }