ViewController.m
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// 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