Commit e46f2f474fa471ae34a23f48aa0ff9591df104bc

Authored by 雷浩杰
1 parent 2310ca84

no message

CNLivePlayerSDKTest/CNLivePlayerSDKTest/Assets.xcassets/AppIcon.appiconset/Contents.json
... ... @@ -2,6 +2,16 @@
2 2 "images" : [
3 3 {
4 4 "idiom" : "iphone",
  5 + "size" : "20x20",
  6 + "scale" : "2x"
  7 + },
  8 + {
  9 + "idiom" : "iphone",
  10 + "size" : "20x20",
  11 + "scale" : "3x"
  12 + },
  13 + {
  14 + "idiom" : "iphone",
5 15 "size" : "29x29",
6 16 "scale" : "2x"
7 17 },
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Barrage/BarrageViewController.m
... ... @@ -29,6 +29,7 @@
29 29 [_barrage setAnimationDuration:4];
30 30 [_barrage setHorizontalSpace:10];
31 31 [_barrage setVerticalSpace:5];
  32 +
32 33 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 20)];
33 34 label.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5];
34 35 label.font = [UIFont systemFontOfSize:13];
... ... @@ -40,49 +41,51 @@
40 41 [_barrage setBarrageLabelStyle:label];
41 42 [self.view addSubview:_barrage];
42 43  
43   - UIButton *startbutton = [UIButton buttonWithType:UIButtonTypeSystem];
44   - [startbutton setTitle:@"开始" forState:UIControlStateNormal];
45   - startbutton.frame = CGRectMake(0, 20, 50, 50);
46   - [self.view addSubview:startbutton];
47   - [startbutton addTarget:self action:@selector(startbutton) forControlEvents:UIControlEventTouchUpInside];
48   -
49   - UIButton *stopbutton = [UIButton buttonWithType:UIButtonTypeSystem];
50   - [stopbutton setTitle:@"停止" forState:UIControlStateNormal];
51   - stopbutton.frame = CGRectMake(100, 20, 50, 50);
52   - [self.view addSubview:stopbutton];
53   - [stopbutton addTarget:self action:@selector(stopbutton) forControlEvents:UIControlEventTouchUpInside];
54   -
55   - UIButton *exitbutton = [UIButton buttonWithType:UIButtonTypeSystem];
56   - [exitbutton setTitle:@"退出" forState:UIControlStateNormal];
57   - exitbutton.frame = CGRectMake(200, 20, 50, 50);
58   - [self.view addSubview:exitbutton];
59   - [exitbutton addTarget:self action:@selector(exitbutton) forControlEvents:UIControlEventTouchUpInside];
  44 + NSArray *buttonTitles = @[@"开始", @"停止", @"退出"];
  45 + for (int i = 0; i < 3; i++) {
  46 + NSString *title = buttonTitles[i];
  47 +
  48 + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  49 + button.tag = 100+i;
  50 + button.frame = CGRectMake((CGRectGetWidth(self.view.frame)-240)/4*(i+1)+80*i, 30, 80, 30);
  51 + [button setTitle:title forState:UIControlStateNormal];
  52 + [button setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
  53 + [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
  54 + button.layer.cornerRadius = 10;
  55 + button.layer.masksToBounds = YES;
  56 + button.layer.borderColor = [UIColor blackColor].CGColor;
  57 + button.layer.borderWidth = 1;
  58 + [self.view addSubview:button];
  59 + }
60 60  
61   - UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 80, 300, 30)];
62   - textField.backgroundColor = [UIColor grayColor];
  61 + UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake((self.view.frame.size.width-300)/2, 80, 300, 30)];
63 62 [self.view addSubview:textField];
64 63 textField.delegate = self;
  64 + textField.borderStyle = UITextBorderStyleRoundedRect;
  65 + textField.returnKeyType = UIReturnKeyDone;
  66 + textField.clearButtonMode = UITextFieldViewModeAlways;
65 67  
66 68 }
67 69  
68   -- (void)startbutton
69   -{
70   - [_barrage startAnimation];
71   -}
72   -
73   -- (void)stopbutton
74   -{
75   - [_barrage stopAnimation];
76   -}
77   -
78   -- (void)exitbutton
  70 +- (void)buttonAction:(UIButton *)button
