Commit a273c54ce989f8bd9758402299f681747d46fca6
1 parent
74bb97df
no message
Showing
10 changed files
with
43 additions
and
66 deletions
CNLivePlayer/Classes/Streamer/CNLiveBgmPlayer.h
| @@ -6,6 +6,10 @@ | @@ -6,6 +6,10 @@ | ||
| 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. | 6 | // Copyright © 2019 153993236@qq.com. All rights reserved. |
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * 背景音乐播放器 | ||
| 11 | + */ | ||
| 12 | + | ||
| 9 | #import <Foundation/Foundation.h> | 13 | #import <Foundation/Foundation.h> |
| 10 | #import <AVFoundation/AVFoundation.h> | 14 | #import <AVFoundation/AVFoundation.h> |
| 11 | #import "CNLivePlayerDefines.h" | 15 | #import "CNLivePlayerDefines.h" |
CNLivePlayer/Classes/Streamer/CNLiveBgmPlayer.m
| @@ -18,7 +18,7 @@ NSString * const CNLiveBgmAudioStateDidChangeNotification = @"CNLiveBgmAudioStat | @@ -18,7 +18,7 @@ NSString * const CNLiveBgmAudioStateDidChangeNotification = @"CNLiveBgmAudioStat | ||
| 18 | - (instancetype)init { | 18 | - (instancetype)init { |
| 19 | self = [super init]; | 19 | self = [super init]; |
| 20 | if (self) { | 20 | if (self) { |
| 21 | - [self addBgmObservers]; | 21 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioStateDidChange) name:KSYAudioStateDidChangeNotification object:nil]; |
| 22 | 22 | ||
| 23 | STREAMER_Manager_BgmPlayer.audioDataBlock = ^ BOOL(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime pts){ | 23 | STREAMER_Manager_BgmPlayer.audioDataBlock = ^ BOOL(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime pts){ |
| 24 | [STREAMER_Manager.aMixer processAudioData:pData nbSample:len withFormat:fmt timeinfo:pts of:STREAMER_Manager.bgmTrack]; | 24 | [STREAMER_Manager.aMixer processAudioData:pData nbSample:len withFormat:fmt timeinfo:pts of:STREAMER_Manager.bgmTrack]; |
| @@ -35,23 +35,16 @@ NSString * const CNLiveBgmAudioStateDidChangeNotification = @"CNLiveBgmAudioStat | @@ -35,23 +35,16 @@ NSString * const CNLiveBgmAudioStateDidChangeNotification = @"CNLiveBgmAudioStat | ||
| 35 | return self; | 35 | return self; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | -- (void)addBgmObservers { | ||
| 39 | - [[NSNotificationCenter defaultCenter] addObserver:self | ||
| 40 | - selector:@selector(audioStateDidChange) | ||
| 41 | - name:KSYAudioStateDidChangeNotification | ||
| 42 | - object:nil]; | ||
| 43 | -} | ||
| 44 | - | ||
| 45 | - (CNLiveBgmPlayerState)audioStateDidChange { | 38 | - (CNLiveBgmPlayerState)audioStateDidChange { |
| 46 | return (CNLiveBgmPlayerState)STREAMER_Manager_BgmPlayer.bgmPlayerState; | 39 | return (CNLiveBgmPlayerState)STREAMER_Manager_BgmPlayer.bgmPlayerState; |
| 47 | } | 40 | } |
| 48 | 41 | ||
| 49 | - (void)dealloc { | 42 | - (void)dealloc { |
| 50 | - [[NSNotificationCenter defaultCenter] removeObserver:self | ||
| 51 | - name:KSYAudioStateDidChangeNotification | ||
| 52 | - object:nil]; | 43 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 44 | + | ||
| 53 | } | 45 | } |
| 54 | 46 | ||
| 47 | +#pragma mark - methods | ||
| 55 | - (BOOL)startPlayBgm:(NSString *)path isLoop:(BOOL)loop { | 48 | - (BOOL)startPlayBgm:(NSString *)path isLoop:(BOOL)loop { |
| 56 | return [STREAMER_Manager_BgmPlayer startPlayBgm:path isLoop:loop]; | 49 | return [STREAMER_Manager_BgmPlayer startPlayBgm:path isLoop:loop]; |
| 57 | } | 50 | } |
CNLivePlayer/Classes/Streamer/CNLiveStreamerKit.m
| @@ -213,14 +213,15 @@ NSString * const CNLiveServiceConnectBreakNotification = @"CNLiveServiceConnectB | @@ -213,14 +213,15 @@ NSString * const CNLiveServiceConnectBreakNotification = @"CNLiveServiceConnectB | ||
| 213 | else { | 213 | else { |
| 214 | //设置初始美颜 | 214 | //设置初始美颜 |
| 215 | _filter = [[KSYGPUBeautifyExtFilter alloc] init]; | 215 | _filter = [[KSYGPUBeautifyExtFilter alloc] init]; |
| 216 | - [(KSYGPUBeautifyExtFilter *)_filter setBeautylevel: 0.5]; | 216 | + [(KSYGPUBeautifyExtFilter *)_filter setBeautylevel:0.5]; |
| 217 | [_manager.kit setupFilter:_filter]; | 217 | [_manager.kit setupFilter:_filter]; |
| 218 | 218 | ||
| 219 | //摄像头位置 | 219 | //摄像头位置 |
| 220 | _manager.kit.cameraPosition = AVCaptureDevicePositionFront; | 220 | _manager.kit.cameraPosition = AVCaptureDevicePositionFront; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | - _manager.kit.streamerBase.shouldEnableKSYStatModule = NO; //收集网络相关状态的日志(不收集) | 223 | + _manager.kit.streamerBase.shouldEnableKSYStatModule = NO; |
| 224 | + //收集网络相关状态的日志(不收集) | ||
| 224 | _manager.kit.videoProcessingCallback = ^(CMSampleBufferRef sampleBuffer){ | 225 | _manager.kit.videoProcessingCallback = ^(CMSampleBufferRef sampleBuffer){ |
| 225 | 226 | ||
| 226 | }; | 227 | }; |
| @@ -410,22 +411,7 @@ NSString * const CNLiveServiceConnectBreakNotification = @"CNLiveServiceConnectB | @@ -410,22 +411,7 @@ NSString * const CNLiveServiceConnectBreakNotification = @"CNLiveServiceConnectB | ||
| 410 | 411 | ||
| 411 | 412 | ||
| 412 | - (void)quitStreaming { | 413 | - (void)quitStreaming { |
| 413 | - [[NSNotificationCenter defaultCenter] removeObserver:self | ||
| 414 | - name:KSYCaptureStateDidChangeNotification | ||
| 415 | - object:nil]; | ||
| 416 | - | ||
| 417 | - [[NSNotificationCenter defaultCenter] removeObserver:self | ||
| 418 | - name:KSYStreamStateDidChangeNotification | ||
| 419 | - object:nil]; | ||
| 420 | - | ||
| 421 | - [[NSNotificationCenter defaultCenter] removeObserver:self | ||
| 422 | - name:UIApplicationWillResignActiveNotification | ||
| 423 | - object:nil]; | ||
| 424 | - | ||
| 425 | - [[NSNotificationCenter defaultCenter] removeObserver:self | ||
| 426 | - name:UIApplicationDidBecomeActiveNotification | ||
| 427 | - object:nil]; | ||
| 428 | - | 414 | + [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 429 | 415 | ||
| 430 | [self.heartTimer invalidate]; | 416 | [self.heartTimer invalidate]; |
| 431 | self.heartTimer = nil; | 417 | self.heartTimer = nil; |
CNLivePlayer/Classes/Streamer/CNLiveStreamerTools.h
| @@ -11,9 +11,10 @@ | @@ -11,9 +11,10 @@ | ||
| 11 | NS_ASSUME_NONNULL_BEGIN | 11 | NS_ASSUME_NONNULL_BEGIN |
| 12 | 12 | ||
| 13 | @interface CNLiveStreamerTools : NSObject | 13 | @interface CNLiveStreamerTools : NSObject |
| 14 | -//SHA加密 | 14 | +//签名 |
| 15 | + (NSMutableDictionary *)encryptionSignWithParameter:(NSMutableDictionary *)parameter; | 15 | + (NSMutableDictionary *)encryptionSignWithParameter:(NSMutableDictionary *)parameter; |
| 16 | 16 | ||
| 17 | +//SHA加密 | ||
| 17 | + (NSString*)sha1:(NSString *)string; | 18 | + (NSString*)sha1:(NSString *)string; |
| 18 | 19 | ||
| 19 | + (NSString *)signvalue:(NSDictionary*)parameter; | 20 | + (NSString *)signvalue:(NSDictionary*)parameter; |
CNLivePlayer/Classes/Streamer/CNLiveWatermark.h
| @@ -20,7 +20,6 @@ NS_ASSUME_NONNULL_BEGIN | @@ -20,7 +20,6 @@ NS_ASSUME_NONNULL_BEGIN | ||
| 20 | @abstract 水印logo的图片 | 20 | @abstract 水印logo的图片 |
| 21 | @discussion 设置为nil为清除水印图片 | 21 | @discussion 设置为nil为清除水印图片 |
| 22 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 | 22 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 |
| 23 | - @see | ||
| 24 | */ | 23 | */ |
| 25 | @property (nonatomic, readwrite) GPUImagePicture *logoPic; | 24 | @property (nonatomic, readwrite) GPUImagePicture *logoPic; |
| 26 | 25 |
Example/CNLivePlayer.xcodeproj/project.pbxproj
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */; }; | 16 | 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */; }; |
| 17 | 08740E53230E7DFB00B5D28D /* FilterFunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */; }; | 17 | 08740E53230E7DFB00B5D28D /* FilterFunctionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */; }; |
| 18 | 08740E54230E7DFB00B5D28D /* SliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E44230E7DFA00B5D28D /* SliderView.m */; }; | 18 | 08740E54230E7DFB00B5D28D /* SliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E44230E7DFA00B5D28D /* SliderView.m */; }; |
| 19 | - 08740E55230E7DFB00B5D28D /* FloatingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E45230E7DFA00B5D28D /* FloatingViewController.m */; }; | 19 | + 08740E55230E7DFB00B5D28D /* CNLiveFloatingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E45230E7DFA00B5D28D /* CNLiveFloatingController.m */; }; |
| 20 | 08740E56230E7DFB00B5D28D /* AudioStreamingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */; }; | 20 | 08740E56230E7DFB00B5D28D /* AudioStreamingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */; }; |
| 21 | 08740E59230E7DFB00B5D28D /* BgmPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E4D230E7DFA00B5D28D /* BgmPlayerView.m */; }; | 21 | 08740E59230E7DFB00B5D28D /* BgmPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 08740E4D230E7DFA00B5D28D /* BgmPlayerView.m */; }; |
| 22 | 08740E5E230E8A0700B5D28D /* house.gif in Resources */ = {isa = PBXBuildFile; fileRef = 08740E5D230E8A0700B5D28D /* house.gif */; }; | 22 | 08740E5E230E8A0700B5D28D /* house.gif in Resources */ = {isa = PBXBuildFile; fileRef = 08740E5D230E8A0700B5D28D /* house.gif */; }; |
| @@ -64,14 +64,14 @@ | @@ -64,14 +64,14 @@ | ||
| 64 | 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilterFunctionView.m; sourceTree = "<group>"; }; | 64 | 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FilterFunctionView.m; sourceTree = "<group>"; }; |
| 65 | 08740E43230E7DFA00B5D28D /* BgmPlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BgmPlayerView.h; sourceTree = "<group>"; }; | 65 | 08740E43230E7DFA00B5D28D /* BgmPlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BgmPlayerView.h; sourceTree = "<group>"; }; |
| 66 | 08740E44230E7DFA00B5D28D /* SliderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SliderView.m; sourceTree = "<group>"; }; | 66 | 08740E44230E7DFA00B5D28D /* SliderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SliderView.m; sourceTree = "<group>"; }; |
| 67 | - 08740E45230E7DFA00B5D28D /* FloatingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FloatingViewController.m; sourceTree = "<group>"; }; | 67 | + 08740E45230E7DFA00B5D28D /* CNLiveFloatingController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveFloatingController.m; sourceTree = "<group>"; }; |
| 68 | 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioStreamingViewController.m; sourceTree = "<group>"; }; | 68 | 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioStreamingViewController.m; sourceTree = "<group>"; }; |
| 69 | 08740E49230E7DFA00B5D28D /* FilterFunctionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterFunctionView.h; sourceTree = "<group>"; }; | 69 | 08740E49230E7DFA00B5D28D /* FilterFunctionView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilterFunctionView.h; sourceTree = "<group>"; }; |
| 70 | 08740E4A230E7DFA00B5D28D /* CNLiveStreamerDetailController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveStreamerDetailController.h; sourceTree = "<group>"; }; | 70 | 08740E4A230E7DFA00B5D28D /* CNLiveStreamerDetailController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveStreamerDetailController.h; sourceTree = "<group>"; }; |
| 71 | 08740E4B230E7DFA00B5D28D /* CNLiveStreamerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveStreamerController.h; sourceTree = "<group>"; }; | 71 | 08740E4B230E7DFA00B5D28D /* CNLiveStreamerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveStreamerController.h; sourceTree = "<group>"; }; |
| 72 | 08740E4C230E7DFA00B5D28D /* SliderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderView.h; sourceTree = "<group>"; }; | 72 | 08740E4C230E7DFA00B5D28D /* SliderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SliderView.h; sourceTree = "<group>"; }; |
| 73 | 08740E4D230E7DFA00B5D28D /* BgmPlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BgmPlayerView.m; sourceTree = "<group>"; }; | 73 | 08740E4D230E7DFA00B5D28D /* BgmPlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BgmPlayerView.m; sourceTree = "<group>"; }; |
| 74 | - 08740E4E230E7DFA00B5D28D /* FloatingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingViewController.h; sourceTree = "<group>"; }; | 74 | + 08740E4E230E7DFA00B5D28D /* CNLiveFloatingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveFloatingController.h; sourceTree = "<group>"; }; |
| 75 | 08740E50230E7DFA00B5D28D /* AudioStreamingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioStreamingViewController.h; sourceTree = "<group>"; }; | 75 | 08740E50230E7DFA00B5D28D /* AudioStreamingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioStreamingViewController.h; sourceTree = "<group>"; }; |
| 76 | 08740E5D230E8A0700B5D28D /* house.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = house.gif; sourceTree = "<group>"; }; | 76 | 08740E5D230E8A0700B5D28D /* house.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = house.gif; sourceTree = "<group>"; }; |
| 77 | 08740E60230E8C6500B5D28D /* CNLivePlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLivePlayerController.m; sourceTree = "<group>"; }; | 77 | 08740E60230E8C6500B5D28D /* CNLivePlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLivePlayerController.m; sourceTree = "<group>"; }; |
| @@ -168,8 +168,8 @@ | @@ -168,8 +168,8 @@ | ||
| 168 | 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */, | 168 | 08740E40230E7DFA00B5D28D /* CNLiveStreamerDetailController.m */, |
| 169 | 08740E50230E7DFA00B5D28D /* AudioStreamingViewController.h */, | 169 | 08740E50230E7DFA00B5D28D /* AudioStreamingViewController.h */, |
| 170 | 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */, | 170 | 08740E46230E7DFA00B5D28D /* AudioStreamingViewController.m */, |
| 171 | - 08740E4E230E7DFA00B5D28D /* FloatingViewController.h */, | ||
| 172 | - 08740E45230E7DFA00B5D28D /* FloatingViewController.m */, | 171 | + 08740E4E230E7DFA00B5D28D /* CNLiveFloatingController.h */, |
| 172 | + 08740E45230E7DFA00B5D28D /* CNLiveFloatingController.m */, | ||
| 173 | 08740E49230E7DFA00B5D28D /* FilterFunctionView.h */, | 173 | 08740E49230E7DFA00B5D28D /* FilterFunctionView.h */, |
| 174 | 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */, | 174 | 08740E41230E7DFA00B5D28D /* FilterFunctionView.m */, |
| 175 | 08740E43230E7DFA00B5D28D /* BgmPlayerView.h */, | 175 | 08740E43230E7DFA00B5D28D /* BgmPlayerView.h */, |
| @@ -511,7 +511,7 @@ | @@ -511,7 +511,7 @@ | ||
| 511 | isa = PBXSourcesBuildPhase; | 511 | isa = PBXSourcesBuildPhase; |
| 512 | buildActionMask = 2147483647; | 512 | buildActionMask = 2147483647; |
| 513 | files = ( | 513 | files = ( |
| 514 | - 08740E55230E7DFB00B5D28D /* FloatingViewController.m in Sources */, | 514 | + 08740E55230E7DFB00B5D28D /* CNLiveFloatingController.m in Sources */, |
| 515 | 08740E69230E989000B5D28D /* CNLiveMoreFunctionsView.m in Sources */, | 515 | 08740E69230E989000B5D28D /* CNLiveMoreFunctionsView.m in Sources */, |
| 516 | 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */, | 516 | 6003F59E195388D20070C39A /* CNLiveAppDelegate.m in Sources */, |
| 517 | 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */, | 517 | 08740E52230E7DFB00B5D28D /* CNLiveStreamerDetailController.m in Sources */, |
Example/CNLivePlayer/CNLiveViewController.m
| @@ -17,8 +17,7 @@ | @@ -17,8 +17,7 @@ | ||
| 17 | 17 | ||
| 18 | @implementation CNLiveViewController | 18 | @implementation CNLiveViewController |
| 19 | 19 | ||
| 20 | -- (void)viewDidLoad | ||
| 21 | -{ | 20 | +- (void)viewDidLoad { |
| 22 | [super viewDidLoad]; | 21 | [super viewDidLoad]; |
| 23 | // Do any additional setup after loading the view, typically from a nib. | 22 | // Do any additional setup after loading the view, typically from a nib. |
| 24 | 23 | ||
| @@ -45,7 +44,6 @@ | @@ -45,7 +44,6 @@ | ||
| 45 | label.font = [UIFont systemFontOfSize:16]; | 44 | label.font = [UIFont systemFontOfSize:16]; |
| 46 | label.textAlignment = NSTextAlignmentCenter; | 45 | label.textAlignment = NSTextAlignmentCenter; |
| 47 | [self.view addSubview:label]; | 46 | [self.view addSubview:label]; |
| 48 | - | ||
| 49 | 47 | ||
| 50 | } | 48 | } |
| 51 | - (void)btnDidClicked1{ | 49 | - (void)btnDidClicked1{ |
| @@ -57,10 +55,4 @@ | @@ -57,10 +55,4 @@ | ||
| 57 | 55 | ||
| 58 | } | 56 | } |
| 59 | 57 | ||
| 60 | -- (void)didReceiveMemoryWarning | ||
| 61 | -{ | ||
| 62 | - [super didReceiveMemoryWarning]; | ||
| 63 | - // Dispose of any resources that can be recreated. | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | @end | 58 | @end |
Example/CNLivePlayer/Streamer/FloatingViewController.h renamed to Example/CNLivePlayer/Streamer/CNLiveFloatingController.h
| 1 | // | 1 | // |
| 2 | -// FloatingViewController.h | ||
| 3 | -// CNLivePlayerSDKDemo | 2 | +// CNLiveFloatingController.h |
| 3 | +// CNLivePlayer_Example | ||
| 4 | // | 4 | // |
| 5 | -// Created by iOS on 2017/9/20. | ||
| 6 | -// Copyright © 2017年 雷浩杰. All rights reserved. | 5 | +// Created by CNLive-zxw on 2019/8/17. |
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | #import "CNLiveStreamerKit.h" | 10 | #import "CNLiveStreamerKit.h" |
| 11 | 11 | ||
| 12 | -@interface FloatingViewController : UIViewController | 12 | +@interface CNLiveFloatingController : UIViewController |
| 13 | 13 | ||
| 14 | @property (nonatomic, strong) CNLiveStreamerKit *kit; | 14 | @property (nonatomic, strong) CNLiveStreamerKit *kit; |
| 15 | 15 |
Example/CNLivePlayer/Streamer/FloatingViewController.m renamed to Example/CNLivePlayer/Streamer/CNLiveFloatingController.m
| 1 | // | 1 | // |
| 2 | -// FloatingViewController.m | ||
| 3 | -// CNLivePlayerSDKDemo | 2 | +// CNLiveFloatingController.m |
| 3 | +// CNLivePlayer_Example | ||
| 4 | // | 4 | // |
| 5 | -// Created by iOS on 2017/9/20. | ||
| 6 | -// Copyright © 2017年 雷浩杰. All rights reserved. | 5 | +// Created by CNLive-zxw on 2019/8/17. |
| 6 | +// Copyright © 2019 153993236@qq.com. All rights reserved. | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | -#import "FloatingViewController.h" | 9 | +#import "CNLiveFloatingController.h" |
| 10 | 10 | ||
| 11 | #define Width [UIScreen mainScreen].bounds.size.width | 11 | #define Width [UIScreen mainScreen].bounds.size.width |
| 12 | #define Height [UIScreen mainScreen].bounds.size.height | 12 | #define Height [UIScreen mainScreen].bounds.size.height |
| 13 | 13 | ||
| 14 | -@interface FloatingViewController () | 14 | +@interface CNLiveFloatingController () |
| 15 | 15 | ||
| 16 | @property (nonatomic, strong) UIView *preView; | 16 | @property (nonatomic, strong) UIView *preView; |
| 17 | @property CGPoint loc_in; | 17 | @property CGPoint loc_in; |
| 18 | 18 | ||
| 19 | @end | 19 | @end |
| 20 | 20 | ||
| 21 | -@implementation FloatingViewController | 21 | +@implementation CNLiveFloatingController |
| 22 | 22 | ||
| 23 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { | 23 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { |
| 24 | 24 | ||
| @@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
| 52 | 52 | ||
| 53 | - (void)backAction { | 53 | - (void)backAction { |
| 54 | [self dismissViewControllerAnimated:YES completion:NULL]; | 54 | [self dismissViewControllerAnimated:YES completion:NULL]; |
| 55 | + | ||
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | - (void)pan:(UIPanGestureRecognizer *)ges{ | 58 | - (void)pan:(UIPanGestureRecognizer *)ges{ |
| @@ -81,9 +82,9 @@ | @@ -81,9 +82,9 @@ | ||
| 81 | [UIView animateWithDuration:0 animations:^{ | 82 | [UIView animateWithDuration:0 animations:^{ |
| 82 | _preView.center = CGPointMake(x, y); | 83 | _preView.center = CGPointMake(x, y); |
| 83 | }]; | 84 | }]; |
| 85 | + | ||
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | - | ||
| 87 | - (void)didReceiveMemoryWarning { | 88 | - (void)didReceiveMemoryWarning { |
| 88 | [super didReceiveMemoryWarning]; | 89 | [super didReceiveMemoryWarning]; |
| 89 | // Dispose of any resources that can be recreated. | 90 | // Dispose of any resources that can be recreated. |
Example/CNLivePlayer/Streamer/CNLiveStreamerDetailController.m
| @@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
| 13 | 13 | ||
| 14 | #import <GPUImage/GPUImage.h> | 14 | #import <GPUImage/GPUImage.h> |
| 15 | #import <YYImage/YYImage.h> | 15 | #import <YYImage/YYImage.h> |
| 16 | -#import "FloatingViewController.h" | 16 | +#import "CNLiveFloatingController.h" |
| 17 | #import "CNLiveStreamerKit.h" | 17 | #import "CNLiveStreamerKit.h" |
| 18 | 18 | ||
| 19 | #import "CNLiveLoadingView.h" | 19 | #import "CNLiveLoadingView.h" |
| @@ -40,8 +40,7 @@ | @@ -40,8 +40,7 @@ | ||
| 40 | UIButton *_flashBtn; //打开闪光灯 | 40 | UIButton *_flashBtn; //打开闪光灯 |
| 41 | UIButton *_filterBtn; //滤镜 | 41 | UIButton *_filterBtn; //滤镜 |
| 42 | UIButton *_voiceBtn; //声音 | 42 | UIButton *_voiceBtn; //声音 |
| 43 | - UIButton *_moreBtn; //更多 | ||
| 44 | - | 43 | + UIButton *_moreBtn; //更多 |
| 45 | 44 | ||
| 46 | CGFloat _currentPinchZoomFactor; //当前触摸缩放因子 | 45 | CGFloat _currentPinchZoomFactor; //当前触摸缩放因子 |
| 47 | 46 | ||
| @@ -68,7 +67,7 @@ | @@ -68,7 +67,7 @@ | ||
| 68 | 67 | ||
| 69 | @property (nonatomic, strong) NSLock *dlLock; | 68 | @property (nonatomic, strong) NSLock *dlLock; |
| 70 | @property (nonatomic, strong) GPUImagePicture *logoPicure; | 69 | @property (nonatomic, strong) GPUImagePicture *logoPicure; |
| 71 | -@property (nonatomic, strong) CADisplayLink *displayLink; | 70 | +@property (nonatomic, strong) CADisplayLink *displayLink; |
| 72 | 71 | ||
| 73 | @end | 72 | @end |
| 74 | 73 | ||
| @@ -96,11 +95,12 @@ | @@ -96,11 +95,12 @@ | ||
| 96 | UIDeviceOrientation toDeviceOrientation = [UIDevice currentDevice].orientation; | 95 | UIDeviceOrientation toDeviceOrientation = [UIDevice currentDevice].orientation; |
| 97 | 96 | ||
| 98 | if (toDeviceOrientation == UIDeviceOrientationPortrait) { | 97 | if (toDeviceOrientation == UIDeviceOrientationPortrait) { |
| 98 | + //竖屏 | ||
| 99 | newTransform = CGAffineTransformIdentity; | 99 | newTransform = CGAffineTransformIdentity; |
| 100 | newFrame = CGRectMake(0, 0, minLength, maxLength); | 100 | newFrame = CGRectMake(0, 0, minLength, maxLength); |
| 101 | } | 101 | } |
| 102 | else { | 102 | else { |
| 103 | - | 103 | + //横屏 |
| 104 | if (currentInterfaceOrientation == UIInterfaceOrientationPortrait) { | 104 | if (currentInterfaceOrientation == UIInterfaceOrientationPortrait) { |
| 105 | newTransform = CGAffineTransformMakeRotation(M_PI_2*(toDeviceOrientation == UIDeviceOrientationLandscapeRight ? 1 : -1)); | 105 | newTransform = CGAffineTransformMakeRotation(M_PI_2*(toDeviceOrientation == UIDeviceOrientationLandscapeRight ? 1 : -1)); |
| 106 | } | 106 | } |
| @@ -142,7 +142,8 @@ | @@ -142,7 +142,8 @@ | ||
| 142 | } | 142 | } |
| 143 | _previewBtn.frame = CGRectMake(20, Screen_Height-60, 90, 30); | 143 | _previewBtn.frame = CGRectMake(20, Screen_Height-60, 90, 30); |
| 144 | _startLiveBtn.frame = CGRectMake(Screen_Width-90-20, Screen_Height-60, 90, 30); | 144 | _startLiveBtn.frame = CGRectMake(Screen_Width-90-20, Screen_Height-60, 90, 30); |
| 145 | - | 145 | + _stateLabel.frame = newFrame; |
| 146 | + | ||
| 146 | }]; | 147 | }]; |
| 147 | } | 148 | } |
| 148 | 149 | ||
| @@ -562,7 +563,7 @@ | @@ -562,7 +563,7 @@ | ||
| 562 | } | 563 | } |
| 563 | 564 | ||
| 564 | - (void)floatingWindowBtnClicked { | 565 | - (void)floatingWindowBtnClicked { |
| 565 | - FloatingViewController *vc = [[FloatingViewController alloc] init]; | 566 | + CNLiveFloatingController *vc = [[CNLiveFloatingController alloc] init]; |
| 566 | vc.kit = _kitCN; | 567 | vc.kit = _kitCN; |
| 567 | [self presentViewController:vc animated:YES completion:NULL]; | 568 | [self presentViewController:vc animated:YES completion:NULL]; |
| 568 | } | 569 | } |