Skip to content

Instantly share code, notes, and snippets.

@jeanlescure
Last active October 12, 2015 09:23
Show Gist options
  • Save jeanlescure/2cdee9732036ea34b6a4 to your computer and use it in GitHub Desktop.
Save jeanlescure/2cdee9732036ea34b6a4 to your computer and use it in GitHub Desktop.
@interface ViewController ()
<OTSessionDelegate, OTSubscriberKitDelegate, OTPublisherDelegate>
@end
//
// ViewController.m
// OpentokRTC
// ...
#import <OpenTok/OpenTok.h>
// ...
@interface ViewController ()
<OTSessionDelegate, OTSubscriberKitDelegate, OTPublisherDelegate>
@end
@implementation ViewController {
OTSession* _session;
OTPublisher* _publisher;
OTSubscriber* _subscriber;
id<OTVideoCapture> _cameraCapture;
// ...
- (void)sessionDidConnect:(OTSession*)session
{
NSLog(@"sessionDidConnect (%@)", session.sessionId);
//Change the text of the status label
StatusLabel.text = [self getSessionStatus];
//Change the status label color
[self changeStatusLabelColor];
// Step 2: We have successfully connected, now instantiate a publisher and
// begin pushing A/V streams into OpenTok.
[self doPublish];
}
- (void)sessionDidDisconnect:(OTSession*)session
{
NSString* alertMessage =
[NSString stringWithFormat:@"Session disconnected: (%@)",
session.sessionId];
NSLog(@"sessionDidDisconnect (%@)", alertMessage);
//TalkingWithLabel.text = @"";
//Change the text of the status label
StatusLabel.text = [self getSessionStatus];
//Change the status label color
[self changeStatusLabelColor];
//Clean all the subscribers
[self cleanupSubscriber];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment