diff --git a/Classes/VideoViewController.h b/Classes/VideoViewController.h index 569d45b44..d6db828b0 100644 --- a/Classes/VideoViewController.h +++ b/Classes/VideoViewController.h @@ -20,17 +20,34 @@ #import "UILinphone.h" @interface VideoViewController : UIViewController { - UIImageView* mDisplay; + UIView* mPortrait; + UIView* mDisplay; UIView* mPreview; UIMuteButton* mMute; UIHangUpButton* mHangUp; UICamSwitch* mCamSwitch; + + UIView* mLandscape; + UIView* mDisplayLand; + UIView* mPreviewLand; + UIMuteButton* mMuteLand; + UIHangUpButton* mHangUpLand; + UICamSwitch* mCamSwitchLand; + BOOL isFirst; } -@property (nonatomic, retain) IBOutlet UIImageView* mDisplay; +@property (nonatomic, retain) IBOutlet UIView* mPortrait; +@property (nonatomic, retain) IBOutlet UIView* mDisplay; @property (nonatomic, retain) IBOutlet UIView* mPreview; @property (nonatomic, retain) IBOutlet UIMuteButton* mMute; @property (nonatomic, retain) IBOutlet UIHangUpButton* mHangUp; @property (nonatomic, retain) IBOutlet UICamSwitch* mCamSwitch; + +@property (nonatomic, retain) IBOutlet UIView* mLandscape; +@property (nonatomic, retain) IBOutlet UIView* mDisplayLand; +@property (nonatomic, retain) IBOutlet UIView* mPreviewLand; +@property (nonatomic, retain) IBOutlet UIMuteButton* mMuteLand; +@property (nonatomic, retain) IBOutlet UIHangUpButton* mHangUpLand; +@property (nonatomic, retain) IBOutlet UICamSwitch* mCamSwitchLand; @end \ No newline at end of file diff --git a/Classes/VideoViewController.m b/Classes/VideoViewController.m index e0adcd168..50bb1ecf8 100644 --- a/Classes/VideoViewController.m +++ b/Classes/VideoViewController.m @@ -22,12 +22,20 @@ #import @implementation VideoViewController +@synthesize mPortrait; @synthesize mDisplay; @synthesize mPreview; @synthesize mMute; @synthesize mHangUp; @synthesize mCamSwitch; +@synthesize mLandscape; +@synthesize mDisplayLand; +@synthesize mPreviewLand; +@synthesize mMuteLand; +@synthesize mHangUpLand; +@synthesize mCamSwitchLand; + - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -56,9 +64,29 @@ { [super viewDidLoad]; [mMute initWithOnImage:[UIImage imageNamed:@"mic_muted.png"] offImage:[UIImage imageNamed:@"mic_active.png"] ]; + [mMuteLand initWithOnImage:[UIImage imageNamed:@"mic_muted.png"] offImage:[UIImage imageNamed:@"mic_active.png"] ]; [mCamSwitch setPreview:mPreview]; + [mCamSwitchLand setPreview:mPreviewLand]; + isFirst=TRUE; } + +-(void) configureOrientation:(UIInterfaceOrientation) oritentation { + + if (oritentation == UIInterfaceOrientationPortrait ) { + [self.view addSubview:mPortrait]; + linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)mDisplay); + linphone_core_set_native_preview_window_id([LinphoneManager getLc],(unsigned long)mPreview); + linphone_core_set_device_rotation([LinphoneManager getLc], 0); + + } else if (oritentation == UIInterfaceOrientationLandscapeRight ) { + [self.view addSubview:mLandscape]; + linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)mDisplayLand); + linphone_core_set_native_preview_window_id([LinphoneManager getLc],(unsigned long)mPreviewLand); + linphone_core_set_device_rotation([LinphoneManager getLc], 270); + } + +} - (void)viewDidUnload { [super viewDidUnload]; @@ -72,8 +100,6 @@ -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)mDisplay); - linphone_core_set_native_preview_window_id([LinphoneManager getLc],(unsigned long)mPreview); //redirect audio to speaker UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; @@ -82,10 +108,19 @@ , &audioRouteOverride); } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations - return (interfaceOrientation == UIInterfaceOrientationPortrait); + return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeRight ; } +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [self configureOrientation:self.interfaceOrientation]; + if (fromInterfaceOrientation !=self.interfaceOrientation) { + linphone_core_update_call([LinphoneManager getLc], linphone_core_get_current_call([LinphoneManager getLc]), NULL); + } +} +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + [mLandscape removeFromSuperview]; + [mPortrait removeFromSuperview]; +} @end diff --git a/Classes/VideoViewController.xib b/Classes/VideoViewController.xib index 299cc07b7..e6af95120 100644 --- a/Classes/VideoViewController.xib +++ b/Classes/VideoViewController.xib @@ -38,6 +38,17 @@ IBFirstResponder IBCocoaTouchFramework + + + 292 + {320, 460} + + + 1 + MCAwIDAAA + + IBCocoaTouchFramework + 274 @@ -48,7 +59,6 @@ 274 {320, 420} - 1 NO @@ -59,7 +69,6 @@ 292 {{1, 418}, {108, 62}} - NO IBCocoaTouchFramework @@ -92,7 +101,6 @@ 292 {{106, 418}, {106, 63}} - NO IBCocoaTouchFramework @@ -105,7 +113,7 @@ MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - + NSImage stopcall-red.png @@ -116,8 +124,6 @@ 292 {{211, 418}, {108, 62}} - - NO IBCocoaTouchFramework 0 @@ -138,12 +144,11 @@ 292 {{216, 263}, {96, 128}} - 3 MQA - + 2 @@ -152,7 +157,6 @@ {320, 480} - 3 @@ -160,18 +164,121 @@ IBCocoaTouchFramework + + + 292 + + YES + + + 274 + {420, 320} + + + + 3 + MQA + + + IBCocoaTouchFramework + + + + 292 + {{420, 0}, {60, 108}} + + + NO + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + NSImage + mic_active.png + + + NSImage + clavier-01-106px.png + + + + + 292 + {{420, 107}, {60, 106}} + + + NO + IBCocoaTouchFramework + 0 + 0 + + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + + 292 + {{420, 212}, {60, 108}} + + NO + IBCocoaTouchFramework + 0 + 0 + + Switch + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + 274 + {{264, 210}, {142, 96}} + + + + 3 + MQA + + + IBCocoaTouchFramework + + + {480, 320} + + + + 3 + MQA + + + + 3 + 3 + + IBCocoaTouchFramework + YES - - - view - - - - 3 - mDisplay @@ -204,6 +311,78 @@ 13 + + + mPortrait + + + + 21 + + + + mLandscape + + + + 22 + + + + mDisplayLand + + + + 23 + + + + mPreviewLand + + + + 24 + + + + mHangUp + + + + 26 + + + + mMuteLand + + + + 27 + + + + mHangUpLand + + + + 28 + + + + mCamSwitchLand + + + + 29 + + + + view + + + + 32 + @@ -214,20 +393,6 @@ - - 1 - - - YES - - - - - - - - View - -1 @@ -239,12 +404,41 @@ + + 31 + + + YES + + + root + + + 1 + + + YES + + + + + + + + portrait + 5 display + + 9 + + + preview + 6 @@ -254,6 +448,7 @@ 7 + Hang Up Button 8 @@ -261,11 +456,52 @@ - 9 - - + 14 + + + YES + + + + + + + + landscape + + + 19 + + + Cam Switch + + + 18 + + + HangHup + + + 17 + + + Mute + + + 16 + + + YES + + preview + + 15 + + + display + @@ -276,6 +512,16 @@ -2.CustomClassName 1.IBEditorWindowLastContentRect 1.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.CustomClassName + 17.IBPluginDependency + 18.CustomClassName + 18.IBPluginDependency + 19.CustomClassName + 19.IBPluginDependency + 31.IBPluginDependency 5.IBPluginDependency 6.CustomClassName 6.IBPluginDependency @@ -292,6 +538,16 @@ {{556, 412}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIMuteButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIHangUpButton + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UICamSwitch + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIMuteButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIHangUpButton @@ -313,117 +569,9 @@ - 13 - - - - YES - - UICamSwitch - UIButton - - preview - UIView - - - preview - - preview - UIView - - - - IBProjectSource - ./Classes/UICamSwitch.h - - - - UIHangUpButton - UIButton - - IBProjectSource - ./Classes/UIHangUpButton.h - - - - UIMuteButton - UIToggleButton - - IBProjectSource - ./Classes/UIMuteButton.h - - - - UIToggleButton - UIButton - - IBProjectSource - ./Classes/UIToggleButton.h - - - - VideoViewController - UIViewController - - YES - - YES - mCamSwitch - mDisplay - mHangUp - mMute - mPreview - - - YES - UICamSwitch - UIImageView - UIHangUpButton - UIMuteButton - UIView - - - - YES - - YES - mCamSwitch - mDisplay - mHangUp - mMute - mPreview - - - YES - - mCamSwitch - UICamSwitch - - - mDisplay - UIImageView - - - mHangUp - UIHangUpButton - - - mMute - UIMuteButton - - - mPreview - UIView - - - - - IBProjectSource - ./Classes/VideoViewController.h - - - + 33 + 0 IBCocoaTouchFramework @@ -436,12 +584,16 @@ YES YES + clavier-01-106px.png clavier-01-108px.png + mic_active.png stopcall-red.png YES + {106, 60} {108, 60} + {32, 32} {62, 54} diff --git a/submodules/linphone b/submodules/linphone index 406c3a101..c51752fe7 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 406c3a1019964463a0565488f7bf746fc8bab360 +Subproject commit c51752fe70f7dd4e892ba87d00284095edda33e2