79 71 {
80   - [_barrage stopAnimation];
81   - [self dismissViewControllerAnimated:YES completion:NULL];
  72 + switch (button.tag) {
  73 + case 100:
  74 + [_barrage startAnimation];
  75 + break;
  76 + case 101:
  77 + [_barrage stopAnimation];
  78 + break;
  79 + case 102:
  80 + [_barrage stopAnimation];
  81 + [self dismissViewControllerAnimated:YES completion:NULL];
  82 + break;
  83 + }
82 84 }
83 85  
84 86 - (BOOL)textFieldShouldReturn:(UITextField *)textField
85 87 {
  88 + [textField resignFirstResponder];
86 89 [_barrage showBarrageContent:textField.text];
87 90 return YES;
88 91 }
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Base.lproj/Main.storyboard
1   -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2   -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="EpT-wO-Zba">
3 3 <dependencies>
4   - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
  4 + <deployment identifier="iOS"/>
  5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
  6 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
5 7 </dependencies>
6 8 <scenes>
7 9 <!--View Controller-->
8 10 <scene sceneID="tne-QT-ifu">
9 11 <objects>
10   - <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
  12 + <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
11 13 <layoutGuides>
12 14 <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
13 15 <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
14 16 </layoutGuides>
15 17 <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
16   - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
  18 + <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
17 19 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18   - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
  20 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
19 21 </view>
  22 + <navigationItem key="navigationItem" id="MFb-0Q-P6h"/>
20 23 </viewController>
21 24 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
22 25 </objects>
  26 + <point key="canvasLocation" x="1026.0869565217392" y="122.28260869565219"/>
  27 + </scene>
  28 + <!--Navigation Controller-->
  29 + <scene sceneID="U7f-Cl-XXM">
  30 + <objects>
  31 + <navigationController automaticallyAdjustsScrollViewInsets="NO" id="EpT-wO-Zba" sceneMemberID="viewController">
  32 + <toolbarItems/>
  33 + <navigationBar key="navigationBar" contentMode="scaleToFill" id="xvY-jj-T48">
  34 + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
  35 + <autoresizingMask key="autoresizingMask"/>
  36 + </navigationBar>
  37 + <nil name="viewControllers"/>
  38 + <connections>
  39 + <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="LQa-6s-xqx"/>
  40 + </connections>
  41 + </navigationController>
  42 + <placeholder placeholderIdentifier="IBFirstResponder" id="tnU-YZ-5Ay" userLabel="First Responder" sceneMemberID="firstResponder"/>
  43 + </objects>
  44 + <point key="canvasLocation" x="134.78260869565219" y="771.19565217391312"/>
23 45 </scene>
24 46 </scenes>
25 47 </document>
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Player/CNLiveViewController.m
... ... @@ -38,10 +38,13 @@
38 38 //获取SDK版本号
39 39 NSLog(@">>>>>>>>>>>>%@", [CNLiveMoviePlayerController getVersion]);
40 40  
  41 + //测试vId
  42 + //a9c5f9a2d6114bf98f2aff89a55d4f98
  43 + //0e12b70817c440509d88f67d4e975fe0
41 44 //点播播放
42 45 _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithAppId:@"60_irg1rhs308"
43 46 appKey:@"4e7a37b27a717a9e9b0a7aea4620ee55ea61fbf923bf46"
44   - vId:@"aaa123"
  47 + vId:@"0e12b70817c440509d88f67d4e975fe0"
45 48 authSuccess:^{
46 49  
47 50 _player.shouldUseHWCodec = YES;
... ... @@ -103,10 +106,15 @@
103 106 [_durationLabel setText:[NSString stringWithFormat:@"00:00:00"]];
104 107 [self.view addSubview:_durationLabel];
105 108  
106   - UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
107   - exitBtn.frame = CGRectMake(0, 350, self.view.frame.size.width, 50);
  109 + UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  110 + exitBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-80)/2, 400, 80, 30);
108 111 [exitBtn setTitle:@"退出" forState:UIControlStateNormal];
  112 + [exitBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
109 113 [exitBtn addTarget:self action:@selector(exitBtnAction) forControlEvents:UIControlEventTouchUpInside];
  114 + exitBtn.layer.cornerRadius = 5;
  115 + exitBtn.layer.masksToBounds = YES;
  116 + exitBtn.layer.borderColor = [UIColor blackColor].CGColor;
  117 + exitBtn.layer.borderWidth = 1;
110 118 [self.view addSubview:exitBtn];
111 119 }
112 120  
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Player/NormalViewController.h
... ... @@ -10,4 +10,6 @@
10 10  
11 11 @interface NormalViewController : UIViewController
12 12  
  13 +@property (nonatomic, strong)NSString *videoUrlString;
  14 +
