Commit d37f8203e08587b29ec3acde4373697d452db1fe
1 parent
d690c31f
no message
Showing
5 changed files
with
19 additions
and
17 deletions
CNLivePlayer.podspec
| ... | ... | @@ -29,8 +29,9 @@ TODO: Add long description of the pod here. |
| 29 | 29 | # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' |
| 30 | 30 | |
| 31 | 31 | s.ios.deployment_target = '9.0' |
| 32 | - | |
| 32 | + # s.public_header_files = 'Pod/Classes/**/*.h' | |
| 33 | 33 | # s.source_files = 'CNLivePlayer/Classes/**/*' |
| 34 | + | |
| 34 | 35 | s.subspec 'Player' do |ss| |
| 35 | 36 | ss.source_files = 'CNLivePlayer/Classes/Player/*.{h,m}' |
| 36 | 37 | end |
| ... | ... | @@ -49,9 +50,9 @@ TODO: Add long description of the pod here. |
| 49 | 50 | |
| 50 | 51 | s.static_framework = true |
| 51 | 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 | 56 | s.dependency 'libksygpulive/KSYGPUResource' |
| 56 | 57 | s.dependency 'libksygpulive/libksygpulive' |
| 57 | 58 | s.dependency 'ksyhttpcache' | ... | ... |
CNLivePlayer/Classes/Player/CNLivePlayer.h
| ... | ... | @@ -10,9 +10,19 @@ |
| 10 | 10 | #import <libksygpulive/KSYMoviePlayerController.h> |
| 11 | 11 | #import "KSYMoviePlayerDefines.h" |
| 12 | 12 | |
| 13 | +//缓存视频 | |
| 14 | +#import <KSYHTTPCache/KSYHTTPProxyService.h> | |
| 15 | +#import <KSYHTTPCache/HTTPCacheDefines.h> | |
| 16 | + | |
| 13 | 17 | // 播放器管理类 |
| 14 | 18 | #import "CNLivePlayerManager.h" |
| 15 | 19 | |
| 20 | +//缓存url | |
| 21 | +#import "CNLivePlayerCache.h" | |
| 22 | + | |
| 23 | +//常量 | |
| 24 | +#import "CNLivePlayerConst.h" | |
| 25 | + | |
| 16 | 26 | NS_ASSUME_NONNULL_BEGIN |
| 17 | 27 | typedef NS_ENUM(NSUInteger, CNLivePlayerType) { |
| 18 | 28 | CNLivePlayerVod, //点播 | ... | ... |
CNLivePlayer/Classes/Player/CNLivePlayer.m
| ... | ... | @@ -7,21 +7,11 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 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 | 10 | #import "CommonCrypto/CommonDigest.h" |
| 18 | 11 | //数据请求 |
| 19 | 12 | #import "CNLivePlayerNetworkManager.h" |
| 20 | -//常量 | |
| 21 | -#import "CNLivePlayerConst.h" | |
| 22 | 13 | //工具 |
| 23 | 14 | #import "CNLivePlayerTools.h" |
| 24 | - | |
| 25 | 15 | //IM |
| 26 | 16 | #import <CNLiveMsgTools/CNLiveMsgManager.h> |
| 27 | 17 | |
| ... | ... | @@ -186,6 +176,7 @@ NSString * const CNLiveAnchorStatusChangedNotification = @"CNLiveAnchorStatusCha |
| 186 | 176 | |
| 187 | 177 | } |
| 188 | 178 | - (void)setPlayerWithContentId:(NSString *)contentId type:(CNLivePlayerType)type authSuccess:(AuthSuccessBlock)authSuccessBlock authFailure:(AuthFailureBlock)authFailureBlock{ |
| 179 | + _retryTime = 0; | |
| 189 | 180 | _type = type; |
| 190 | 181 | switch (type) { |
| 191 | 182 | case CNLivePlayerVod: |
| ... | ... | @@ -643,7 +634,10 @@ NSString * const CNLiveAnchorStatusChangedNotification = @"CNLiveAnchorStatusCha |
| 643 | 634 | if (!_contentType || _contentType.length == 0) { |
| 644 | 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 | 52 | [self.view addSubview:btn]; |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - | |
| 56 | - | |
| 57 | 55 | // KSYMoviePlayerController *player = [[KSYMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://wideo02.cnlive.com/video/data1/2017/0423/206473/800/c8ff347048414b7295cef882f8361073_206473_800.m3u8"]]; |
| 58 | 56 | // player.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*9/16.0); |
| 59 | 57 | // player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; | ... | ... |