Commit 685befbf2a305d21663aa399a1772c5f639d5d4f

Authored by zhangxiaowen
1 parent bc74da45

no message

CNLiveScioLive.xcodeproj/project.pbxproj
... ... @@ -1699,22 +1699,22 @@
1699 1699 085D85FA2159C72F0037D480 /* Classes */ = {
1700 1700 isa = PBXGroup;
1701 1701 children = (
  1702 + 085D85FF2159C72F0037D480 /* ZXVideoPlayerController.h */,
  1703 + 085D86072159C72F0037D480 /* ZXVideoPlayerController.m */,
  1704 + 085D86002159C72F0037D480 /* ZXVideoPlayerControlView.h */,
  1705 + 085D86062159C72F0037D480 /* ZXVideoPlayerControlView.m */,
1702 1706 085D86942159C8110037D480 /* JGMusicManager.h */,
1703 1707 085D86932159C8100037D480 /* JGMusicManager.m */,
1704   - 085D85FB2159C72F0037D480 /* ZXVideo.m */,
1705   - 085D85FC2159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.h */,
1706 1708 085D85FD2159C72F0037D480 /* ZXVideoPlayerVolumeView.h */,
  1709 + 085D86042159C72F0037D480 /* ZXVideo.h */,
  1710 + 085D85FB2159C72F0037D480 /* ZXVideo.m */,
1707 1711 085D85FE2159C72F0037D480 /* ZXVideoPlayerBrightnessView.h */,
1708   - 085D85FF2159C72F0037D480 /* ZXVideoPlayerController.h */,
1709   - 085D86002159C72F0037D480 /* ZXVideoPlayerControlView.h */,
1710   - 085D86012159C72F0037D480 /* ZXVideoPlayerBatteryView.m */,
  1712 + 085D86052159C72F0037D480 /* ZXVideoPlayerBrightnessView.m */,
1711 1713 085D86022159C72F0037D480 /* ZXVideoPlayerVolumeView.m */,
  1714 + 085D85FC2159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.h */,
1712 1715 085D86032159C72F0037D480 /* ZXVideoPlayerTimeIndicatorView.m */,
1713   - 085D86042159C72F0037D480 /* ZXVideo.h */,
1714   - 085D86052159C72F0037D480 /* ZXVideoPlayerBrightnessView.m */,
1715   - 085D86062159C72F0037D480 /* ZXVideoPlayerControlView.m */,
1716   - 085D86072159C72F0037D480 /* ZXVideoPlayerController.m */,
1717 1716 085D86082159C72F0037D480 /* ZXVideoPlayerBatteryView.h */,
  1717 + 085D86012159C72F0037D480 /* ZXVideoPlayerBatteryView.m */,
1718 1718 );
1719 1719 path = Classes;
1720 1720 sourceTree = "<group>";
... ... @@ -1757,8 +1757,8 @@
1757 1757 085D86982159CBBB0037D480 /* CNLivePlayer */ = {
1758 1758 isa = PBXGroup;
1759 1759 children = (
1760   - 085D86992159CBBB0037D480 /* CNLivePlayerController.m */,
1761 1760 085D869A2159CBBB0037D480 /* CNLivePlayerController.h */,
  1761 + 085D86992159CBBB0037D480 /* CNLivePlayerController.m */,
1762 1762 );
1763 1763 path = CNLivePlayer;
1764 1764 sourceTree = "<group>";
... ...
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
... ... @@ -9,7 +9,7 @@
9 9 #import "GraphicLiveViewController.h"
10 10 #import "OldVideoDetailViewController.h"
11 11  
12   -@interface GraphicLiveViewController ()
  12 +@interface GraphicLiveViewController ()<CNLivePlayerControllerDelegate>
13 13 @end
14 14 @implementation GraphicLiveViewController
15 15 - (void)Pop:(id)sender{
... ... @@ -192,47 +192,49 @@
192 192  
193 193 - (void)shareButton:(UIButton *)btn{
194 194 NSString *text = [NSString stringWithFormat:@"%@",_dictionary[@"Description"]];
  195 + NSString *shareUrl = [NSString stringWithFormat:@"%@",_dictionary[@"shareUrl"]];
  196 +
195 197 if ([text isEqualToString:@"<null>"]) {
196 198 text = _dictionary[@"title"];
197 199 }
198 200 NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
199 201 [shareParams SSDKSetupShareParamsByText:text
200 202 images:nil
201   - url:[NSURL URLWithString:_dictionary[@"pageUrl"]]
  203 + url:[NSURL URLWithString:shareUrl?shareUrl:@"http://app.scio.gov.cn/gxbShare.html"]
202 204 title:_dictionary[@"title"]
203 205 type:SSDKContentTypeAuto];
204 206 //2、分享(可以弹出我们的分享菜单和编辑界面)
205   - [ShareSDK showShareActionSheet:nil //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响
206   - items:nil
207   - shareParams:shareParams
208   - onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
  207 + //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响
  208 + [ShareSDK showShareActionSheet:nil items:nil shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
209 209  
210   - switch (state) {
211   - case SSDKResponseStateSuccess:
212   - {
213   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess")
214   - message:nil
215   - delegate:nil
216   - cancelButtonTitle:CustomStr(@"Sure")
217   - otherButtonTitles:nil];
218   - [alertView show];
219   - break;
220   - }
221   - case SSDKResponseStateFail:
222   - {
223   - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure")
224   - message:[NSString stringWithFormat:@"%@",error]
225   - delegate:nil
226   - cancelButtonTitle:CustomStr(@"Sure")
227   - otherButtonTitles:nil, nil];
228   - [alert show];
229   - break;
230   - }
231   - default:
232   - break;
233   - }
234   - }
235   - ];
  210 + switch (state) {
  211 + case SSDKResponseStateSuccess:
  212 + {
  213 + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess")
  214 + message:nil
  215 + delegate:nil
  216 + cancelButtonTitle:CustomStr(@"Sure")
  217 + otherButtonTitles:nil];
  218 + [alertView show];
  219 + break;
  220 + }
  221 + case SSDKResponseStateFail:
  222 + {
  223 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure")
  224 + message:[NSString stringWithFormat:@"%@",error]
  225 + delegate:nil
  226 + cancelButtonTitle:CustomStr(@"Sure")
  227 + otherButtonTitles:nil, nil];
  228 + [alert show];
  229 + break;
  230 + }
  231 + default:
  232 + break;
  233 +
  234 + }
  235 +
  236 + }];
  237 +
