Skip to content

Commit

Permalink
'dev'->'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
peetonn committed Apr 8, 2015
2 parents 2fea415 + 63fe928 commit ce29e63
Show file tree
Hide file tree
Showing 13 changed files with 294 additions and 150 deletions.
4 changes: 2 additions & 2 deletions NdnCon copy-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4.2</string>
<string>0.4.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>9</string>
<string>10</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.video</string>
<key>LSMinimumSystemVersion</key>
Expand Down
9 changes: 5 additions & 4 deletions ndncon/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1514" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6751"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand Down Expand Up @@ -692,13 +692,14 @@ CA
<constraints>
<constraint firstAttribute="width" constant="19" id="BOR-PJ-yag"/>
</constraints>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="4I3-sM-a8x" id="GBR-xv-noY">
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="xaN-Sz-hCC" id="GBR-xv-noY">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="Pn4-fl-kYF">
<items>
<menuItem state="on" hidden="YES" id="HFE-mt-D1d"/>
<menuItem title="Configure publishing..." id="4I3-sM-a8x"/>
<menuItem title="audio only" id="4I3-sM-a8x" userLabel="audio only"/>
<menuItem title="video only" id="xaN-Sz-hCC" userLabel="video only"/>
</items>
</menu>
</popUpButtonCell>
Expand Down
14 changes: 7 additions & 7 deletions ndncon/NCChatLibraryController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ -(void)leaveChat:(NSString *)chatId

-(void)initChatRooms
{
NSLog(@"intializing chatrooms...");

self.initialized = YES;
[[User allUsersFromContext:self.context]
enumerateObjectsUsingBlock:^(User* user, NSUInteger idx, BOOL *stop) {
[self startChatWithUser:user.userPrefix];
}];
// NSLog(@"intializing chatrooms...");
//
// self.initialized = YES;
// [[User allUsersFromContext:self.context]
// enumerateObjectsUsingBlock:^(User* user, NSUInteger idx, BOOL *stop) {
// [self startChatWithUser:user.userPrefix];
// }];
}

-(void)leaveAllChatRooms
Expand Down
37 changes: 30 additions & 7 deletions ndncon/NCConversationView.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1514" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6751"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NCConversationViewController">
Expand Down Expand Up @@ -124,22 +124,45 @@
<customView horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="rhs-Lr-yBq">
<rect key="frame" x="0.0" y="0.0" width="182" height="119"/>
<subviews>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gBa-GO-xzj">
<rect key="frame" x="21" y="42" width="140" height="32"/>
<buttonCell key="cell" type="push" title="Start publishing" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="BhB-pr-SHm">
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="gBa-GO-xzj">
<rect key="frame" x="61" y="46.5" width="60" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Publish" bezelStyle="texturedRounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="BhB-pr-SHm">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="startPublishing:" target="-2" id="CEA-TW-Tjo"/>
</connections>
</button>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="iJX-kW-nI0">
<rect key="frame" x="123" y="46.5" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="uNP-Yr-Da6"/>
</constraints>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="53U-dN-Axo">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="Jke-7B-Ybj">
<items>
<menuItem state="on" hidden="YES" id="0vs-ze-YkL"/>
<menuItem title="audio only" id="rFE-Zk-m5o" userLabel="audio only"/>
<menuItem title="video only" id="EdL-wK-pnR" userLabel="video only"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="startPublishingCustom:" target="-2" id="bqj-92-Cjc"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="centerX" secondItem="gBa-GO-xzj" secondAttribute="centerX" id="4t0-T9-uVx"/>
<constraint firstAttribute="centerX" secondItem="gBa-GO-xzj" secondAttribute="centerX" id="EpG-FG-y8O"/>
<constraint firstAttribute="height" constant="119" id="OIg-q1-SbS"/>
<constraint firstAttribute="width" constant="182" id="VDc-kW-6mi"/>
<constraint firstAttribute="centerY" secondItem="gBa-GO-xzj" secondAttribute="centerY" id="zmK-SD-JLY"/>
<constraint firstAttribute="centerY" secondItem="gBa-GO-xzj" secondAttribute="centerY" id="WZ4-Si-DA8"/>
<constraint firstItem="iJX-kW-nI0" firstAttribute="height" secondItem="gBa-GO-xzj" secondAttribute="height" id="Zst-WX-PKE"/>
<constraint firstItem="iJX-kW-nI0" firstAttribute="centerY" secondItem="gBa-GO-xzj" secondAttribute="centerY" id="bnA-YU-a8n"/>
<constraint firstItem="iJX-kW-nI0" firstAttribute="leading" secondItem="gBa-GO-xzj" secondAttribute="trailing" constant="2" id="q97-Md-TIs"/>
</constraints>
<point key="canvasLocation" x="177" y="-219"/>
</customView>
Expand Down
105 changes: 63 additions & 42 deletions ndncon/NCConversationViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
using namespace ndnrtc;
using namespace ndnrtc::new_api;

