From fc15a7f4f931ee42c808ae849e99d4c80b746cba Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Tue, 31 Mar 2015 04:59:54 +0000 Subject: Re #1782 (misc): Improve layout in ipjsua sample app, so it can display both preview and incoming video together. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5041 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m index 34be6262..4c88fd2f 100644 --- a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m +++ b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m @@ -237,12 +237,18 @@ void displayWindow(pjsua_vid_win_id wid) UIView *parent = app.viewController.view; UIView *view = (__bridge UIView *)wi.hwnd.info.ios.window; - if (view && ![view isDescendantOfView:parent]) { + if (view) { dispatch_async(dispatch_get_main_queue(), ^{ /* Add the video window as subview */ - [parent addSubview:view]; + if (![view isDescendantOfView:parent]) + [parent addSubview:view]; if (!wi.is_native) { + /* Resize it to fit width */ + view.bounds = CGRectMake(0, 0, parent.bounds.size.width, + (parent.bounds.size.height * + 1.0*parent.bounds.size.width/ + view.bounds.size.width)); /* Center it horizontally */ view.center = CGPointMake(parent.bounds.size.width/2.0, view.bounds.size.height/2.0); -- cgit v1.2.3