ViewController.m 2.35 KB
//
//  ViewController.m
//  QNLiveStreamingDemo
//
//  Created by iOS on 16/12/29.
//  Copyright © 2016年 zhulin. All rights reserved.
//

#import "ViewController.h"
#import "CNLiveStreamingViewController.h"
#import "CNLiveMainPlayerViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIButton *playerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    playerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 200, 150, 40);
    [playerBtn setTitle:@"播放demo" forState:UIControlStateNormal];
    [playerBtn addTarget:self action:@selector(playerBtnAction) forControlEvents:UIControlEventTouchUpInside];
    playerBtn.layer.cornerRadius = 10;
    playerBtn.layer.masksToBounds = YES;
    playerBtn.layer.borderColor = [UIColor blackColor].CGColor;
    playerBtn.layer.borderWidth = 1;
    [self.view addSubview:playerBtn];
    
    UIButton *streamerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    streamerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 300, 150, 40);
    [streamerBtn setTitle:@"推流demo" forState:UIControlStateNormal];
    [streamerBtn addTarget:self action:@selector(streamerBtnAction) forControlEvents:UIControlEventTouchUpInside];
    streamerBtn.layer.cornerRadius = 10;
    streamerBtn.layer.masksToBounds = YES;
    streamerBtn.layer.borderColor = [UIColor blackColor].CGColor;
    streamerBtn.layer.borderWidth = 1;
    [self.view addSubview:streamerBtn];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight([UIScreen mainScreen].bounds)-60, CGRectGetWidth(self.view.frame), 30)];
    label.text = @"北京中投视讯文化传媒股份有限公司";
    label.font = [UIFont systemFontOfSize:12];
    label.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:label];
    
}

- (void)streamerBtnAction
{
    CNLiveStreamingViewController *streamVC = [[CNLiveStreamingViewController alloc] init];
    [self presentViewController:streamVC animated:YES completion:NULL];
}

- (void)playerBtnAction
{
    CNLiveMainPlayerViewController *playVC = [[CNLiveMainPlayerViewController alloc] init];
    [self presentViewController:playVC animated:YES completion:NULL];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end