13 15 @end
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Player/NormalViewController.m
... ... @@ -32,7 +32,7 @@
32 32  
33 33 [self installMovieNotificationObservers];
34 34  
35   - _player = [[CNLiveMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo00.cnlive.com/video/data1/2016/0808/140935/800/e3554e4c5de34a8d9a03c534849cd2e4_140935_800.m3u8"]];
  35 + _player = [[CNLiveMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:_videoUrlString]];
36 36 _player.shouldUseHWCodec = YES;
37 37 _player.view.frame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.width*9/16);
38 38 _player.shouldAutoplay = YES;
... ... @@ -72,10 +72,15 @@
72 72 [_durationLabel setText:[NSString stringWithFormat:@"00:00:00"]];
73 73 [self.view addSubview:_durationLabel];
74 74  
75   - UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
76   - exitBtn.frame = CGRectMake(0, 350, self.view.frame.size.width, 50);
  75 + UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  76 + exitBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-80)/2, 400, 80, 30);
77 77 [exitBtn setTitle:@"退出" forState:UIControlStateNormal];
  78 + [exitBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
78 79 [exitBtn addTarget:self action:@selector(exitBtnAction) forControlEvents:UIControlEventTouchUpInside];
  80 + exitBtn.layer.cornerRadius = 5;
  81 + exitBtn.layer.masksToBounds = YES;
  82 + exitBtn.layer.borderColor = [UIColor blackColor].CGColor;
  83 + exitBtn.layer.borderWidth = 1;
79 84 [self.view addSubview:exitBtn];
80 85 }
81 86  
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Player/PlayerViewController.m
... ... @@ -10,7 +10,11 @@
10 10 #import "CNLiveViewController.h"
11 11 #import "NormalViewController.h"
12 12  
13   -@interface PlayerViewController ()
  13 +@interface PlayerViewController ()<UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource>
  14 +{
  15 + UITextField *_textField;
  16 + UITableView *_historyTableView;
  17 +}
14 18  
15 19 @end
16 20  
... ... @@ -21,22 +25,61 @@
21 25  
22 26 self.view.backgroundColor = [UIColor whiteColor];
23 27  
24   - UIButton *cnlivePlayerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
25   - cnlivePlayerBtn.frame = CGRectMake(0, 50, self.view.frame.size.width, 50);
  28 + UIButton *cnlivePlayerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  29 + cnlivePlayerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 50, 150, 50);
26 30 [cnlivePlayerBtn setTitle:@"视讯云内容播放" forState:UIControlStateNormal];
  31 + [cnlivePlayerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
27 32 [cnlivePlayerBtn addTarget:self action:@selector(cnlivePlayerBtnAction) forControlEvents:UIControlEventTouchUpInside];
  33 + cnlivePlayerBtn.layer.cornerRadius = 10;
  34 + cnlivePlayerBtn.layer.masksToBounds = YES;
  35 + cnlivePlayerBtn.layer.borderColor = [UIColor blackColor].CGColor;
  36 + cnlivePlayerBtn.layer.borderWidth = 1;
28 37 [self.view addSubview:cnlivePlayerBtn];
29 38  
30   - UIButton *normalPlayerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
31   - normalPlayerBtn.frame = CGRectMake(0, 150, self.view.frame.size.width, 50);
  39 + UIButton *normalPlayerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  40 + normalPlayerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 130, 150, 50);
32 41 [normalPlayerBtn setTitle:@"普通播放" forState:UIControlStateNormal];
  42 + [normalPlayerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
33 43 [normalPlayerBtn addTarget:self action:@selector(normalPlayerBtnAction) forControlEvents:UIControlEventTouchUpInside];
  44 + normalPlayerBtn.layer.cornerRadius = 10;
  45 + normalPlayerBtn.layer.masksToBounds = YES;
  46 + normalPlayerBtn.layer.borderColor = [UIColor blackColor].CGColor;
  47 + normalPlayerBtn.layer.borderWidth = 1;
34 48 [self.view addSubview:normalPlayerBtn];
35 49  
36   - UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
37   - exitBtn.frame = CGRectMake(0, 250, self.view.frame.size.width, 50);
  50 + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 200, 80, 30)];
  51 + label.text = @"播放地址:";
  52 + label.font = [UIFont systemFontOfSize:15];
  53 + [self.view addSubview:label];
  54 +
  55 + _textField = [[UITextField alloc] initWithFrame:CGRectMake(90, 200, self.view.frame.size.width-100, 30)];
  56 + _textField.delegate = self;
  57 + [self.view addSubview:_textField];
  58 + _textField.borderStyle = UITextBorderStyleRoundedRect;
  59 + _textField.returnKeyType = UIReturnKeyDone;
  60 + _textField.clearButtonMode = UITextFieldViewModeAlways;
  61 +
  62 + NSArray *array = [[NSArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"historyURLs"]];
  63 + if (array.count > 0) {
  64 + _textField.text = array[0];
  65 + } else {
  66 + _textField.text = @"http://wideo00.cnlive.com/video/data1/2016/0808/140935/800/e3554e4c5de34a8d9a03c534849cd2e4_140935_800.m3u8";
  67 + }
  68 +
  69 + _historyTableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 240, self.view.frame.size.width, [UIScreen mainScreen].bounds.size.height-80-240) style:UITableViewStylePlain];
  70 + _historyTableView.delegate = self;
  71 + _historyTableView.dataSource = self;
  72 + [self.view addSubview:_historyTableView];
  73 +
  74 + UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  75 + exitBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, [UIScreen mainScreen].bounds.size.height-70, 150, 50);
38 76 [exitBtn setTitle:@"退出" forState:UIControlStateNormal];
  77 + [exitBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
39 78 [exitBtn addTarget:self action:@selector(exitBtnAction) forControlEvents:UIControlEventTouchUpInside];
  79 + exitBtn.layer.cornerRadius = 10;
  80 + exitBtn.layer.masksToBounds = YES;
  81 + exitBtn.layer.borderColor = [UIColor blackColor].CGColor;
  82 + exitBtn.layer.borderWidth = 1;
40 83 [self.view addSubview:exitBtn];
41 84 }
42 85  
... ... @@ -53,10 +96,67 @@
53 96  
54 97 - (void)normalPlayerBtnAction
55 98 {
  99 + if (_textField.text.length == 0 || [_textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0) {
  100 + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil
  101 + message:@"请输入播放地址!"
  102 + delegate:nil
  103 + cancelButtonTitle:nil
  104 + otherButtonTitles:nil, nil];
  105 + [toast show];
  106 + double duration = 2;
  107 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  108 + [toast dismissWithClickedButtonIndex:0 animated:NO];
  109 + });
  110 + return;
  111 + }
  112 + NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"historyURLs"]];
  113 + if (![array containsObject:_textField.text]) {
  114 + [array insertObject:_textField.text atIndex:0];
  115 + [[NSUserDefaults standardUserDefaults] setObject:array forKey:@"historyURLs"];
  116 + [[NSUserDefaults standardUserDefaults] synchronize];
  117 + [_historyTableView reloadData];
  118 + }
  119 +
56 120 NormalViewController *cnlive = [[NormalViewController alloc] init];
  121 + cnlive.videoUrlString = _textField.text;
57 122 [self presentViewController:cnlive animated:YES completion:NULL];
58 123 }
59 124  
  125 +#pragma mark - UITextFieldDelegate
  126 +- (BOOL)textFieldShouldReturn:(UITextField *)textField
  127 +{
  128 + [textField resignFirstResponder];
  129 + return YES;
  130 +}
  131 +
  132 +#pragma mark - UITableViewDelegate
  133 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  134 +{
  135 + NSArray *array = [[NSArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"historyURLs"]];
  136 + return array.count;
  137 +}
  138 +
  139 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  140 +{
  141 + static NSString *identify = @"historyCell";
  142 + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify];
  143 + if (!cell) {
  144 + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
  145 + }
  146 +
  147 + NSArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"historyURLs"];
  148 + cell.textLabel.text = array[indexPath.row];
  149 +
  150 + return cell;
  151 +}
  152 +
  153 +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  154 +{
  155 + [tableView deselectRowAtIndexPath:indexPath animated:YES];
  156 + NSArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"historyURLs"];
  157 + _textField.text = array[indexPath.row];
  158 +}
  159 +
60 160 - (void)didReceiveMemoryWarning {
61 161 [super didReceiveMemoryWarning];
62 162 // Dispose of any resources that can be recreated.
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Streamer/StreamerDetailViewController.m
... ... @@ -34,9 +34,12 @@
34 34  
35 35 if (_isAuthLive) {
36 36  
37   - NSString *activityId = [NSString stringWithFormat:@"%d%d%d%d%d",arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9,arc4random()%9];
  37 + //用时间戳作为活动id 确保唯一性
  38 + NSDate *date = [NSDate date];
  39 + NSInteger time = [date timeIntervalSince1970];
  40 + NSString *activityId = [NSString stringWithFormat:@"%ld", (long)time];
38 41  
39   - _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithAppId:@"60_irg1rhs308" appKey:@"4e7a37b27a717a9e9b0a7aea4620ee55ea61fbf923bf46" activityId:activityId channelId:activityId isHorizontalScreen:@"0"];
  42 + _kitCN = [[CNLiveGPUStreamerKit alloc] initWithDefaultConfigWithAppId:@"60_irg1rhs308" appKey:@"4e7a37b27a717a9e9b0a7aea4620ee55ea61fbf923bf46" activityId:activityId channelId:@"iOStest" isHorizontalScreen:@"0"];
40 43 // _kitCN.activityName = @"iOS test";
41 44  
42 45 // _kitCN.coverImgUrl = @"djfiwooa";
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/Streamer/StreamerViewController.m
... ... @@ -40,10 +40,15 @@
40 40 [self.view addSubview:self.urlTextField];
41 41 [self.view addSubview:self.tableView];
42 42  
43   - UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
44   - exitBtn.frame = CGRectMake(KScreenWidth/2-40, KScreenHeight-100, 80, 30);
  43 + UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  44 + exitBtn.frame = CGRectMake(KScreenWidth/2-75, KScreenHeight-70, 150, 50);
45 45 [exitBtn setTitle:@"退出" forState:UIControlStateNormal];
  46 + [exitBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
46 47 [exitBtn addTarget:self action:@selector(exitBtnAction) forControlEvents:UIControlEventTouchUpInside];
  48 + exitBtn.layer.cornerRadius = 10;
  49 + exitBtn.layer.masksToBounds = YES;
  50 + exitBtn.layer.borderColor = [UIColor blackColor].CGColor;
  51 + exitBtn.layer.borderWidth = 1;
47 52 [self.view addSubview:exitBtn];
48 53 }
49 54  
... ... @@ -148,11 +153,17 @@
148 153 - (UIButton *)liveBtn
149 154 {
150 155 if (!_liveBtn) {
151   - _liveBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
152   - _liveBtn.frame = CGRectMake(KScreenWidth/2-40, 80, 80, 30);
  156 +
  157 + _liveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  158 + _liveBtn.frame = CGRectMake(KScreenWidth/2-75, 50, 150, 50);
153 159 _liveBtn.tag = 100000;
154 160 [_liveBtn setTitle:@"开始直播" forState:UIControlStateNormal];
  161 + [_liveBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
155 162 [_liveBtn addTarget:self action:@selector(nextViewController:) forControlEvents:UIControlEventTouchUpInside];
  163 + _liveBtn.layer.cornerRadius = 10;
  164 + _liveBtn.layer.masksToBounds = YES;
  165 + _liveBtn.layer.borderColor = [UIColor blackColor].CGColor;
  166 + _liveBtn.layer.borderWidth = 1;
156 167 }
157 168 return _liveBtn;
158 169 }
... ... @@ -160,11 +171,17 @@
160 171 - (UIButton *)authLiveBtn
161 172 {
162 173 if (!_authLiveBtn) {
163   - _authLiveBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
164   - _authLiveBtn.frame = CGRectMake(KScreenWidth/2-40, KScreenHeight-150, 80, 30);
  174 +
  175 + _authLiveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  176 + _authLiveBtn.frame = CGRectMake(KScreenWidth/2-75, KScreenHeight-150, 150, 50);
165 177 _authLiveBtn.tag = 100001;
166 178 [_authLiveBtn setTitle:@"鉴权直播" forState:UIControlStateNormal];
  179 + [_authLiveBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
167 180 [_authLiveBtn addTarget:self action:@selector(nextViewController:) forControlEvents:UIControlEventTouchUpInside];
  181 + _authLiveBtn.layer.cornerRadius = 10;
  182 + _authLiveBtn.layer.masksToBounds = YES;
  183 + _authLiveBtn.layer.borderColor = [UIColor blackColor].CGColor;
  184 + _authLiveBtn.layer.borderWidth = 1;
168 185 }
169 186 return _authLiveBtn;
170 187 }
... ... @@ -172,7 +189,7 @@
172 189 - (UITableView *)tableView
173 190 {
174 191 if (!_tableView) {
175   - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 190, KScreenWidth-20, 220) style:UITableViewStylePlain];
  192 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 180, KScreenWidth-20, KScreenHeight-180-160) style:UITableViewStylePlain];
176 193 _tableView.backgroundColor = [UIColor clearColor];
177 194 _tableView.delegate = self;
178 195 _tableView.dataSource = self;
... ... @@ -183,7 +200,7 @@
183 200 - (UITextField *)urlTextField
184 201 {
185 202 if (!_urlTextField) {
186   - _urlTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 130, KScreenWidth-20, 40)];
  203 + _urlTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 120, KScreenWidth-20, 40)];
