Commit d37f8203e08587b29ec3acde4373697d452db1fe

Authored by zhangxiaowen
1 parent d690c31f

no message

CNLivePlayer.podspec
@@ -29,8 +29,9 @@ TODO: Add long description of the pod here. @@ -29,8 +29,9 @@ TODO: Add long description of the pod here.
29 # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' 29 # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30 30
31 s.ios.deployment_target = '9.0' 31 s.ios.deployment_target = '9.0'
32 - 32 + # s.public_header_files = 'Pod/Classes/**/*.h'
33 # s.source_files = 'CNLivePlayer/Classes/**/*' 33 # s.source_files = 'CNLivePlayer/Classes/**/*'
  34 +
34 s.subspec 'Player' do |ss| 35 s.subspec 'Player' do |ss|
35 ss.source_files = 'CNLivePlayer/Classes/Player/*.{h,m}' 36 ss.source_files = 'CNLivePlayer/Classes/Player/*.{h,m}'
36 end 37 end
@@ -49,9 +50,9 @@ TODO: Add long description of the pod here. @@ -49,9 +50,9 @@ TODO: Add long description of the pod here.
49 50
50 s.static_framework = true 51 s.static_framework = true
51 s.vendored_frameworks = 'CNLivePlayer/Classes/*.framework' 52 s.vendored_frameworks = 'CNLivePlayer/Classes/*.framework'
  53 + s.libraries = 'z', 'bz2', 'stdc++'
52 54
53 - # s.public_header_files = 'Pod/Classes/**/*.h'  
54 - s.frameworks = 'UIKit', 'MediaPlayer' 55 + s.frameworks = 'UIKit', 'MediaPlayer', 'VideoToolbox'
55 s.dependency 'libksygpulive/KSYGPUResource' 56 s.dependency 'libksygpulive/KSYGPUResource'
56 s.dependency 'libksygpulive/libksygpulive' 57 s.dependency 'libksygpulive/libksygpulive'
57 s.dependency 'ksyhttpcache' 58 s.dependency 'ksyhttpcache'
CNLivePlayer/Classes/Player/CNLivePlayer.h
@@ -10,9 +10,19 @@ @@ -10,9 +10,19 @@
10 #import <libksygpulive/KSYMoviePlayerController.h> 10 #import <libksygpulive/KSYMoviePlayerController.h>
11 #import "KSYMoviePlayerDefines.h" 11 #import "KSYMoviePlayerDefines.h"
12 12
  13 +//缓存视频
  14 +#import <KSYHTTPCache/KSYHTTPProxyService.h>
  15 +#import <KSYHTTPCache/HTTPCacheDefines.h>
  16 +
13 // 播放器管理类 17 // 播放器管理类
14 #import "CNLivePlayerManager.h" 18 #import "CNLivePlayerManager.h"
15 19
  20 +//缓存url
  21 +#import "CNLivePlayerCache.h"
  22 +
  23 +//常量
  24 +#import "CNLivePlayerConst.h"
  25 +
16 NS_ASSUME_NONNULL_BEGIN 26 NS_ASSUME_NONNULL_BEGIN
17 typedef NS_ENUM(NSUInteger, CNLivePlayerType) { 27 typedef NS_ENUM(NSUInteger, CNLivePlayerType) {
18 CNLivePlayerVod, //点播 28 CNLivePlayerVod, //点播
CNLivePlayer/Classes/Player/CNLivePlayer.m
@@ -7,21 +7,11 @@ @@ -7,21 +7,11 @@
7 // 7 //
8 8
9 #import "CNLivePlayer.h" 9 #import "CNLivePlayer.h"
10 -#import "CNLivePlayerManager.h"  
11 -//缓存视频  
12 -#import <KSYHTTPCache/KSYHTTPProxyService.h>  
13 -#import <KSYHTTPCache/HTTPCacheDefines.h>  
14 -  
15 -//缓存url  
16 -#import "CNLivePlayerCache.h"  
17 #import "CommonCrypto/CommonDigest.h" 10 #import "CommonCrypto/CommonDigest.h"
18 //数据请求 11 //数据请求
19 #import "CNLivePlayerNetworkManager.h" 12 #import "CNLivePlayerNetworkManager.h"
20 -//常量  
21 -#import "CNLivePlayerConst.h"  
22 //工具 13 //工具
23 #import "CNLivePlayerTools.h" 14 #import "CNLivePlayerTools.h"
24 -  
25 //IM 15 //IM
26 #import <CNLiveMsgTools/CNLiveMsgManager.h> 16 #import <CNLiveMsgTools/CNLiveMsgManager.h>
27 17
@@ -186,6 +176,7 @@ NSString * const CNLiveAnchorStatusChangedNotification = @&quot;CNLiveAnchorStatusCha @@ -186,6 +176,7 @@ NSString * const CNLiveAnchorStatusChangedNotification = @&quot;CNLiveAnchorStatusCha
186 176
187 } 177 }
188 - (void)setPlayerWithContentId:(NSString *)contentId type:(CNLivePlayerType)type authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock{ 178 - (void)setPlayerWithContentId:(NSString *)contentId type:(CNLivePlayerType)type authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock{
  179 + _retryTime = 0;
189 _type = type; 180 _type = type;
190 switch (type) { 181 switch (type) {
191 case CNLivePlayerVod: 182 case CNLivePlayerVod:
@@ -643,7 +634,10 @@ NSString * const CNLiveAnchorStatusChangedNotification = @&quot;CNLiveAnchorStatusCha @@ -643,7 +634,10 @@ NSString * const CNLiveAnchorStatusChangedNotification = @&quot;CNLiveAnchorStatusCha
643 if (!_contentType || _contentType.length == 0) { 634 if (!_contentType || _contentType.length == 0) {
644 return; 635 return;
645 } 636 }
646 - _statTimer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(statTimerAction) userInfo:nil repeats:YES]; 637 + if(!_statTimer){
  638 + _statTimer = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(statTimerAction) userInfo:nil repeats:YES];
  639 +
  640 + }
647 641
648 } 642 }
649 643
Example/CNLivePlayer/CNLiveViewController.m
@@ -52,8 +52,6 @@ @@ -52,8 +52,6 @@
52 [self.view addSubview:btn]; 52 [self.view addSubview:btn];
53 53
54 54
55 -  
56 -  
57 // KSYMoviePlayerController *player = [[KSYMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]]; 55 // KSYMoviePlayerController *player = [[KSYMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]];
58 // player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0); 56 // player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0);
59 // player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 57 // player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
Example/Podfile
@@ -8,6 +8,5 @@ target &#39;CNLivePlayer_Example&#39; do @@ -8,6 +8,5 @@ target &#39;CNLivePlayer_Example&#39; do
8 target 'CNLivePlayer_Tests' do 8 target 'CNLivePlayer_Tests' do
9 inherit! :search_paths 9 inherit! :search_paths
10 10
11 -  
12 end 11 end
13 end 12 end