| | |
| | | #import "GDTMobBannerView.h" |
| | | |
| | | //优酷播放器 |
| | | #import "YTEngineOpenViewManager.h" |
| | | #import "YYMediaPlayerEvents.h" |
| | | //#import "YTEngineOpenViewManager.h" |
| | | //#import "YYMediaPlayerEvents.h" |
| | | |
| | | //PPTV播放器导入 |
| | | #import "PPTVview.h" |
| | | #import <PPTVSdk/PPTVSdk.h> |
| | | //#import "PPTVview.h" |
| | | //#import <PPTVSdk/PPTVSdk.h> |
| | | |
| | | #import "LGLAlertView.h" |
| | | |
| | |
| | | #define BETWEEN_BOUND_FULL 100 |
| | | #define BETWEEN_BOUND_NORMAL 20 |
| | | |
| | | @interface XYRDetailViewController ()<CMuneBarDelegate,UIScrollViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,YYMediaPlayerEvents,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,YTHNetDelegateRecommend,UIGestureRecognizerDelegate,YTHBacktoApplicationsDelegate,GDTNativeAdDelegate,GDTMobBannerViewDelegate,HXEasyCustomShareViewDelegate>{ |
| | | @interface XYRDetailViewController ()<CMuneBarDelegate,UIScrollViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,YTHNetDelegateRecommend,UIGestureRecognizerDelegate,YTHBacktoApplicationsDelegate,GDTNativeAdDelegate,GDTMobBannerViewDelegate,HXEasyCustomShareViewDelegate>{ |
| | | int _gather;//集数加载更多的控制变量,默认为1 |
| | | int isCollectNum;//当前选中的集 |
| | | |
| | |
| | | @property (weak, nonatomic) IBOutlet UIButton *playBtn;//播放按钮 |
| | | |
| | | @property (weak, nonatomic) IBOutlet UIButton *backBtn;//详情页面的返回按钮 |
| | | @property (weak, nonatomic) IBOutlet UIImageView *image;//顶部视频图片 |
| | | @property (weak, nonatomic) IBOutlet YYAnimatedImageView *image;//顶部视频图片 |
| | | @property (weak, nonatomic) IBOutlet UILabel *detailTitle;//顶部的标题 |
| | | @property (weak, nonatomic) IBOutlet UILabel *detailTitleBackgroundColor;//顶部标题背景 |
| | | @property (weak, nonatomic) IBOutlet UIButton *backgroundButton;//覆盖在头图片的Button,响应播放事件 |
| | |
| | | @property (nonatomic,strong) NSArray *PeopleSeeVideo;//获取到的大家都在看的数据 |
| | | |
| | | //优酷的三个属性: |
| | | @property (nonatomic, retain) YTEngineOpenViewManager *viewManager; |
| | | @property (nonatomic, strong) YYMediaPlayer *cloudPlayer; |
| | | //@property (nonatomic, retain) YTEngineOpenViewManager *viewManager; |
| | | //@property (nonatomic, strong) YYMediaPlayer *cloudPlayer; |
| | | @property (nonatomic, retain) UIButton *backButton; |
| | | @property (nonatomic, retain) UITextView *textView; |
| | | @property (nonatomic, assign) BOOL YKloadSuccess; //优酷创建成功 |
| | | |
| | | //PPTV |
| | | @property (nonatomic, strong) PPTVview *pptvview; |
| | | //@property (nonatomic, strong) PPTVview *pptvview; |
| | | @property (nonatomic, assign) BOOL isPPTVSuccess; //PPTV创建成功 |
| | | @property (nonatomic, strong) UIButton *collectionbt; //外部收藏按钮 |
| | | @property (nonatomic, strong) NSString *showurl; //PPTV来源 |
| | |
| | | @end |
| | | |
| | | @implementation XYRDetailViewController |
| | | @synthesize player = _player; |
| | | //@synthesize player = _player; |
| | | @synthesize islocal; |
| | | @synthesize videoItem; |
| | | |
| | |
| | | ApplicationDelegate.YNetdelegateRecommend = self; |
| | | //实现出去应用或者回到应用的处理 |
| | | ApplicationDelegate.YBackAppDelegate = self; |
| | | if (KIsiPhoneX) { |
| | | // self.topLayout.constant = 20; |
| | | self.backLayout.constant = 39; |
| | | }else{ |
| | | // self.topLayout.constant = 0; |
| | | self.backLayout.constant = 19; |
| | | |
| | | } |
| | | //加载基础数据 |
| | | [self loadData]; |
| | | //视频名称背景色 |
| | |
| | | */ |
| | | - (IBAction)backToMainViewController:(id)sender { |
| | | [self backToRootView]; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | * @param sender 收藏按钮 |
| | | */ |
| | | - (void)ClickCollection:(UIButton *)sender { |
| | | if (sender.isSelected) { |
| | | [sender setSelected:NO]; |
| | | [[YTHNetInterface startInterface] getScoreCollectWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType WithType:@"0" withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | | if([self.NewResource intValue]==16){ |
| | | [_pptvview SuccessCollection:NO]; //通知PPTV播放器收藏 |
| | | if([[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"]){ |
| | | if (sender.isSelected) { |
| | | [sender setSelected:NO]; |
| | | [[YTHNetInterface startInterface] getScoreCollectWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType WithType:@"0" withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | | if([self.NewResource intValue]==16){ |
| | | // [_pptvview SuccessCollection:NO]; //通知PPTV播放器收藏 |
| | | } |
| | | }else{//取消收藏失败 |
| | | [sender setSelected:YES]; |
| | | } |
| | | }else{//取消收藏失败 |
| | | [sender setSelected:YES]; |
| | | } |
| | | }]; |
| | | }]; |
| | | }else{ |
| | | [sender setSelected:YES]; |
| | | [[YTHNetInterface startInterface] getScoreCollectWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType WithType:@"1" withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | | if([self.NewResource intValue]==16){ |
| | | // [_pptvview SuccessCollection:YES]; //通知PPTV播放器收藏 |
| | | } |
| | | }else{//收藏失败 |
| | | [sender setSelected:NO]; |
| | | } |
| | | }]; |
| | | } |
| | | }else{ |
| | | [sender setSelected:YES]; |
| | | [[YTHNetInterface startInterface] getScoreCollectWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType WithType:@"1" withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | | if([self.NewResource intValue]==16){ |
| | | [_pptvview SuccessCollection:YES]; //通知PPTV播放器收藏 |
| | | } |
| | | }else{//收藏失败 |
| | | [sender setSelected:NO]; |
| | | } |
| | | //未登录,引导用户登录 |
| | | LoggingViewController *loginVC=[[LoggingViewController alloc] init]; |
| | | loginVC.ispresent=YES; |
| | | [self presentViewController:loginVC animated:YES completion:^{ |
| | | |
| | | }]; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | NSMutableArray *arr=[[NSMutableArray alloc] initWithCapacity:(_DetailModel.Data.ResourceList.count+5)]; |
| | | NSArray *ResourceList=[[NSMutableArray alloc] initWithArray:_DetailModel.Data.ResourceList]; |
| | | for (int i=0; i<_DetailModel.Data.ResourceList.count; i++) { |
| | | arr[i]=[ResourceList[i] objectForKey:@"Name"]; |
| | | arr[i]=[ResourceList[i] objectForKey:@"Picture"]; |
| | | if ([[ResourceList[i] objectForKey:@"Checked"] intValue]==1) { |
| | | self.NewResource=[ResourceList[i] objectForKey:@"Id"]; |
| | | //交换数组元素,让默认的播放源放在第一个 |
| | |
| | | [_MuneBar setUserInteractionEnabled:YES]; |
| | | _MuneBar.delegate = self; |
| | | _MuneBar.center = CGPointMake(((KScreenW/3)-80)/2, 22); |
| | | |
| | | [self.collectionView bringSubviewToFront:_MuneBar]; |
| | | // [self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]]; |
| | | [self.collectionView reloadData]; |
| | | |
| | |
| | | } |
| | | //默认网络情况 |
| | | - (void)NetWorkStuas{ |
| | | |
| | | switch ([YTHsharedManger startManger].NetworkStatus) { |
| | | case 0:{//当前网络不可用 |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"message:@"当前网络不可用,是否连接网络?"preferredStyle:UIAlertControllerStyleAlert]; |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"message:@"当前网络不可用,是否使用连接网络?"preferredStyle:UIAlertControllerStyleAlert]; |
| | | //取消 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { |
| | | [self backToRootView]; |
| | |
| | | }]; |
| | | }]]; |
| | | //去连接网络 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接免费网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] ]; |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | |
| | | } |
| | | break; |
| | | case 1:{//移动网络 |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"警告"message:@"当前网络为付费网络!"preferredStyle:UIAlertControllerStyleAlert]; |
| | | static BOOL isFirst = YES; |
| | | if (!isFirst) { |
| | | return; |
| | | }else{ |
| | | isFirst = NO; |
| | | } |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示"message:@"您目前没有连接WIFi,是否使用流量继续观看" preferredStyle:UIAlertControllerStyleAlert]; |
| | | //继续观看 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"继续观看" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"继续" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | | }]]; |
| | | //去连接网络 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接免费网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | |
| | | }]]; |
| | | [self presentViewController:alert animated:YES completion:^{ |
| | | |
| | |
| | | - (UIInterfaceOrientationMask)supportedInterfaceOrientations |
| | | #endif |
| | | { |
| | | if(_isPPTVSuccess){ //如果是PPTV 播放 返回可旋转 |
| | | if(_pptvview.playoptions.isHalfScreen){ |
| | | return UIInterfaceOrientationMaskLandscape; |
| | | }else{ |
| | | return UIInterfaceOrientationMaskPortrait; |
| | | } |
| | | } |
| | | // if(_isPPTVSuccess){ //如果是PPTV 播放 返回可旋转 |
| | | // if(_pptvview.playoptions.isHalfScreen){ |
| | | // return UIInterfaceOrientationMaskLandscape; |
| | | // }else{ |
| | | // return UIInterfaceOrientationMaskPortrait; |
| | | // } |
| | | // } |
| | | if (self.YKloadSuccess==YES) { //如果加载了优酷播放器 |
| | | return UIInterfaceOrientationMaskAllButUpsideDown; |
| | | } |
| | |
| | | [Share shareAPP:self]; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 点击关注或取消关注 |
| | | */ |
| | |
| | | NSDate *date = [NSDate date]; |
| | | NSTimeInterval seconds = [date timeIntervalSinceDate:self.startTime]; |
| | | NSLog(@"%f",seconds); |
| | | if (seconds < 1.5) { |
| | | static BOOL bor = NO; |
| | | if (seconds < 1.5 && bor) { |
| | | bor = YES; |
| | | return; |
| | | } |
| | | self.startTime = date; |
| | |
| | | } |
| | | } |
| | | |
| | | /********************PPTV**************************/ |
| | | |
| | | -(void)playPPTV:(NSString*)urlstring{ |
| | | [self PPTVclear]; |
| | | NSString *qudao = @"2462"; //渠道号 |
| | | NSInteger sdkType = 0; |
| | | sdkType |= DLNA_DMC; //sdk内部播放器 |
| | | NSString *parmString = [NSString stringWithFormat:@"tunnel=%@&sdkType=%zd",qudao,sdkType]; |
| | | _isPPTVSuccess = [[PPTVSdk sharedPPTVSdk] initializeWithUrl:nil params:parmString logPath:nil]; |
| | | //进行初始化 返回值是否成功 |
| | | if(_isPPTVSuccess){ |
| | | [SVProgressHUD show]; |
| | | _pptvview = [[PPTVview alloc]init]; |
| | | _pptvview.viewcontroller = self; |
| | | _pptvview.Brightness = [UIScreen mainScreen].brightness; |
| | | NSInteger sdkType = 0; |
| | | sdkType |= DLNA_DMC; //sdk内部播放器 |
| | | //播放器内部片源类型 |
| | | int VedioType; |
| | | if(self.DetailModel.Data.ShowType==1){//综艺 |
| | | VedioType = 1; |
| | | }else{//非综艺 |
| | | VedioType = 2; |
| | | } |
| | | //是否收藏 |
| | | BOOL Iscollection; |
| | | if(_collectionbt.isSelected){ |
| | | Iscollection = YES; |
| | | }else{ |
| | | Iscollection = NO; |
| | | } |
| | | //隐藏控件 |
| | | [_image bringSubviewToFront:self.view]; |
| | | _image.userInteractionEnabled = YES; |
| | | _backBtn.tag = 113; |
| | | [_pptvview initWithSid:nil WithUrl:urlstring WithVid:nil WithHisPlayTime:0 WithPlayerType:PLAYER_TYPE_VOD WithViewController:self WithFatherView:self.view WithFatherFrameView:_image WithTitleStr:_Model.Name WihtChosSet:isCollectNum-1 WithDataArray:_VideoDetailList WithType:VedioType WithIsCllection:Iscollection WithImage:self.image.image WithShowUrl:_showurl]; |
| | | __weak typeof (self) selfweak = self; |
| | | |
| | | _pptvview.clearpptv = ^(){ |
| | | selfweak.isPPTVSuccess = NO; |
| | | selfweak.image.userInteractionEnabled = NO; |
| | | selfweak.backgroundButton.hidden = NO; |
| | | selfweak.detailTitle.hidden = NO; |
| | | }; |
| | | _pptvview.next = ^(){ |
| | | if (selfweak.DetailModel.Data.ShowType==1) { //是综艺 |
| | | if (selfweak.VideoDetailList.count>6*_gather && isCollectNum > 6*_gather) { |
| | | _gather++; |
| | | // [selfweak.collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]]; |
| | | [self.collectionView reloadData]; |
| | | |
| | | } |
| | | }else{ //不是综艺 |
| | | if (selfweak.VideoDetailList.count>10*_gather && isCollectNum >= 10*_gather) { |
| | | _gather++; |
| | | // [selfweak.collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]]; |
| | | [self.collectionView reloadData]; |
| | | |
| | | } |
| | | } |
| | | if(isCollectNum < selfweak.VideoDetailList.count){ |
| | | isCollectNum += 1; |
| | | NSArray *arr = [selfweak.collectionView indexPathsForVisibleItems]; |
| | | NSIndexPath * targetIndex; |
| | | NSIndexPath * lastIndex; |
| | | |
| | | for( int i = 0 ; i < arr.count ; ++i){ |
| | | NSIndexPath * temp = arr[i]; |
| | | if(isCollectNum-1 == temp.row ){ |
| | | targetIndex = temp; |
| | | }else if(isCollectNum -2 == temp.row){ |
| | | lastIndex = temp; |
| | | } |
| | | } |
| | | // [selfweak.collectionView reloadItemsAtIndexPaths:@[targetIndex,lastIndex]]; |
| | | [_collectionView reloadData]; |
| | | |
| | | [selfweak PPTVplay:[NSString stringWithFormat:@"%d",isCollectNum-1] WithBoolInit:selfweak.isPPTVSuccess]; |
| | | } |
| | | return isCollectNum-1; |
| | | }; |
| | | |
| | | _pptvview.Collectioning = ^(){ //全屏收藏点击 |
| | | [selfweak ClickCollection:selfweak.collectionbt]; |
| | | }; |
| | | |
| | | _pptvview.rload = ^(){ |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | [selfweak.collectionView reloadData]; |
| | | }); |
| | | }; |
| | | |
| | | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selfchose:) name:@"selfchose" object:nil]; |
| | | |
| | | [_pptvview initPlayInfo]; |
| | | } |
| | | |
| | | //控件隐藏处理 |
| | | _backgroundButton.hidden = YES; |
| | | _detailTitle.hidden = YES; |
| | | _backBtn.hidden = NO; |
| | | [_backBtn bringSubviewToFront:self.view]; |
| | | _playBtn.hidden = YES; |
| | | } |
| | | |
| | | -(void)selfchose:(NSNotification*)notification{ |
| | | NSDictionary* num = [notification userInfo]; |
| | | isCollectNum = ((NSNumber*)[num objectForKey:@"index"]).intValue +1; |
| | |
| | | } |
| | | |
| | | //在已有的PPTV播放器进行播放 |
| | | -(void)playPPTVSecend:(NSString*)urlstring{ |
| | | [SVProgressHUD show]; |
| | | [_pptvview playvedio:urlstring]; |
| | | [_pptvview.playoptions.collection OtherChose:isCollectNum-1]; //播放器内部显示同步 |
| | | } |
| | | //-(void)playPPTVSecend:(NSString*)urlstring{ |
| | | // [SVProgressHUD show]; |
| | | // [_pptvview playvedio:urlstring]; |
| | | // [_pptvview.playoptions.collection OtherChose:isCollectNum-1]; //播放器内部显示同步 |
| | | //} |
| | | |
| | | |
| | | //PPTV退出亲清除 |
| | | -(void)PPTVclear{ |
| | | if(!_pptvview){ |
| | | return ; |
| | | } |
| | | [_pptvview clear]; |
| | | } |
| | | ////PPTV退出亲清除 |
| | | //-(void)PPTVclear{ |
| | | // if(!_pptvview){ |
| | | // return ; |
| | | // } |
| | | // [_pptvview clear]; |
| | | //} |
| | | |
| | | |
| | | //PPTV获取数据 |
| | |
| | | |
| | | //加载PPTV播放器 |
| | | if(!BL){ //没有被初始化过 |
| | | [self playPPTV:urlstring]; |
| | | // [self playPPTV:urlstring]; |
| | | }else{ |
| | | [self playPPTVSecend:urlstring]; |
| | | // [self playPPTVSecend:urlstring]; |
| | | } |
| | | }else{ |
| | | NSLog(@"获取视频播放链接失败%@",error); |
| | |
| | | [SVProgressHUD showWithStatus:@"精彩,马上就来!"]; |
| | | [_playBtn setEnabled:NO]; |
| | | [_backgroundButton setEnabled:NO]; |
| | | Videodetaillist *lst=self.VideoDetailList[[IDS intValue]]; |
| | | Videodetaillist *lst; |
| | | if ([IDS intValue] <= self.VideoDetailList.count) { |
| | | lst=self.VideoDetailList[[IDS intValue]]; |
| | | } |
| | | [[YTHNetInterface startInterface] getparseVideoUrlWithUid:[YTHsharedManger startManger].Uid WithId:[(NSDictionary *)lst objectForKey:@"Id"] WithVideoId:self.DetailModel.Data.Id WithSystem:@"1" WithType:[(NSDictionary *)lst objectForKey:@"Type"] WithResourceId:_NewResource WithEID:nil withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | | NSLog(@"获取视频播放链接成功"); |
| | |
| | | [_backgroundButton setEnabled:YES]; |
| | | if([_NewResource intValue]==15){ |
| | | //加载优酷播放器 |
| | | [self loadYKPlayer:urlstring]; |
| | | // [self loadYKPlayer:urlstring]; |
| | | } |
| | | }else{//站外播放 |
| | | NSString *urlstring=[[dictionaryDta objectForKey:@"Data"] objectForKey:@"Url"]; |
| | |
| | | * |
| | | * @param urlstring 播放地址 |
| | | */ |
| | | -(void)loadYKPlayer:(NSString *)urlstring{ |
| | | if(_cloudPlayer==nil){ |
| | | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; |
| | | |
| | | _cloudPlayer = [[YYMediaPlayer alloc] init]; |
| | | _cloudPlayer.controller = self; |
| | | _cloudPlayer.view.clipsToBounds = YES; |
| | | _cloudPlayer.fullscreen = NO; |
| | | _cloudPlayer.platform = @"youku"; |
| | | |
| | | CGSize size = self.view.bounds.size; |
| | | |
| | | CGFloat width = 0.f; |
| | | if (DEVICE_TYPE_IPAD) { |
| | | width = 681.f; |
| | | } else { |
| | | width = KScreenWp; |
| | | } |
| | | |
| | | CGFloat height = width * 9.0f / 16.0f; |
| | | _cloudPlayer.view.frame = CGRectMake(0, 0, width, height); |
| | | |
| | | _playerFrame = CGRectMake(0, 20, size.width, size.height - 20); |
| | | _cloudPlayerFrame = _cloudPlayer.view.frame; |
| | | |
| | | //竖屏时露出状态栏 |
| | | if ([[UIDevice currentDevice].systemVersion floatValue] >= 7){ |
| | | CGRect bounds = self.view.frame; |
| | | self.view.bounds = bounds; |
| | | } |
| | | |
| | | self.MarkToTop.constant=8.0f; |
| | | [self.view addSubview:_cloudPlayer.view]; |
| | | |
| | | [self initViews]; |
| | | |
| | | [_cloudPlayer addEventsObserver:self]; |
| | | |
| | | _cloudPlayer.clientId = YKCLIENTId; |
| | | _cloudPlayer.clientSecret = YKCLIENTSECRET; |
| | | |
| | | // 初始化播放器界面管理器 |
| | | _viewManager = [[YTEngineOpenViewManager alloc] initWithPlayer:_cloudPlayer]; |
| | | [_cloudPlayer addEventsObserver:_viewManager]; |
| | | [self.view bringSubviewToFront:self.backBtn]; |
| | | self.YKloadSuccess=YES; |
| | | } |
| | | if (!islocal) { |
| | | [_cloudPlayer playVid:urlstring quality:kYYVideoQualityFLV password:nil from:0]; |
| | | } else { |
| | | if (self.videoItem) { |
| | | [_cloudPlayer playVideo:(id<YYMediaPlayerItem>)self.videoItem quality:kYYVideoQualityFLV from:0 oldEncrypt:NO]; |
| | | } |
| | | } |
| | | } |
| | | //-(void)loadYKPlayer:(NSString *)urlstring{ |
| | | // if(_cloudPlayer==nil){ |
| | | // [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; |
| | | // |
| | | // _cloudPlayer = [[YYMediaPlayer alloc] init]; |
| | | // _cloudPlayer.controller = self; |
| | | // _cloudPlayer.view.clipsToBounds = YES; |
| | | // _cloudPlayer.fullscreen = NO; |
| | | // _cloudPlayer.platform = @"youku"; |
| | | // |
| | | // CGSize size = self.view.bounds.size; |
| | | // |
| | | // CGFloat width = 0.f; |
| | | // if (DEVICE_TYPE_IPAD) { |
| | | // width = 681.f; |
| | | // } else { |
| | | // width = KScreenWp; |
| | | // } |
| | | // |
| | | // CGFloat height = width * 9.0f / 16.0f; |
| | | // _cloudPlayer.view.frame = CGRectMake(0, 0, width, height); |
| | | // |
| | | // _playerFrame = CGRectMake(0, 20, size.width, size.height - 20); |
| | | // _cloudPlayerFrame = _cloudPlayer.view.frame; |
| | | // |
| | | // //竖屏时露出状态栏 |
| | | // if ([[UIDevice currentDevice].systemVersion floatValue] >= 7){ |
| | | // CGRect bounds = self.view.frame; |
| | | // self.view.bounds = bounds; |
| | | // } |
| | | // |
| | | // self.MarkToTop.constant=8.0f; |
| | | // [self.view addSubview:_cloudPlayer.view]; |
| | | // |
| | | // [self initViews]; |
| | | // |
| | | // [_cloudPlayer addEventsObserver:self]; |
| | | // |
| | | // _cloudPlayer.clientId = YKCLIENTId; |
| | | // _cloudPlayer.clientSecret = YKCLIENTSECRET; |
| | | // |
| | | // // 初始化播放器界面管理器 |
| | | // _viewManager = [[YTEngineOpenViewManager alloc] initWithPlayer:_cloudPlayer]; |
| | | // [_cloudPlayer addEventsObserver:_viewManager]; |
| | | // [self.view bringSubviewToFront:self.backBtn]; |
| | | // self.YKloadSuccess=YES; |
| | | // } |
| | | // if (!islocal) { |
| | | // [_cloudPlayer playVid:urlstring quality:kYYVideoQualityFLV password:nil from:0]; |
| | | // } else { |
| | | // if (self.videoItem) { |
| | | // [_cloudPlayer playVideo:(id<YYMediaPlayerItem>)self.videoItem quality:kYYVideoQualityFLV from:0 oldEncrypt:NO]; |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | - (void)layout:(BOOL)fullscreen{ |
| | | CGFloat backHeight = _backButton.bounds.size.height; |
| | | CGFloat y = 0; |
| | | |
| | | if (!fullscreen) { |
| | | _cloudPlayer.view.frame = _cloudPlayerFrame; |
| | | // _cloudPlayer.view.frame = _cloudPlayerFrame; |
| | | y = (44 - backHeight) / 2; |
| | | _backButton.frame = CGRectMake(MARGIN, y , BACK_WIDTH, backHeight); |
| | | } else { |
| | | _cloudPlayer.view.frame = self.view.frame; |
| | | // _cloudPlayer.view.frame = self.view.frame; |
| | | y = (30 - backHeight) / 2 + 20; |
| | | _backButton.frame = CGRectMake(MARGIN, y, BACK_WIDTH, _backButton.bounds.size.height); |
| | | } |
| | | _textView.frame = CGRectMake(_cloudPlayer.view.center.x - TEXTVIEW_WIDTH/2, _cloudPlayer.view.center.y - TEXTVIEW_HEIGHT/2, TEXTVIEW_WIDTH, TEXTVIEW_HEIGHT); |
| | | // _textView.frame = CGRectMake(_cloudPlayer.view.center.x - TEXTVIEW_WIDTH/2, _cloudPlayer.view.center.y - TEXTVIEW_HEIGHT/2, TEXTVIEW_WIDTH, TEXTVIEW_HEIGHT); |
| | | } |
| | | |
| | | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orien{ |
| | |
| | | _textView.font = [UIFont systemFontOfSize:TEXTVIEW_FONT]; |
| | | _textView.editable = NO; |
| | | _textView.userInteractionEnabled = NO; |
| | | _textView.frame = CGRectMake(_cloudPlayer.view.center.x - TEXTVIEW_WIDTH/2,_cloudPlayer.view.center.y - TEXTVIEW_HEIGHT/2, TEXTVIEW_WIDTH, TEXTVIEW_HEIGHT); |
| | | // _textView.frame = CGRectMake(_cloudPlayer.view.center.x - TEXTVIEW_WIDTH/2,_cloudPlayer.view.center.y - TEXTVIEW_HEIGHT/2, TEXTVIEW_WIDTH, TEXTVIEW_HEIGHT); |
| | | [_textView setTextAlignment:NSTextAlignmentCenter]; |
| | | [_cloudPlayer.view addSubview:_textView]; |
| | | // [_cloudPlayer.view addSubview:_textView]; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!DEVICE_TYPE_IPAD) { |
| | | if (orien == UIInterfaceOrientationPortrait && |
| | | self.interfaceOrientation != orien) { |
| | | [_cloudPlayer setFullscreen:NO]; |
| | | // [_cloudPlayer setFullscreen:NO]; |
| | | } else if (UIInterfaceOrientationIsLandscape(orien)) { |
| | | UIInterfaceOrientation corien = self.interfaceOrientation; |
| | | if (!UIInterfaceOrientationIsLandscape(corien)) { |
| | | [_cloudPlayer setFullscreen:YES]; |
| | | // [_cloudPlayer setFullscreen:YES]; |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 优酷播放器方法 |
| | | */ |
| | | - (void)endPlayCode:(YYErrorCode)err{ |
| | | NSString *tip; |
| | | switch (err) { |
| | | case YYPlayCompleted: |
| | | tip = @"该视频已播放完成,点击重新播放"; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYPlayCanceled: |
| | | break; |
| | | case YYErrorClientFormat: |
| | | tip = [NSString stringWithFormat:@"client参数格式错误,错误码:%ld", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYErrorInvalidClient: |
| | | tip = [NSString stringWithFormat:@"client无效或sdk版本过低,错误码:%ld", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYErrorPermissionDeny: |
| | | tip = [NSString stringWithFormat:@"视频无权限播放,错误码:%ld", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYErrorInitOpenView: |
| | | tip = [NSString stringWithFormat:@"初始化界面无效,错误码:%ld", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYDataSourceError: |
| | | tip = [NSString stringWithFormat:@"媒体文件错误,错误码:%ld", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | case YYNetworkError: |
| | | tip = [NSString stringWithFormat:@"网络连接超时,错误码:%ld, 点击重试", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | default: |
| | | tip = [NSString stringWithFormat:@"播放发生错误,错误码:%ld, 点击重试", (long)err]; |
| | | _textView.text = tip; |
| | | break; |
| | | } |
| | | } |
| | | //- (void)endPlayCode:(YYErrorCode)err{ |
| | | // NSString *tip; |
| | | // switch (err) { |
| | | // case YYPlayCompleted: |
| | | // tip = @"该视频已播放完成,点击重新播放"; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYPlayCanceled: |
| | | // break; |
| | | // case YYErrorClientFormat: |
| | | // tip = [NSString stringWithFormat:@"client参数格式错误,错误码:%ld", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYErrorInvalidClient: |
| | | // tip = [NSString stringWithFormat:@"client无效或sdk版本过低,错误码:%ld", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYErrorPermissionDeny: |
| | | // tip = [NSString stringWithFormat:@"视频无权限播放,错误码:%ld", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYErrorInitOpenView: |
| | | // tip = [NSString stringWithFormat:@"初始化界面无效,错误码:%ld", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYDataSourceError: |
| | | // tip = [NSString stringWithFormat:@"媒体文件错误,错误码:%ld", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // case YYNetworkError: |
| | | // tip = [NSString stringWithFormat:@"网络连接超时,错误码:%ld, 点击重试", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // default: |
| | | // tip = [NSString stringWithFormat:@"播放发生错误,错误码:%ld, 点击重试", (long)err]; |
| | | // _textView.text = tip; |
| | | // break; |
| | | // } |
| | | //} |
| | | /** |
| | | * 优酷播放器方法 |
| | | */ |
| | | - (void)startPlay { |
| | | if (_viewManager) { |
| | | _textView.hidden = YES; |
| | | } |
| | | } |
| | | //- (void)startPlay { |
| | | // if (_viewManager) { |
| | | // _textView.hidden = YES; |
| | | // } |
| | | //} |
| | | |
| | | - (void)setNewOrientation:(BOOL)fullscreen |
| | | { |
| | |
| | | * 退出详情页面的方法 |
| | | */ |
| | | -(void)backToRootView{ |
| | | if(_isPPTVSuccess){ |
| | | if(_pptvview.playoptions.isHalfScreen){ |
| | | [_pptvview FullScreen]; |
| | | return; |
| | | } |
| | | [self PPTVclear]; |
| | | } |
| | | |
| | | // if(_isPPTVSuccess){ |
| | | // if(_pptvview.playoptions.isHalfScreen){ |
| | | // [_pptvview FullScreen]; |
| | | // return; |
| | | // } |
| | | // [self PPTVclear]; |
| | | // } |
| | | // |
| | | [SVProgressHUD dismiss]; |
| | | [self.player removeEventsObserver:_viewManager]; |
| | | [self dismissViewControllerAnimated:YES completion:^{ |
| | | [self.player stop]; |
| | | [self.player deinit]; |
| | | }]; |
| | | self.collectionView.delegate = nil; |
| | | self.collectionView.dataSource = nil; |
| | | [self.collectionView removeFromSuperview]; |
| | | self.collectionView = nil; |
| | | _nativeAd.controller = nil; |
| | | _nativeAd.delegate = nil; |
| | | // [self.player removeEventsObserver:_viewManager]; |
| | | [self dismissViewControllerAnimated:YES completion:nil]; |
| | | //显示状态栏 |
| | | [[UIApplication sharedApplication] setStatusBarHidden:NO]; |
| | | } |
| | |
| | | //提示数据加载 |
| | | [SVProgressHUD showWithStatus:@"加载中"]; |
| | | [[YTHNetInterface startInterface] getVoideoDetailWithUid:[YTHsharedManger startManger].Uid withLoginUid:[[NSUserDefaults standardUserDefaults] objectForKey:@"LoginUid"] withId:movieid withThirdType:thirdtype withSystem:@"1" WithResourceId:resourceId withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | NSLog(@"%@",result); |
| | | if (isSuccessful) { |
| | | //瀑布流滑动到顶部 |
| | | [self.collectionView setContentOffset:CGPointMake(0, 0) animated:YES]; |
| | |
| | | _VideoDetailList=self.DetailModel.Data.VideoDetailList; |
| | | //计算cell的大小 |
| | | [self CalculateHeightWithArray:_VideoDetailList]; |
| | | //加载视频源 |
| | | [self loadResourceItem]; |
| | | |
| | | //加载广告 |
| | | [self loadAd]; |
| | | //加载相关视频 |
| | |
| | | [self getPeopleSeeVideowithVideoId:movieid]; |
| | | //加载评论视图 |
| | | [self reloadCommentView]; |
| | | //加载视频源 |
| | | [self loadResourceItem]; |
| | | //数据加载成功 |
| | | [SVProgressHUD dismiss]; |
| | | }else{ |
| | | NSLog(@"%@",error); |
| | | //提示用户错误 |
| | | [SVProgressHUD showErrorWithStatus:@"加载失败!"]; |
| | | [SVProgressHUD dismiss]; |
| | | |
| | | // [SVProgressHUD showErrorWithStatus:@"加载失败!"]; |
| | | |
| | | } |
| | | }]; |
| | |
| | | -(void)SourcesSwitching:(NSInteger)index{ |
| | | [SVProgressHUD showWithStatus:@"视频源切换中"]; |
| | | if(_isPPTVSuccess){ |
| | | [self PPTVclear]; |
| | | // [self PPTVclear]; |
| | | } |
| | | [[YTHNetInterface startInterface] getVoideoDetailWithUid:[YTHsharedManger startManger].Uid withLoginUid:[[NSUserDefaults standardUserDefaults] objectForKey:@"LoginUid"] withId:self.Model.Id withThirdType:self.Model.ThirdType withSystem:@"1" WithResourceId:_NewResource withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | if (isSuccessful) { |
| | |
| | | |
| | | //需要考虑到正在播放优酷视屏时,如果切换爱奇艺的情况 |
| | | if([_NewResource intValue]!=15){ |
| | | [self.player.view removeFromSuperview]; |
| | | [self.player removeEventsObserver:_viewManager]; |
| | | [self.player stop]; |
| | | [self.player deinit]; |
| | | // [self.player.view removeFromSuperview]; |
| | | // [self.player removeEventsObserver:_viewManager]; |
| | | // [self.player stop]; |
| | | // [self.player deinit]; |
| | | |
| | | //取消隐藏playBtn |
| | | [_playBtn setHidden:NO]; |
| | |
| | | * 联网检查是否收藏 |
| | | */ |
| | | -(void)checkWhetherCollection{ |
| | | [[YTHNetInterface startInterface] getIsCollectedWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | UIButton *B1=[self.view viewWithTag:321]; |
| | | if (isSuccessful) { |
| | | [B1 setSelected:YES]; |
| | | }else{ |
| | | [B1 setSelected:NO]; |
| | | } |
| | | }]; |
| | | // if([[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"]){ |
| | | [[YTHNetInterface startInterface] getIsCollectedWithUid:[YTHsharedManger startManger].Uid withId:self.Model.Id withThirdType:self.Model.ThirdType withSystem:@"1" withBlock:^(BOOL isSuccessful, id result, NSString *error) { |
| | | UIButton *B1=[self.view viewWithTag:321]; |
| | | if (isSuccessful) { |
| | | [B1 setSelected:YES]; |
| | | }else{ |
| | | [B1 setSelected:NO]; |
| | | } |
| | | }]; |
| | | // } |
| | | } |
| | | |
| | | //用于计算选集cell的大小 |
| | |
| | | //如果用户未登录 |
| | | LoggingViewController *loginVC=[[LoggingViewController alloc] init]; |
| | | loginVC.ispresent=YES; |
| | | [self presentViewController:loginVC animated:YES completion:^{ |
| | | |
| | | }]; |
| | | [self presentViewController:loginVC animated:YES completion:nil]; |
| | | } |
| | | } |
| | | |
| | |
| | | //如果用户未登录 |
| | | LoggingViewController *loginVC=[[LoggingViewController alloc] init]; |
| | | loginVC.ispresent=YES; |
| | | [self presentViewController:loginVC animated:YES completion:^{ |
| | | |
| | | }]; |
| | | [self presentViewController:loginVC animated:YES completion:nil]; |
| | | } |
| | | } |
| | | } |
| | |
| | | [self SourcesSwitching:index]; |
| | | } |
| | | [self.MuneBar hideItems]; |
| | | } |
| | | -(void)muneBarShow{ |
| | | UIButton *B1=[self.view viewWithTag:321]; |
| | | UIButton *B2=[self.view viewWithTag:322]; |
| | | UILabel *L1=[self.view viewWithTag:331]; |
| | | UILabel *L2=[self.view viewWithTag:332]; |
| | | if (B1.alpha == 1) { |
| | | static BOOL isfirst; |
| | | if(!isfirst){ |
| | | isfirst = YES; |
| | | B1.transform = CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | B2.transform = CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | L1.transform = CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | L2.transform = CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | } |
| | | [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()]; |
| | | [UIView setAnimationDuration:0.5]; |
| | | B1.transform=CGAffineTransformMakeScale(0.01f, 0.01f); |
| | | B2.transform=CGAffineTransformMakeScale(0.01f, 0.01f); |
| | | L1.transform=CGAffineTransformMakeScale(0.01f, 0.01f); |
| | | L2.transform=CGAffineTransformMakeScale(0.01f, 0.01f); |
| | | |
| | | B1.alpha=0; |
| | | |
| | | [UIView commitAnimations]; |
| | | }else{ |
| | | [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()]; |
| | | [UIView setAnimationDuration:0.5]; |
| | | B1.transform=CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | B2.transform=CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | L1.transform=CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | L2.transform=CGAffineTransformMakeScale(1.0f, 1.0f); |
| | | |
| | | B1.alpha=1; |
| | | [UIView commitAnimations]; |
| | | } |
| | | } |
| | | //尽管没有用,但是必须要写,不然muneBarShow方法不会走 |
| | | -(void)muneBarHide{ |
| | | |
| | | } |
| | | |
| | | #pragma mark - UIScrollViewDelegate |
| | |
| | | } |
| | | isCollectNum=(int)indexPath.row +1; |
| | | if(lastIndex.row == 0 || indexPath.row == 0 || !lastIndex){ //在iphone6以上刷新row==0时无效的特殊处理 |
| | | // [_collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]]; |
| | | [self.collectionView reloadData]; |
| | | [_collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]]; |
| | | // [self.collectionView reloadData]; |
| | | |
| | | }else{ |
| | | // [_collectionView reloadItemsAtIndexPaths:indexPatharr]; |
| | | [_collectionView reloadData]; |
| | | [_collectionView reloadItemsAtIndexPaths:indexPatharr]; |
| | | // [_collectionView reloadData]; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | }else{ |
| | | if(_isPPTVSuccess){ //清空pptv进行转换 |
| | | [self PPTVclear]; |
| | | // [self PPTVclear]; |
| | | _isPPTVSuccess = NO; |
| | | } |
| | | |
| | | //考虑到正在播放优酷视频,切换到爱奇艺资源,所以要做一次移除优酷播放器的操作 |
| | | [self.player.view removeFromSuperview]; |
| | | [self.player removeEventsObserver:_viewManager]; |
| | | [self.player stop]; |
| | | [self.player deinit]; |
| | | // [self.player.view removeFromSuperview]; |
| | | // [self.player removeEventsObserver:_viewManager]; |
| | | // [self.player stop]; |
| | | // [self.player deinit]; |
| | | //取消隐藏playBtn |
| | | [_playBtn setHidden:NO]; |
| | | [_backgroundButton setEnabled:NO]; |
| | |
| | | case 0:{ |
| | | if (kind == UICollectionElementKindSectionHeader){ |
| | | titleCollectionReusableView *titleCollectionReusableView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleCollectionReusableViewID" forIndexPath:indexPath]; |
| | | //加载视频源视图 |
| | | if (_MuneBar!=nil) { |
| | | [titleCollectionReusableView.resourceSelectionView addSubview:self.MuneBar]; |
| | | } |
| | | |
| | | //添加收藏的点击事件 |
| | | [titleCollectionReusableView.collectionBtn addTarget:self action:@selector(ClickCollection:) forControlEvents:UIControlEventTouchUpInside]; |
| | | _collectionbt = titleCollectionReusableView.collectionBtn; |
| | |
| | | [titleCollectionReusableView.shareBtn addTarget:self action:@selector(clickShareButton:) forControlEvents:UIControlEventTouchUpInside]; |
| | | //联网检查是否收藏 |
| | | [self checkWhetherCollection]; |
| | | //加载视频源视图 |
| | | if (_MuneBar!=nil) { |
| | | [titleCollectionReusableView.resourceSelectionView addSubview:self.MuneBar]; |
| | | } |
| | | |
| | | return titleCollectionReusableView; |
| | | }else if(kind == UICollectionElementKindSectionFooter){ |
| | |
| | | * 0 . 不可用 1. 移动网络 2.wifi 3.当前网络未知 |
| | | */ |
| | | - (void)updateNet:(NSInteger )status{ |
| | | |
| | | switch (status) { |
| | | |
| | | case 0:{//当前网络不可用 |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"message:@"当前网络不可用,是否连接网络?"preferredStyle:UIAlertControllerStyleAlert]; |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示"message:@"当前网络不可用,是否连接网络?"preferredStyle:UIAlertControllerStyleAlert]; |
| | | //取消 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | |
| | | }]; |
| | | }]]; |
| | | //去连接网络 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接免费网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | if (IOS_VERSION < 8.0) { |
| | | |
| | | }else{ |
| | | [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; |
| | | } |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | |
| | | } |
| | | break; |
| | | case 1:{//移动网络 |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"警告"message:@"当前网络为付费网络!"preferredStyle:UIAlertControllerStyleAlert]; |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示"message:@"您目前没有连接WIFi,是否使用流量继续观看"preferredStyle:UIAlertControllerStyleAlert]; |
| | | //继续观看 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"继续观看" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"继续" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | | }]]; |
| | | //去连接网络 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"连接免费网络" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | | |
| | | }]; |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { |
| | | |
| | | }]]; |
| | | [self presentViewController:alert animated:YES completion:^{ |
| | | |
| | |
| | | |
| | | break; |
| | | case 3:{//当前网络无法检测,需要用户自行判断网络 |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示"message:@"无法监测当前网络,请自行判断网络!"preferredStyle:UIAlertControllerStyleAlert]; |
| | | UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示"message:@"无法监测当前网络,请自行判断网络!"preferredStyle:UIAlertControllerStyleAlert]; |
| | | //继续观看 |
| | | [alert addAction:[UIAlertAction actionWithTitle:@"继续观看" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { |
| | | [alert dismissViewControllerAnimated:YES completion:^{ |
| | |
| | | |
| | | #pragma mark -YTHBacktoApplicationsDelegate |
| | | |
| | | - (void)OutApplication{ |
| | | if (self.cloudPlayer) { |
| | | [self.cloudPlayer pause]; |
| | | } |
| | | } |
| | | |
| | | - (void)backApplication{ |
| | | if (self.cloudPlayer) { |
| | | [self.cloudPlayer play]; |
| | | } |
| | | } |
| | | //- (void)OutApplication{ |
| | | // if (self.cloudPlayer) { |
| | | // [self.cloudPlayer pause]; |
| | | // } |
| | | //} |
| | | // |
| | | //- (void)backApplication{ |
| | | // if (self.cloudPlayer) { |
| | | // [self.cloudPlayer play]; |
| | | // } |
| | | //} |
| | | |
| | | - (UIViewController *)viewControllerForPresentingModalView{ |
| | | return self; |
| | |
| | | }]; |
| | | } |
| | | |
| | | - (void)dealloc { |
| | | |
| | | |
| | | } |
| | | |
| | | @end |
| | | |