mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Pause video stream when user press the 'home' button
This commit is contained in:
parent
278e821ef5
commit
ea7d048906
2 changed files with 44 additions and 2 deletions
|
|
@ -27,7 +27,7 @@
|
|||
#include "CallHistoryTableViewController.h"
|
||||
|
||||
#include "LinphoneManager.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
|
||||
@implementation linphoneAppDelegate
|
||||
|
||||
|
|
@ -37,11 +37,44 @@
|
|||
@synthesize myPhoneViewController;
|
||||
|
||||
|
||||
-(void)applicationWillResignActive:(UIApplication *)application {
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
LinphoneCall* call = linphone_core_get_current_call(lc);
|
||||
if (call == NULL)
|
||||
return;
|
||||
|
||||
/* save call context */
|
||||
LinphoneManager* instance = [LinphoneManager instance];
|
||||
instance->currentCallContextBeforeGoingBackground.call = call;
|
||||
instance->currentCallContextBeforeGoingBackground.cameraIsEnabled = linphone_call_camera_enabled(call);
|
||||
|
||||
const LinphoneCallParams* params = linphone_call_get_current_params(call);
|
||||
if (linphone_call_params_video_enabled(params)) {
|
||||
linphone_call_enable_camera(call, false);
|
||||
}
|
||||
|
||||
}
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
[[LinphoneManager instance] enterBackgroundMode];
|
||||
}
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[[LinphoneManager instance] becomeActive];
|
||||
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
LinphoneCall* call = linphone_core_get_current_call(lc);
|
||||
if (call == NULL)
|
||||
return;
|
||||
|
||||
LinphoneManager* instance = [LinphoneManager instance];
|
||||
if (call == instance->currentCallContextBeforeGoingBackground.call) {
|
||||
const LinphoneCallParams* params = linphone_call_get_current_params(call);
|
||||
if (linphone_call_params_video_enabled(params)) {
|
||||
linphone_call_enable_camera(
|
||||
call,
|
||||
instance->currentCallContextBeforeGoingBackground.cameraIsEnabled);
|
||||
}
|
||||
instance->currentCallContextBeforeGoingBackground.call = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) loadDefaultSettings {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ typedef enum _Connectivity {
|
|||
,none
|
||||
} Connectivity;
|
||||
@class FastAddressBook;
|
||||
|
||||
/* Application specific call context */
|
||||
typedef struct _CallContext {
|
||||
LinphoneCall* call;
|
||||
bool_t cameraIsEnabled;
|
||||
} CallContext;
|
||||
|
||||
@interface LinphoneManager : NSObject <AVAudioSessionDelegate> {
|
||||
@private
|
||||
SCNetworkReachabilityContext proxyReachabilityContext;
|
||||
|
|
@ -44,7 +51,9 @@ typedef enum _Connectivity {
|
|||
FastAddressBook* mFastAddressBook;
|
||||
const char* frontCamId;
|
||||
const char* backCamId;
|
||||
|
||||
|
||||
@public
|
||||
CallContext currentCallContextBeforeGoingBackground;
|
||||
}
|
||||
+(LinphoneManager*) instance;
|
||||
+(LinphoneCore*) getLc;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue