Commit 98d968c355b07cdb4c6ec7b78687e4e7a02deb81

Authored by zhangxiaowen
1 parent ed602afd

no message

Example/CNLivePlayer.xcodeproj/project.pbxproj
... ... @@ -12,6 +12,7 @@
12 12 086413C022EAE24F008713D3 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 086413BF22EAE24F008713D3 /* libz.tbd */; };
13 13 086413C222EAE591008713D3 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 086413C122EAE591008713D3 /* OpenGLES.framework */; };
14 14 086413C422EAEC11008713D3 /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 086413C322EAEC11008713D3 /* libstdc++.tbd */; };
  15 + 086ECFB5231A564900598D4E /* CNLiveBaseController.m in Sources */ = {isa = PBXBuildFile; fileRef = 086ECFB4231A564900598D4E /* CNLiveBaseController.m */; };
15 16 08740E51230E7DFB00B5D28D /* CNLiveStreamerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E3F230E7DFA00B5D28D /* CNLiveStreamerController.m */; };
16 17 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */; };
17 18 08740E53230E7DFB00B5D28D /* FilterFunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */; };
... ... @@ -59,6 +60,8 @@
59 60 086413BF22EAE24F008713D3 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
60 61 086413C122EAE591008713D3 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
61 62 086413C322EAEC11008713D3 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
  63 + 086ECFB3231A564900598D4E /* CNLiveBaseController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveBaseController.h; sourceTree = "<group>"; };
  64 + 086ECFB4231A564900598D4E /* CNLiveBaseController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveBaseController.m; sourceTree = "<group>"; };
62 65 08740E3F230E7DFA00B5D28D /* CNLiveStreamerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveStreamerController.m; sourceTree = "<group>"; };
63 66 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveStreamerDetailController.m; sourceTree = "<group>"; };
64 67 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilterFunctionView.m; sourceTree = "<group>"; };
... ... @@ -253,11 +256,13 @@
253 256 children = (
254 257 6003F59C195388D20070C39A /* CNLiveAppDelegate.h */,
255 258 6003F59D195388D20070C39A /* CNLiveAppDelegate.m */,
  259 + 086ECFB3231A564900598D4E /* CNLiveBaseController.h */,
  260 + 086ECFB4231A564900598D4E /* CNLiveBaseController.m */,
  261 + 6003F5A5195388D20070C39A /* CNLiveViewController.h */,
  262 + 6003F5A6195388D20070C39A /* CNLiveViewController.m */,
256 263 08740E5F230E8C6500B5D28D /* Player */,
257 264 08740E3E230E7DFA00B5D28D /* Streamer */,
258 265 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
259   - 6003F5A5195388D20070C39A /* CNLiveViewController.h */,
260   - 6003F5A6195388D20070C39A /* CNLiveViewController.m */,
261 266 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
262 267 6003F5A8195388D20070C39A /* Images.xcassets */,
263 268 6003F594195388D20070C39A /* Supporting Files */,
... ... @@ -371,6 +376,7 @@
371 376 developmentRegion = English;
372 377 hasScannedForEncodings = 0;
373 378 knownRegions = (
  379 + English,
374 380 en,
375 381 Base,
376 382 );
... ... @@ -514,6 +520,7 @@
514 520 08740E55230E7DFB00B5D28D /* CNLiveFloatingController.m in Sources */,
515 521 08740E69230E989000B5D28D /* CNLiveMoreFunctionsView.m in Sources */,
516 522 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */,
  523 + 086ECFB5231A564900598D4E /* CNLiveBaseController.m in Sources */,
517 524 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */,
518 525 6003F5A7195388D20070C39A /* CNLiveViewController.m in Sources */,
519 526 08740E6D230EBA6800B5D28D /* CNLiveVoiceSettingView.m in Sources */,
... ...
Example/CNLivePlayer/CNLiveAppDelegate.m
... ... @@ -14,6 +14,9 @@
14 14 #define CNLivePlayer_BundleID @"com.cnlive.video"
15 15  
16 16 @implementation CNLiveAppDelegate
  17 +- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window{
  18 + return UIInterfaceOrientationMaskAll;
  19 +}
17 20  
18 21 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
19 22 {
... ...
Example/CNLivePlayer/CNLiveBaseController.h 0 → 100644
  1 +//
  2 +// CNLiveBaseController.h
  3 +// CNLivePlayer_Example
  4 +//
  5 +// Created by CNLive-zxw on 2019/8/31.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveBaseController : UIViewController
  14 +
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
... ...
Example/CNLivePlayer/CNLiveBaseController.m 0 → 100644
  1 +//
  2 +// CNLiveBaseController.m
  3 +// CNLivePlayer_Example
  4 +//
  5 +// Created by CNLive-zxw on 2019/8/31.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveBaseController.h"
  10 +
  11 +@interface CNLiveBaseController ()
  12 +
  13 +@end
  14 +
  15 +@implementation CNLiveBaseController
  16 +
  17 +- (void)viewDidLoad {
  18 + [super viewDidLoad];
  19 + // Do any additional setup after loading the view.
  20 +}
  21 +
  22 +/*
  23 +#pragma mark - Navigation
  24 +
  25 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  26 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  27 + // Get the new view controller using [segue destinationViewController].
  28 + // Pass the selected object to the new view controller.
  29 +}
  30 +*/
  31 +
  32 +- (BOOL)shouldAutorotate{
  33 + return NO;
  34 +}
  35 +- (NSUInteger)supportedInterfaceOrientations{
  36 + return UIInterfaceOrientationMaskAll;
  37 +
  38 +}
  39 +
  40 +@end
... ...
Example/CNLivePlayer/CNLivePlayer-Info.plist
... ... @@ -2,14 +2,6 @@
2 2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 3 <plist version="1.0">
4 4 <dict>
5   - <key>NSPhotoLibraryUsageDescription</key>
6   - <string></string>
7   - <key>NSPhotoLibraryAddUsageDescription</key>
8   - <string></string>
9   - <key>NSCameraUsageDescription</key>
10   - <string></string>
11   - <key>NSMicrophoneUsageDescription</key>
12   - <string></string>
13 5 <key>CFBundleDevelopmentRegion</key>
14 6 <string>en</string>
15 7 <key>CFBundleDisplayName</key>
... ... @@ -37,6 +29,14 @@
37 29 <key>NSAllowsArbitraryLoads</key>
38 30 <true/>
39 31 </dict>
  32 + <key>NSCameraUsageDescription</key>
  33 + <string></string>
  34 + <key>NSMicrophoneUsageDescription</key>
  35 + <string></string>
  36 + <key>NSPhotoLibraryAddUsageDescription</key>
  37 + <string></string>
  38 + <key>NSPhotoLibraryUsageDescription</key>
  39 + <string></string>
40 40 <key>UILaunchStoryboardName</key>
41 41 <string>LaunchScreen</string>
42 42 <key>UIMainStoryboardFile</key>
... ... @@ -48,8 +48,6 @@
48 48 <key>UISupportedInterfaceOrientations</key>
49 49 <array>
50 50 <string>UIInterfaceOrientationPortrait</string>
51   - <string>UIInterfaceOrientationLandscapeLeft</string>
52   - <string>UIInterfaceOrientationLandscapeRight</string>
53 51 </array>
54 52 <key>UISupportedInterfaceOrientations~ipad</key>
55 53 <array>
... ...
Example/CNLivePlayer/CNLiveViewController.h
... ... @@ -5,9 +5,8 @@
5 5 // Created by 153993236@qq.com on 07/26/2019.
6 6 // Copyright (c) 2019 153993236@qq.com. All rights reserved.
7 7 //
  8 +#import "CNLiveBaseController.h"
8 9  
9   -@import UIKit;
10   -
11   -@interface CNLiveViewController : UIViewController
  10 +@interface CNLiveViewController : CNLiveBaseController
12 11  
13 12 @end
... ...
Example/CNLivePlayer/CNLiveViewController.m
... ... @@ -55,4 +55,5 @@
55 55  
56 56 }
57 57  
  58 +
58 59 @end
... ...
Example/CNLivePlayer/Player/CNLivePlayerController.h
... ... @@ -6,11 +6,11 @@
6 6 // Copyright © 2019 153993236@qq.com. All rights reserved.
7 7 //
8 8  
9   -#import <UIKit/UIKit.h>
  9 +#import "CNLiveBaseController.h"
10 10  
11 11 NS_ASSUME_NONNULL_BEGIN
12 12  
13   -@interface CNLivePlayerController : UIViewController
  13 +@interface CNLivePlayerController : CNLiveBaseController
14 14  
15 15 @end
16 16  
... ...
Example/CNLivePlayer/Player/CNLivePlayerController.m
... ... @@ -22,7 +22,8 @@
22 22 self.view.backgroundColor = [UIColor whiteColor];
23 23  
24 24 // Do any additional setup after loading the view.
25   -
  25 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
  26 +
26 27 self.player = [[CNLivePlayer alloc]initVodPlayerWithVideoId:@"82_c8ff347048414b7295cef882f8361073" authSuccess:^{
27 28  
28 29 _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
... ... @@ -141,5 +142,40 @@
141 142 // Pass the selected object to the new view controller.
142 143 }
143 144 */
  145 +/**
  146 + * 状态栏方向改变 触发
  147 + *
  148 + */
  149 +- (void)statusBarOrientationChange:(NSNotification *)notification{
  150 + //CGRect bounds = [[UIScreen mainScreen] bounds];
  151 + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
  152 + if (orientation == UIInterfaceOrientationLandscapeRight) // home键靠右
  153 + {
  154 + _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
  155 +
  156 + }
  157 +
  158 + if (orientation ==UIInterfaceOrientationLandscapeLeft) // home键靠左
  159 + {
  160 + _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
  161 + }
  162 +
  163 + if (orientation == UIInterfaceOrientationPortrait) //home键靠下
  164 + {
  165 + _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
144 166  
  167 + }
  168 +
  169 + if (orientation == UIInterfaceOrientationPortraitUpsideDown)//home键靠上
  170 + {
  171 + _player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
  172 + }
  173 +}
  174 +- (BOOL)shouldAutorotate{
  175 + return YES;
  176 +}
  177 +- (NSUInteger)supportedInterfaceOrientations{
  178 + return UIInterfaceOrientationMaskAll;
  179 +
  180 +}
145 181 @end
... ...