187 204 _urlTextField.placeholder = @"请输入推流地址";
188 205 _urlTextField.borderStyle = UITextBorderStyleRoundedRect;
189 206 _urlTextField.returnKeyType = UIReturnKeyDone;
... ...
CNLivePlayerSDKTest/CNLivePlayerSDKTest/ViewController.m
... ... @@ -20,23 +20,46 @@
20 20 - (void)viewDidLoad {
21 21 [super viewDidLoad];
22 22  
23   - UIButton *playerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
24   - playerBtn.frame = CGRectMake(0, 50, self.view.frame.size.width, 50);
25   - [playerBtn setTitle:@"播放demo" forState:UIControlStateNormal];
  23 + self.title = @"视讯云 推流和播放SDK Demo";
  24 +
  25 + UIButton *playerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  26 + playerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 100, 150, 50);
  27 + [playerBtn setTitle:@"播放" forState:UIControlStateNormal];
  28 + [playerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
26 29 [playerBtn addTarget:self action:@selector(playerBtnAction) forControlEvents:UIControlEventTouchUpInside];
  30 + playerBtn.layer.cornerRadius = 10;
  31 + playerBtn.layer.masksToBounds = YES;
  32 + playerBtn.layer.borderColor = [UIColor blackColor].CGColor;
  33 + playerBtn.layer.borderWidth = 1;
27 34 [self.view addSubview:playerBtn];
28 35  
29   - UIButton *barrageBtn = [UIButton buttonWithType:UIButtonTypeSystem];
30   - barrageBtn.frame = CGRectMake(0, 150, self.view.frame.size.width, 50);
31   - [barrageBtn setTitle:@"弹幕demo" forState:UIControlStateNormal];
  36 + UIButton *streamerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  37 + streamerBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 200, 150, 50);
  38 + [streamerBtn setTitle:@"推流" forState:UIControlStateNormal];
  39 + [streamerBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
  40 + [streamerBtn addTarget:self action:@selector(streamerBtnAction) forControlEvents:UIControlEventTouchUpInside];
  41 + streamerBtn.layer.cornerRadius = 10;
  42 + streamerBtn.layer.masksToBounds = YES;
  43 + streamerBtn.layer.borderColor = [UIColor blackColor].CGColor;
  44 + streamerBtn.layer.borderWidth = 1;
  45 + [self.view addSubview:streamerBtn];
  46 +
  47 + UIButton *barrageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  48 + barrageBtn.frame = CGRectMake((CGRectGetWidth(self.view.frame)-150)/2, 300, 150, 50);
  49 + [barrageBtn setTitle:@"弹幕" forState:UIControlStateNormal];
  50 + [barrageBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
32 51 [barrageBtn addTarget:self action:@selector(barrageBtnAction) forControlEvents:UIControlEventTouchUpInside];
  52 + barrageBtn.layer.cornerRadius = 10;
  53 + barrageBtn.layer.masksToBounds = YES;
  54 + barrageBtn.layer.borderColor = [UIColor blackColor].CGColor;
  55 + barrageBtn.layer.borderWidth = 1;
33 56 [self.view addSubview:barrageBtn];
34 57  
35   - UIButton *streamerBtn = [UIButton buttonWithType:UIButtonTypeSystem];
36   - streamerBtn.frame = CGRectMake(0, 250, self.view.frame.size.width, 50);
37   - [streamerBtn setTitle:@"推流demo" forState:UIControlStateNormal];
38   - [streamerBtn addTarget:self action:@selector(streamerBtnAction) forControlEvents:UIControlEventTouchUpInside];
39   - [self.view addSubview:streamerBtn];
  58 + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetHeight([UIScreen mainScreen].bounds)-60, CGRectGetWidth(self.view.frame), 30)];
  59 + label.text = @"北京中投视讯文化传媒股份有限公司";
  60 + [self.view addSubview:label];
  61 + label.font = [UIFont systemFontOfSize:12];
  62 + label.textAlignment = NSTextAlignmentCenter;
40 63 }
41 64  
42 65 - (void)playerBtnAction
... ...