#define PUBLISH_CUSTOM_AUDIO_ONLY_IDX 1
#define PUBLISH_CUSTOM_VIDEO_ONLY_IDX 2

NSString* const kCameraCapturerKey = @"cameraCapturer";
NSString* const kRendererKey = @"videoRenderer";
NSString* const kNCLocalStreamsDictionaryKey = @"localStreamsDictionary";
Expand Down Expand Up @@ -178,6 +181,66 @@ @interface NCConversationViewController ()

@implementation NCConversationViewController

- (IBAction)startPublishing:(id)sender
{
[self.localStreamsScrollView addStackView:self.localStreamViewer.stackView
withOrientation:NSUserInterfaceLayoutOrientationHorizontal];
[self startPublishingWithConfiguration:[NCPreferencesController sharedInstance].producerConfigurationCopy];
[self stopComputerSleep];
}

- (IBAction)startPublishingCustom:(id)sender
{
[self.localStreamsScrollView addStackView:self.localStreamViewer.stackView
withOrientation:NSUserInterfaceLayoutOrientationHorizontal];

if ([[sender itemArray] indexOfObject:[sender selectedItem]] == PUBLISH_CUSTOM_AUDIO_ONLY_IDX)
{
[self startPublishingWithConfiguration: @{kAudioStreamsKey:[NCPreferencesController sharedInstance].audioStreams}];
}

if ([[sender itemArray] indexOfObject:[sender selectedItem]] == PUBLISH_CUSTOM_VIDEO_ONLY_IDX)
{
[self startPublishingWithConfiguration: @{kVideoStreamsKey:[NCPreferencesController sharedInstance].videoStreams}];
}

[self stopComputerSleep];
}

- (IBAction)endConversation:(id)sender
{
[self.remoteStreamViewer closeAllStreams];
[self.localStreamViewer closeAllStreams];

self.participants = @[];

[self stopWatchingParticipants];
self.conference = nil;

if (self.statisticsController)
{
[self.statisticsController stopStatUpdate];
self.statisticsController = nil;
}

[self checkConversationDidEnd];
}

- (IBAction)showStatistics:(id)sender
{
if ([self.statisticsController.window isVisible])
[self.statisticsController close];
else
{
if (!self.statisticsController)
{
self.statisticsController = [[NCStatisticsWindowController alloc] init];
self.statisticsController.delegate = self;
}
[self.statisticsController showWindow:nil];
}
}

-(id)init
{
self = [self initWithNibName:@"NCConversationView" bundle:nil];
Expand Down Expand Up @@ -253,48 +316,6 @@ -(void)awakeFromNib
self.remoteStreamViewer.backgroundColor = self.remoteStreamsScrollView.backgroundColor;
}

- (IBAction)startPublishing:(id)sender
{
[self.localStreamsScrollView addStackView:self.localStreamViewer.stackView
withOrientation:NSUserInterfaceLayoutOrientationHorizontal];
[self startPublishingWithConfiguration:[NCPreferencesController sharedInstance].producerConfigurationCopy];
[self stopComputerSleep];
}

- (IBAction)endConversation:(id)sender
{
[self.remoteStreamViewer closeAllStreams];
[self.localStreamViewer closeAllStreams];

self.participants = @[];

[self stopWatchingParticipants];
self.conference = nil;

if (self.statisticsController)
{
[self.statisticsController stopStatUpdate];
self.statisticsController = nil;
}

[self checkConversationDidEnd];
}

- (IBAction)showStatistics:(id)sender
{
if ([self.statisticsController.window isVisible])
[self.statisticsController close];
else
{
if (!self.statisticsController)
{
self.statisticsController = [[NCStatisticsWindowController alloc] init];
self.statisticsController.delegate = self;
}
[self.statisticsController showWindow:nil];
}
}

