//
//  KKTVViewController.m
//  Open
//
//  Created by 雷俊博 on 2021/2/19.
//  Copyright © 2021 黄江涛 . All rights reserved.
//

#import "KKTVViewController.h"


#if TARGET_IPHONE_SIMULATOR

#else

//#import <JUnion/JUnion.h>
    
#endif


@interface KKTVViewController ()
#if TARGET_IPHONE_SIMULATOR

#else

//<JUVideoDelegate>
    
#endif

{
    CGFloat statusBarHeight;
    UIEdgeInsets gSafeAreaInsets;
}

#if TARGET_IPHONE_SIMULATOR

#else

//@property (nonatomic, strong)JURootViewController *channelVC;
    
#endif



@end

@implementation KKTVViewController
- (void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    //init
    if ([UIScreen mainScreen].bounds.size.height > 811) {
        statusBarHeight = 44;
        gSafeAreaInsets = UIEdgeInsetsMake(44, 0, 34, 0);
    }else{
        statusBarHeight = 20;
        gSafeAreaInsets = UIEdgeInsetsMake(20, 0, 0, 0);
    }
#if TARGET_IPHONE_SIMULATOR

#else

    //add view
//    [self.view addSubview:self.channelVC.view];
//    [self addChildViewController:self.channelVC];
//    
#endif
    
    
    
    //导航栏配置
    [self navConfig];
}

- (void)navConfig
{
    UIView*navView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, cl_kNavigationBarHeight)];
    navView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:navView];
    
    UIButton * backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake( 10 * WIDTHRADIU, cl_kStatusBarHeight + 9.5, 20, 25);
    backBtn.titleLabel.textAlignment =NSTextAlignmentLeft;
    //    [button_2 setTitle:@"asdasd按时打发第三方" forState:UIControlStateNormal];
    [backBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
    //    [button_2 setBackgroundColor:[UIColor redColor]];
    //    [button_2 setTitleColor:[UIColor colorWithRed:12.0 green:12.0 blue:12.0 alpha:1] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:backBtn];
    
    
    
    
    //title
    UILabel* lb_title = [[UILabel alloc]init];
    lb_title.textColor = [UIColor whiteColor];
    lb_title.font = [UIFont boldSystemFontOfSize:17 * WIDTHRADIU];
    lb_title.textAlignment = NSTextAlignmentCenter;
    [navView addSubview:lb_title];
    
    lb_title.text = @"小视频";
    
    [lb_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(navView);
        make.height.offset(25);
        make.top.offset(cl_kStatusBarHeight + 9.5);
    }];
    
    
}

#if TARGET_IPHONE_SIMULATOR

#else

#pragma mark - JUVideoDelegate
///// 首个视频开始播放(isAD: 是否是广告)
//- (void)firstPlayerStartWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isAD:(BOOL)isAD {
//    
//}
///// 视频开始播放
//- (void)playerStartWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isAD:(BOOL)isAD {
//    
//}
///// 视频播放暂停状态变化
//- (void)playerPauseWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isPause:(BOOL)isPause isAD:(BOOL)isAD {
//    
//}
///// 视频播放结束
//- (void)playerEndWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isAD:(BOOL)isAD {
//    
//}
///// 视频播放失败
//- (void)playerErrorWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo error:(NSError * _Nullable)error isAD:(BOOL)isAD {
//    
//}
///// 广告信息获取成功
//- (void)ylADInfoLoadSuccessWithAdID:(NSString * _Nonnull)adID {
//    
//}
///// 广告信息获取失败
//- (void)ylADInfoLoadFailWithAdID:(NSString * _Nonnull)adID error:(NSError * _Nullable)error {
//    
//}
///// 点击分享按钮(isMain: 竖版视频用来标记是否是首页，仅首页支持负反馈功能)
//- (void)clickShareBtnWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isMain:(BOOL)isMain {
//    
//}
///// 点赞(isPraise：true - 点赞，false - 取消点赞)
//- (void)clickPraiseBtnWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo isPraise:(BOOL)isPraise isAD:(BOOL)isAD {
////    [self.logData addObject:isPraise ? @"点赞" :@"取消点赞" ];
////    [self.logTableView reloadData];
//}
///// 进入CP页
//- (void)gotoCPPageWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo {
////    [self.logData addObject:@"进入CP页" ];
////    [self.logTableView reloadData];
////    [[UIApplication sharedApplication].windows.lastObject addSubview:self.logTableView];
//}
///// 进入播放页
//- (void)gotoPlayerPageWithVideoInfo:(JUFeedVideoData * _Nonnull)videoInfo {
////    [self.logData addObject:@"进入播放页" ];
////    [self.logTableView reloadData];
////    [[UIApplication sharedApplication].windows.lastObject addSubview:self.logTableView];
//}
///// 进入Feed页
//- (void)gotoFeedPageWithChannelID:(NSString * _Nonnull)channelID {
////    [self.logData addObject:[NSString stringWithFormat:@"进入feed页: %@",channelID]];
////    [self.logTableView reloadData];
//}
///// YLLittleVideoListController列表滑动
//- (void)yl_scrollViewDidScroll:(UIScrollView * _Nonnull)scrollView {
//    
//}
///// 广告展现
//- (void)adShowWithYlID:(NSString * _Nonnull)ylID reqId:(NSString * _Nonnull)reqId type:(NSInteger)type {
//    
//}
///// 广告点击
//- (void)adClickWithYlID:(NSString * _Nonnull)ylID reqId:(NSString * _Nonnull)reqId type:(NSInteger)type {
//    
//}
//
//#pragma mark - getters and setters
//- (JURootViewController *)channelVC {
//    if (!_channelVC) {
//        _channelVC = [JUService getChannelListViewControllerWithDelegate:self];
//        _channelVC.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height  - gSafeAreaInsets.bottom - 49);
//    }
//    return _channelVC;
//}
    
#endif



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