236 238 }
237 239  
238 240 - (void)pausePlayer {
... ... @@ -253,15 +255,12 @@
253 255 [backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
254 256 [bgView addSubview:backButton];
255 257  
256   - //////////////// 分享 ////////////////
257 258 UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
258   - shareButton.backgroundColor = [UIColor redColor];
259   - [shareButton setFrame:CGRectMake(MainScreenWidth-40, StatusBarHeight+7, 30, 30)];
260   - [shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal];
261 259 [shareButton addTarget:self action:@selector(shareButton:) forControlEvents:UIControlEventTouchUpInside];
  260 + [shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal];
  261 + [shareButton setFrame:CGRectMake(MainScreenWidth-40, StatusBarHeight+7, 30, 30)];
262 262 [bgView addSubview:shareButton];
263   - ////////////////
264   -
  263 +
265 264 if (self.type == PlayerTypeLiving) {
266 265 // 直播
267 266 self.liveController = [[CNLivePlayerController alloc] initLivePlayWithChannelId:_dictionary[@"channelId"] activityId:_dictionary[@"activityId"] anchorStatus:YES authSuccess:^{
... ... @@ -273,6 +272,8 @@
273 272 } getAnchorStatusResult:^(BOOL result) {
274 273 NSLog(@"获取主播状态%d", result ? YES : NO);
275 274 }];
  275 + self.liveController.delegate = self;
  276 +
276 277 } else {
277 278 // 点播
278 279 self.liveController = [[CNLivePlayerController alloc] initVodPlayWithVId:_dictionary[@"playbackId"] authSuccess:^{
... ... @@ -282,6 +283,7 @@
282 283 } authFailed:^(NSDictionary *errorInfo) {
283 284 NSLog(@"初始化点播播放器失败%@", errorInfo);
284 285 }];
  286 + self.liveController.delegate = self;
285 287 }
286 288 [[NSUserDefaults standardUserDefaults] setObject:@0 forKey:@"ZXVideoPlayer_DidLockScreen"];
287 289 __weak typeof(self) weakSelf = self;
... ... @@ -298,6 +300,10 @@
298 300 self.liveController.video = video;
299 301 }
300 302  
  303 +- (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view{
  304 + [self shareButton:nil];
  305 +
  306 +}
301 307 - (void)backButtonAction:(UIButton *)sender {
302 308 [self.navigationController popViewControllerAnimated:YES];
303 309 }
... ...
CNLiveScioLive/Pages/Tools/CNLivePlayer/CNLivePlayerController.h
... ... @@ -12,8 +12,17 @@
12 12 #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)
13 13 #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0))
14 14  
  15 +@class CNLivePlayerController;
  16 +
  17 +@protocol CNLivePlayerControllerDelegate <NSObject>
  18 +- (void)shareButtonCNLivePlayerController:(CNLivePlayerController *)view;
  19 +
  20 +@end
  21 +
15 22 @interface CNLivePlayerController : CNLiveMoviePlayerController
16 23  
  24 +@property (nonatomic, weak) id<CNLivePlayerControllerDelegate> delegate;
  25 +
17 26 @property (nonatomic, assign) CGRect frame;
18 27 /// video model
19 28 @property (nonatomic, strong, readwrite) ZXVideo *video;
... ...
CNLiveScioLive/Pages/Tools/CNLivePlayer/CNLivePlayerController.m
No preview for this file type
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerControlView.h
... ... @@ -57,6 +57,8 @@
57 57 @property (nonatomic, strong, readwrite) UILabel *titleLabel;
58 58 /// 直播状态
59 59 @property (nonatomic, assign) int liveStatus;
  60 +///分享
  61 +@property (nonatomic, strong, readwrite) UIButton *shareButton;
60 62  
61 63 - (void)animateHide;
62 64 - (void)animateShow;
... ...
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerControlView.m
... ... @@ -74,6 +74,9 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0;
74 74 // 标题
75 75 [self.topBar addSubview:self.titleLabel];
76 76  
  77 + // 标题
  78 + [self.topBar addSubview:self.shareButton];
  79 +
77 80 UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTap:)];
78 81 [self addGestureRecognizer:tapGesture];
79 82  
... ... @@ -387,6 +390,16 @@ static const CGFloat kVideoControlBarAutoFadeOutTimeInterval = 5.0;
387 390 return _retryButton;
388 391 }
389 392  
  393 +- (UIButton *)shareButton {
  394 + if (!_shareButton) {
  395 + _shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
  396 + [_shareButton setFrame:CGRectMake(MainScreenWidth-40, 20, 30, 30)];
  397 + [_shareButton setImage:[UIImage imageNamed:@"cnlive_live_share"] forState:UIControlStateNormal];
  398 +
  399 + }
  400 + return _shareButton;
  401 +}
  402 +
390 403 #pragma mark - setter
391 404 - (void)setLiveStatus:(int)liveStatus {
392 405 _liveStatus = liveStatus;
... ...
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.h
... ... @@ -13,6 +13,7 @@
13 13 #define kZXVideoPlayerOriginalWidth MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)
14 14 #define kZXVideoPlayerOriginalHeight (kZXVideoPlayerOriginalWidth * (9.0 / 16.0))
15 15  
  16 +
16 17 @interface ZXVideoPlayerController : MPMoviePlayerController
17 18  
18 19 @property (nonatomic, assign) CGRect frame;
... ...
CNLiveScioLive/Pages/Tools/ZXVideoPlayer/Classes/ZXVideoPlayerController.m
No preview for this file type