-(void)startPublishingWithConfiguration:(NSDictionary *)streamsConfiguration
{
for (NSDictionary *audioConfiguration in [streamsConfiguration valueForKey:kAudioStreamsKey])
Expand Down
98 changes: 63 additions & 35 deletions ndncon/NCMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#define STATUS_POPUP_PASSIVE_IDX 1
#define STATUS_POPUP_ONLINE_IDX 2

#define PUBLISH_CUSTOM_AUDIO_ONLY_IDX 1
#define PUBLISH_CUSTOM_VIDEO_ONLY_IDX 2

@interface NCMainViewController ()

@property (nonatomic, strong) NSDictionary *conversationConfiguration;
Expand All @@ -44,6 +47,59 @@ @interface NCMainViewController ()

@implementation NCMainViewController

- (IBAction)changeStatus:(id)sender
{
if ([self.statusPopUpButton.itemArray indexOfObject:self.statusPopUpButton.selectedItem] == STATUS_POPUP_OFFLINE_IDX &&
[NCNdnRtcLibraryController sharedInstance].sessionStatus != SessionStatusOffline)
{
if (self.conversationViewController.participants.count > 0)
[self.conversationViewController endConversation:self];

[[NCNdnRtcLibraryController sharedInstance] stopSession];
}

if ([self.statusPopUpButton.itemArray indexOfObject:self.statusPopUpButton.selectedItem] == STATUS_POPUP_PASSIVE_IDX &&
[NCNdnRtcLibraryController sharedInstance].sessionStatus != SessionStatusOnlineNotPublishing)
{
if ([NCNdnRtcLibraryController sharedInstance].sessionStatus == SessionStatusOffline)
[[NCNdnRtcLibraryController sharedInstance] startSession];
else
{
[self.conversationViewController endConversation:self];
}
}
}

- (IBAction)startPublishing:(id)sender
{
[self startConverstaionIfNotStarted];
[self.conversationViewController startPublishingWithConfiguration:self.conversationConfiguration];
[self loadCurrentView:self.conversationViewController.view];
}

- (IBAction)startPublishingCustom:(id)sender
{
if (!self.conversationViewController)
{

if ([[sender itemArray] indexOfObject:[sender selectedItem]] == PUBLISH_CUSTOM_AUDIO_ONLY_IDX)
{
self.conversationConfiguration = @{kAudioStreamsKey:[NCPreferencesController sharedInstance].audioStreams};
}

if ([[sender itemArray] indexOfObject:[sender selectedItem]] == PUBLISH_CUSTOM_VIDEO_ONLY_IDX)
{
self.conversationConfiguration = @{kVideoStreamsKey:[NCPreferencesController sharedInstance].videoStreams};
}

self.conversationViewController = [[NCConversationViewController alloc] init];
self.conversationViewController.delegate = self;

[self.conversationViewController startPublishingWithConfiguration:self.conversationConfiguration];
[self loadCurrentView:self.conversationViewController.view];
}
}

-(id)init
{
self = [super init];
Expand Down Expand Up @@ -96,40 +152,6 @@ -(void)awakeFromNib
[self.conversationInfoView registerForDraggedTypes: @[NSStringPboardType]];
}

- (IBAction)changeStatus:(id)sender
{
if ([self.statusPopUpButton.itemArray indexOfObject:self.statusPopUpButton.selectedItem] == STATUS_POPUP_OFFLINE_IDX &&
[NCNdnRtcLibraryController sharedInstance].sessionStatus != SessionStatusOffline)
{
if (self.conversationViewController.participants.count > 0)
[self.conversationViewController endConversation:self];

[[NCNdnRtcLibraryController sharedInstance] stopSession];
}

if ([self.statusPopUpButton.itemArray indexOfObject:self.statusPopUpButton.selectedItem] == STATUS_POPUP_PASSIVE_IDX &&
[NCNdnRtcLibraryController sharedInstance].sessionStatus != SessionStatusOnlineNotPublishing)
{
if ([NCNdnRtcLibraryController sharedInstance].sessionStatus == SessionStatusOffline)
[[NCNdnRtcLibraryController sharedInstance] startSession];
else
{
[self.conversationViewController endConversation:self];
}
}
}

- (IBAction)startPublishing:(id)sender
{
[self startConverstaionIfNotStarted];
[self.conversationViewController startPublishingWithConfiguration:self.conversationConfiguration];
[self loadCurrentView:self.conversationViewController.view];
}

- (IBAction)startPublishingCustom:(id)sender {
NSLog(@"customize...");
}

#pragma mark - NCConferenceListViewControllerDelegate
-(void)conferenceListController:(NCConferenceListViewController *)conferenceListController
didAddConference:(Conference *)conference
Expand Down Expand Up @@ -299,6 +321,12 @@ -(void)userViewControllerFetchStreamsClicked:(NCUserViewController *)userVc
[self startFetchingFromUser:userVc.userInfo];
}

-(void)userViewController:(NCUserViewController *)userVc
fetchStreamsWithCustomInfo:(NSDictionary *)customUSerInfo
{
[self startFetchingFromUser:customUSerInfo];
}

-(void)onAppWillTerminate:(NSNotification*)notification
{
if (self.conversationViewController.participants.count > 0)
Expand Down Expand Up @@ -472,7 +500,7 @@ +(Class)transformedValueClass
-(id)transformedValue:(id)value
{
if (!value || ![value isKindOfClass:[NSArray class]] || [value count] == 0)
return @"no one";
return @"no one, click to start publishing";

__block NSString *outputString = @"";
NSArray *participants = [value valueForKeyPath:kSessionUsernameKey];
Expand Down
Loading

0 comments on commit ce29e63

Please sign in to comment.