Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AppRTC/ARTCVideoChatViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <libjingle_peerconnection/RTCEAGLVideoView.h>
#import <AppRTC/ARDAppClient.h>

@interface ARTCVideoChatViewController : UIViewController <ARDAppClientDelegate, RTCEAGLVideoViewDelegate>
@interface ARTCVideoChatViewController : UIViewController <ARDAppClientDelegate, RTCEAGLVideoViewDelegate, RTCMessageReceiver>

//Views, Labels, and Buttons
@property (strong, nonatomic) IBOutlet RTCEAGLVideoView *remoteView;
Expand Down
6 changes: 5 additions & 1 deletion AppRTC/ARTCVideoChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ - (void)viewWillAppear:(BOOL)animated {
[self disconnect];
self.client = [[ARDAppClient alloc] initWithDelegate:self];
[self.client setServerHostUrl:SERVER_HOST_URL];
[self.client connectToRoomWithId:self.roomName options:nil];
[self.client connectToRoomWithId:self.roomName options:nil messageReceiver:self];

[self.urlLabel setText:self.roomUrl];
}

- (void)didReceiveMessage:(NSString *)tag data:(NSDictionary<NSString *,NSObject *> *)data {
NSLog([NSString stringWithFormat:@"INCOMING MESSGAE WITH tag: %@/ AND data: %@/", tag, data]);
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil];
Expand Down
31 changes: 21 additions & 10 deletions Lib/ARDAppClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,33 @@

#import "RTCVideoTrack.h"

@protocol RTCMessageReceiver <NSObject>

- (void)didReceiveMessage:(NSString *)tag
data:(NSDictionary<NSString *, NSObject *> *)data;

@end

typedef NS_ENUM(NSInteger, ARDAppClientState) {
// Disconnected from servers.
kARDAppClientStateDisconnected,
// Connecting to servers.
kARDAppClientStateConnecting,
// Connected to servers.
kARDAppClientStateConnected,
// Disconnected from servers.
kARDAppClientStateDisconnected,
// Connecting to servers.
kARDAppClientStateConnecting,
// Connected to servers.
kARDAppClientStateConnected,
};

@class ARDAppClient;
@protocol ARDAppClientDelegate <NSObject>

- (void)appClient:(ARDAppClient *)client
didChangeState:(ARDAppClientState)state;
didChangeState:(ARDAppClientState)state;

- (void)appClient:(ARDAppClient *)client
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack;
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack;

- (void)appClient:(ARDAppClient *)client
didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack;
didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack;

- (void)appClient:(ARDAppClient *)client
didError:(NSError *)error;
Expand All @@ -69,7 +76,11 @@ typedef NS_ENUM(NSInteger, ARDAppClientState) {
// for call configurations such as overriding server choice, specifying codecs
// and so on.
- (void)connectToRoomWithId:(NSString *)roomId
options:(NSDictionary *)options;
options:(NSDictionary *)options
messageReceiver:(id<RTCMessageReceiver>)messageReceiver;

- (void)sendData:(NSString *)tag
data:(NSDictionary *)data;

// Mute and unmute Audio-In
- (void)muteAudioIn;
Expand Down
Loading