ViewController.m
3.51 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// ViewController.m
// CNLivePlayerSDKTest
//
// Created by 雷浩杰 on 16/8/10.
// Copyright © 2016年 雷浩杰. All rights reserved.
//
#import "ViewController.h"
#import "PlayerViewController.h"
#import "BarrageViewController.h"
#import "StreamerViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"视讯云 推流和播放SDK Demo";
UIButton *playerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
playerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 100, 150, 50);
[playerBtn setTitle:@"播放" forState:UIControlStateNormal];
[playerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] 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:UIButtonTypeCustom];
streamerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 200, 150, 50);
[streamerBtn setTitle:@"推流" forState:UIControlStateNormal];
[streamerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] 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];
UIButton *barrageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
barrageBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 300, 150, 50);
[barrageBtn setTitle:@"弹幕" forState:UIControlStateNormal];
[barrageBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
[barrageBtn addTarget:self action:@selector(barrageBtnAction) forControlEvents:UIControlEventTouchUpInside];
barrageBtn.layer.cornerRadius = 10;
barrageBtn.layer.masksToBounds = YES;
barrageBtn.layer.borderColor = [UIColor blackColor].CGColor;
barrageBtn.layer.borderWidth = 1;
[self.view addSubview:barrageBtn];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight([UIScreen mainScreen].bounds)-60, CGRectGetWidth(self.view.frame), 30)];
label.text = @"北京中投视讯文化传媒股份有限公司";
[self.view addSubview:label];
label.font = [UIFont systemFontOfSize:12];
label.textAlignment = NSTextAlignmentCenter;
}
- (void)playerBtnAction
{
PlayerViewController *player = [[PlayerViewController alloc] init];
[self presentViewController:player animated:YES completion:NULL];
}
- (void)barrageBtnAction
{
BarrageViewController *player = [[BarrageViewController alloc] init];
[self presentViewController:player animated:YES completion:NULL];
}
- (void)streamerBtnAction
{
StreamerViewController *streamer = [[StreamerViewController alloc] init];
[self presentViewController:streamer animated:YES completion:NULL];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end