Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
@@ -0,0 +1,21 @@
//
// CameraNoParyBackVideoView.h
// Ifish
//
// Created by imac on 16/12/13.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,noDataViewType){
noDataViewTypeNOSDCard,// 无sd卡
noDataViewTypeNOVideo // 没有视频
};
@interface CameraNoParyBackVideoView : UIView
@property(nonatomic,assign) noDataViewType dataType;
-(void)setViewData:(UIImage *)imag title:(NSString *)title subTitle:(NSString *)subTitle;
@end
@@ -0,0 +1,83 @@
//
// CameraNoParyBackVideoView.m
// Ifish
//
// Created by imac on 16/12/13.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "CameraNoParyBackVideoView.h"
@interface CameraNoParyBackVideoView()
@property(nonatomic,strong) UIImageView *backImg;
@property(nonatomic,strong) UILabel *title;
@property(nonatomic,strong) UILabel *subTitle;
@end
@implementation CameraNoParyBackVideoView
-(id)initWithFrame:(CGRect)frame
{
self=[super initWithFrame:frame];
if (self) {
CGFloat viewH =200;
UIView *holdView = [[UIView alloc] initWithFrame:CGRectMake(0,frame.size.height/2 -viewH, kScreenSize.width, viewH)];
self.backgroundColor = TABLE_BACKGROUD_COLOR;
holdView.backgroundColor = TABLE_BACKGROUD_COLOR;
//self.backgroundColor = [UIColor redColor];
UIImageView *backImg = [[UIImageView alloc] init ];
self.backImg = backImg;
[holdView addSubview:backImg];
UILabel *title=[[UILabel alloc] init];
title.textAlignment = NSTextAlignmentCenter;
title.font =[UIFont systemFontOfSize:16];
title.textColor = RGB(146, 146, 146);
self.title = title;
[holdView addSubview:title];
UILabel *subtitle=[[UILabel alloc] init];
subtitle.textAlignment = NSTextAlignmentCenter;
subtitle.font =[UIFont systemFontOfSize:13];
subtitle.textColor = RGB(146, 146, 146);
self.subTitle = subtitle;
[holdView addSubview:subtitle];
[self addSubview:holdView];
}
return self;
}
-(void)resetFrame{
if (self.dataType == noDataViewTypeNOSDCard) {
CGFloat imgX = self.frame.size.width/2 - 110*KWidth_Scale/2;
self.backImg.frame =CGRectMake(imgX ,kScreenSize.height/4,110*KWidth_Scale, 110*KWidth_Scale*0.82);
self.title.frame =CGRectMake(0, CGRectGetMaxY(self.backImg.frame) + 20 , self.frame.size.width,20);
self.subTitle.frame = CGRectMake(0, CGRectGetMaxY(self.title.frame) + 10, self.frame.size.width,20);
}else{
CGFloat imgX = self.frame.size.width/2 - 90*KWidth_Scale/2;
self.backImg.frame =CGRectMake(imgX ,kScreenSize.height/4,90*KWidth_Scale, 90*KWidth_Scale*0.86);
self.title.frame =CGRectMake(0, CGRectGetMaxY(self.backImg.frame) + 23 , self.frame.size.width,20);
//self.backgroundColor = [UIColor blueColor];
}
}
-(void)setViewData:(UIImage *)imag title:(NSString *)title subTitle:(NSString *)subTitle
{
[self resetFrame];
self.backImg.image =imag;
self.title.text = title;
self.subTitle.text = subTitle;
}
@end
@@ -0,0 +1,15 @@
//
// IfishP2PPlayBackListViewController.h
// Ifish
//
// Created by imac on 16/12/6.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseVIewContorller.h"
#import "IfishCameraModel.h"
@interface IfishP2PPlayBackListViewController : BaseVIewContorller
@property (nonatomic,strong) IfishCameraModel *camera;
@end
@@ -0,0 +1,640 @@
//
// IfishP2PPlayBackListViewController.m
// Ifish
//
// Created by imac on 16/12/6.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishP2PPlayBackListViewController.h"
#import "CameraNoParyBackVideoView.h"
#import "P2PClient.h"
#import "IfishPlaybackViewCell.h"
#define BACKVIEW_ROWH 60
#define ANIM_VIEW_WIDTH_AND_HEIGHT 80
//新
#import "P2PPlayingbackVC.h"
@interface IfishP2PPlayBackListViewController ()<UITableViewDelegate,UITableViewDataSource,P2PPlaybackDelegate>
@property(nonatomic,strong)UITableView *tableView;
@property(retain, nonatomic) NSMutableArray *playbackFiles;
@property(retain, nonatomic) NSMutableArray *playbackSize;
@property(retain, nonatomic) NSMutableArray *timesData;
@property(retain, nonatomic) NSMutableArray *playbackFilesMore;
@property(retain, nonatomic) NSMutableArray *playbackSizeMore;
@property(retain, nonatomic) NSMutableArray *timesDataMore;
@property(nonatomic,strong) CameraNoParyBackVideoView *noDataView;
@property(strong, nonatomic) NSString *nextEndDate;
@property (nonatomic) BOOL isloadMore;//是否更多
@property(strong, nonatomic) UIView *movieView;
@property (nonatomic) BOOL isInItDevice; //是否连接设备
@end
@implementation IfishP2PPlayBackListViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[P2PClient sharedClient] setIsClearPlaybackFilesLength:YES];//isClearPlaybackFilesLength
// Do any additional setup after loading the view.
_isloadMore = NO;
_isInItDevice = NO;
self.playbackFiles = [NSMutableArray arrayWithCapacity:0];
self.playbackSize = [NSMutableArray arrayWithCapacity:0];
self.playbackFilesMore = [NSMutableArray arrayWithCapacity:0];
self.playbackSizeMore = [NSMutableArray arrayWithCapacity:0];
[self addTitleViewWithTitle:@"回放"];
[self initUI];
//[[P2PClient sharedClient] setPlaybackDelegate:self];
}
#pragma mark - 初始化设备 p2pConnect
-(void)connectDevice{
//LoginResult *loginResult = [UDManager getLoginInfo];
//8225账号
// NSString * P2PVerifyCode1 = @"1528438234";
// NSString * P2PVerifyCode2 = @"992805759";
// NSString *UserID = @"-2144354932";
UserModel *model=[[DataCenter defaultDtacenter] valueForKey:@"UserLogIn"];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//初始化设备
if (!_isInItDevice) {
NSLog(@"正在初始化设备");
_isInItDevice = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
// _isInItDevice = [[P2PClient sharedClient] p2pConnectWithId:model.gwellUserID codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
}
if(_isInItDevice){
NSLog(@"p2pConnect success. 成功 可以操作设备了");
//成功 可以操作设备了
usleep(600000);
[self startMonitor];
}else{//new added
NSLog(@"p2pConnect failure.失败,不能操作设备");
//[self connectDevice];
return;
}
}
-(void)startMonitor{
if (_isInItDevice) {
NSLog(@"发送呼叫命令");
[[P2PClient sharedClient] setIsBCalled:NO];
[[P2PClient sharedClient] setP2pCallState:P2PCALL_STATUS_CALLING];
[[P2PClient sharedClient] p2pCallWithId:self.camera.cameraId password:self.camera.cameraPass callType:P2PCALL_TYPE_PLAYBACK];
}
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[AppDelegate sharedDefault].canFullScreen = YES;
// [self connectDevice];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
//[AppDelegate sharedDefault].canFullScreen = YES;
[[NSNotificationCenter defaultCenter] removeObserver:self name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"read_play_false" object:nil];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveRemoteMessage:) name:RECEIVE_REMOTE_MESSAGE object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readPlayFalse:) name:@"read_play_false" object:nil];
[[P2PClient sharedClient] getSDCardInfoWithId:self.camera.cameraId password:self.camera.cameraPass];
}
-(void)readPlayFalse:(NSNotification*)noti{
///
dispatch_async(dispatch_get_main_queue(), ^{
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 0.3;
}
completion:^(BOOL finished){
[self.movieView setHidden:YES];
[self.view makeToast:NSLocalizedString(@"connection_failed_please_reconnect", nil)];
}
];
});
}
-(void)goBackAction{
// [[P2PClient sharedClient] p2pHungUp];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)receiveRemoteMessage:(NSNotification *)notification{
NSDictionary *parameter = [notification userInfo];
int key = [[parameter valueForKey:@"key"] intValue];
switch (key) {
case RET_GET_PLAYBACK_FILES:
{
//回放文件名称
NSArray *array = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"files"]];
//回放文件的时间记录
NSArray *times = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"times"]];
//回放文件的播放时长
NSArray *sizes = [NSArray arrayWithArray:(NSArray*)[parameter valueForKey:@"sizes"]];
//若不是加载更多时,则往已playbackFiles数组存放回放文件
//若是加载更多,则往playbackFilesMore的数组添加回放文件
//若不是加载更多时,则往playbackSize数组存放回放文件的播放时长
//若是上拉加载更多,则往playbackSizeMore数组末尾添加回放文件的播放时长
if (_isloadMore) {
for (NSString *file in array){
[self.playbackFilesMore addObject:file];
}
for (NSString *size in sizes){
[self.playbackSizeMore addObject:size];
}
//刷新表格
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
if (self.playbackFilesMore.count < 1) {
//[self.view makeToast:NSLocalizedString(@"no_playback_file", nil)];
[self.view makeToast:@"没有更多视频"];
}
});
self.timesDataMore = [NSMutableArray arrayWithArray:times];
if (self.timesDataMore.count==0) {
return;
}
//记录最近1天、3天...已显示文件里最后一个文件的时间(最早文件的时间)
//用于上拉加载时传入的结束时间
self.nextEndDate = [self.timesDataMore lastObject];
}else{
for (NSString *file in array){
[self.playbackFiles addObject:file];
}
for (NSString *size in sizes){
[self.playbackSize addObject:size];
}
//刷新表格
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
if (self.playbackFiles.count < 1) {
//[self.view makeToast:NSLocalizedString(@"no_playback_file", nil)];
[self initNoVideoDataViewHidden:NO];
}
});
self.timesData = [NSMutableArray arrayWithArray:times];
if (self.timesData.count==0) {
return;
}
//记录最近1天、3天...已显示文件里最后一个文件的时间(最早文件的时间)
//用于上拉加载时传入的结束时间
self.nextEndDate = [self.timesData lastObject];
}
}
break;
case RET_GET_SDCARD_INFO:
{
NSInteger result = [[parameter valueForKey:@"result"] intValue];
dispatch_async(dispatch_get_main_queue(), ^{
if (result == 1) {
//[self.view makeToast:@"sdk卡可使用"];
[[P2PClient sharedClient] setCurrentLabel:1];
[[P2PClient sharedClient] getPlaybackFilesWithId:self.camera.cameraId password:self.camera.cameraPass timeInterval:1];
[[P2PClient sharedClient] setPlaybackDelegate:self];
}else{
//sd卡不存在,
//[self.view makeToast:NSLocalizedString(@"no_storage", nil)];
[self initNoSDDataViewHidden:NO];
}
});
}
break;
default:
break;
}
}
-(void)initNoSDDataViewHidden:(BOOL)hidden
{
if (hidden) {
[self.noDataView removeFromSuperview];
return;
}
if (!self.noDataView) {
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.noDataView];
}
UIImage *img=LXImageWithImageName(@"playback_iocn_sdk");
self.noDataView.dataType = noDataViewTypeNOSDCard;
[self.noDataView setViewData:img title:@"未检测到SD卡" subTitle:@"请将SD卡插入摄像头对应的卡槽中"];
}
-(void)initNoVideoDataViewHidden:(BOOL)hidden
{
if (!self.noDataView) {
//CGFloat viewH =200;
self.noDataView = [[CameraNoParyBackVideoView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.noDataView];
}
self.noDataView.dataType = noDataViewTypeNOVideo;
UIImage *img=LXImageWithImageName(@"playback_iocn_sp");
[self.noDataView setViewData:img title:@"还没有视频哦~" subTitle:@""];
self.noDataView.hidden = hidden;
}
-(void)initUI
{
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height) style:UITableViewStyleGrouped];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.showsVerticalScrollIndicator = NO;
self.tableView.backgroundColor = RGB(241, 241, 241);
[self.view addSubview:self.tableView];
UIView *movieView = [[UIView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, self.view.frame.size.width, self.view.frame.size.height-NAVIGATION_BAR_HEIGHT)];
[movieView setBackgroundColor:XBlack_128];
UIImageView *animView = [[UIImageView alloc] initWithFrame:CGRectMake((movieView.frame.size.width-ANIM_VIEW_WIDTH_AND_HEIGHT)/2, (movieView.frame.size.height-ANIM_VIEW_WIDTH_AND_HEIGHT)/2, ANIM_VIEW_WIDTH_AND_HEIGHT, ANIM_VIEW_WIDTH_AND_HEIGHT)];
NSArray *imagesArray = [NSArray arrayWithObjects:LXImageWithImageName(@"movie1.png"),LXImageWithImageName(@"movie2.png"),LXImageWithImageName(@"movie3.png"),nil];
animView.animationImages = imagesArray;
animView.animationDuration = ((CGFloat)[imagesArray count])*100.0f/1000.0f;
animView.animationRepeatCount = 0;
[animView startAnimating];
[movieView addSubview:animView];
[movieView setHidden:YES];
[self.view addSubview:movieView];
self.movieView = movieView;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section ==0) {
return [self.playbackFiles count];
}
return [self.playbackFilesMore count];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return BACKVIEW_ROWH;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
IfishPlaybackViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishPlaybackViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishPlaybackViewCell" owner:self options:nil]lastObject];
}
//每一分区这里加载不同数据源
if (indexPath.section ==0) {
if (self.playbackFiles.count!=0) {
NSString* name = [self.playbackFiles objectAtIndex:indexPath.row];
int iSize = 0;
if ([self.playbackFiles count] == [self.playbackSize count]) //查询到了文件长度
{
NSNumber* number = [self.playbackSize objectAtIndex:indexPath.row];
iSize = [number intValue];
}
if (iSize != 0) {//支持返回播放时长
//cell.videoTime.text = [NSString stringWithFormat:@"%@ (%02d:%02d)", name, iSize/60, iSize%60];
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = [NSString stringWithFormat:@"%02d分钟",iSize/60];
if (iSize<60) {
cell.videoLongth.text = [NSString stringWithFormat:@"%02d秒钟",iSize%60];
}
}
else
{
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = @"未知";
}
}
}else{
//更多
if (self.playbackFilesMore.count !=0) {
NSString* name = [self.playbackFilesMore objectAtIndex:indexPath.row];
int iSize = 0;
if ([self.playbackFilesMore count] == [self.playbackSizeMore count]) //查询到了文件长度
{
NSNumber* number = [self.playbackSizeMore objectAtIndex:indexPath.row];
iSize = [number intValue];
}
if (iSize != 0) {//支持返回播放时长
//cell.videoTime.text = [NSString stringWithFormat:@"%@ (%02d:%02d)", name, iSize/60, iSize%60];
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = [NSString stringWithFormat:@"%02d分钟",iSize/60];
}
else
{
cell.videoTime.text = [NSString stringWithFormat:@"%@", name];
cell.videoLongth.text = @"未知";
}
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self.movieView setHidden:NO];
self.movieView.alpha = 0.3;
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 1.0;
}
completion:^(BOOL finished){
}
];
if (indexPath.section ==0) {
[[P2PClient sharedClient] p2pPlaybackCallWithId:self.camera.cameraId password:self.camera.cameraPass index:indexPath.row];
}else{
[[P2PClient sharedClient] p2pPlaybackCallWithId:self.camera.cameraId password:self.camera.cameraPass index:indexPath.row + self.playbackFiles.count];
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section==0) {
//描述 + 回放列表 + 今天 + 1 像素线
return 50 +BACKVIEW_ROWH +BACKVIEW_ROWH + 1;
}
return 0.1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if (section ==1) {
return BACKVIEW_ROWH;
}
return 0.1;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
CGFloat space = 10;
if (section ==0) {
UIView *section0Header =[[UIView alloc] init];
section0Header.frame = CGRectMake(0, 0, self.view.frame.size.width, 191);
UILabel *describleLabe=[[UILabel alloc] init];
describleLabe.frame = CGRectMake(0, 0,self.view.frame.size.width, 50);
describleLabe.textColor =RGB(102, 102, 102);
describleLabe.textAlignment = NSTextAlignmentCenter;
describleLabe.text = @"30分钟录制一次,录像最多存储7日";
describleLabe.font = [UIFont systemFontOfSize:12];
describleLabe.backgroundColor = RGB(241, 245, 246);
[section0Header addSubview:describleLabe];
UIView *listLabeBack =[[UIView alloc] init];
listLabeBack.frame = CGRectMake(0,CGRectGetMaxY(describleLabe.frame), self.view.frame.size.width,BACKVIEW_ROWH);
listLabeBack.backgroundColor = [UIColor whiteColor];
[section0Header addSubview:listLabeBack];
UILabel *listLabe=[[UILabel alloc] init];
listLabe.frame = CGRectMake(space,CGRectGetHeight(listLabeBack.frame)/2,200, 20);
listLabe.textColor =RGB(102, 102, 102);
listLabe.font = [UIFont systemFontOfSize:15];
listLabe.text = @"回放列表";
[listLabeBack addSubview:listLabe];
CGFloat listlW = 50;
UILabel *listl=[[UILabel alloc] init];
listl.frame = CGRectMake(self.view.frame.size.width - space -listlW -4,CGRectGetHeight(listLabeBack.frame)/2,listlW, 20);
listl.textColor =RGB(102, 102, 102);
listl.font = [UIFont systemFontOfSize:14];
listl.text = @"时长";
listl.textAlignment = NSTextAlignmentRight;
[listLabeBack addSubview:listl];
//一像素分割线
UIView *lineView =[[UIView alloc] init];
lineView.frame = CGRectMake(0, CGRectGetMaxY(listLabeBack.frame), self.view.frame.size.width,1);
lineView.backgroundColor = RGB(241, 241, 241);
[section0Header addSubview:lineView];
//今天
UIView *todayLabeBack =[[UIView alloc] init];
todayLabeBack.frame = CGRectMake(0,CGRectGetMaxY(lineView.frame),self.view.frame.size.width, BACKVIEW_ROWH);
todayLabeBack.backgroundColor = [UIColor whiteColor];
[section0Header addSubview:todayLabeBack];
UILabel *todayLabe=[[UILabel alloc] init];
todayLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
todayLabe.textColor =RGB(153, 153, 153);
todayLabe.font = [UIFont systemFontOfSize:14];
todayLabe.text = @"最近24小时";
todayLabe.backgroundColor = [UIColor whiteColor];
//todayLabe.text.
[todayLabeBack addSubview:todayLabe];
return section0Header;
}
return nil;
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
CGFloat space = 10;
if (section ==1) {
//更多
UIView *moreLabeBack =[[UIView alloc] init];
moreLabeBack.frame = CGRectMake(0,0,self.view.frame.size.width, BACKVIEW_ROWH);
moreLabeBack.backgroundColor = [UIColor whiteColor];
UILabel *moreLabe=[[UILabel alloc] init];
moreLabe.frame = CGRectMake(space,0,self.view.frame.size.width, BACKVIEW_ROWH);
moreLabe.textColor =RGB(153, 153, 153);
moreLabe.font = [UIFont systemFontOfSize:14];
moreLabe.text = @"查看更多";
moreLabe.backgroundColor = [UIColor whiteColor];
[moreLabeBack addSubview:moreLabe];
moreLabe.userInteractionEnabled = YES;
UITapGestureRecognizer *moreGesture =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(moreDataRequset)];
[moreLabe addGestureRecognizer:moreGesture];
return moreLabeBack;
}
return nil;
}
#pragma mark - moreDataRequset
-(void)moreDataRequset{
_isloadMore =YES;
// //today
NSDate *nowDate = [NSDate date];
NSInteger interval =31;
// //interval(1或3...)天前
NSDate *startDate = [nowDate dateByAddingTimeInterval: -(interval*24*60*60)];
//加载更多时 设置 startDate 为31 天前 可获取所有 endDate 为 今天最后一个的时间 即self.nextEndDate
if (!self.nextEndDate) {
[self.view makeToast:@"无更多数据"];
return;
}
NSDate *endDate = [Utils dateFromString:self.nextEndDate];
[[P2PClient sharedClient] getPlaybackFilesWithIdByDate:self.camera.cameraId password:self.camera.cameraPass startDate:startDate endDate:endDate];
}
#pragma mark - 视频回放准备播放的回调
-(void)P2PPlaybackReady:(NSDictionary *)info{
NSLog(@"P2PPlaybackReady");
dispatch_async(dispatch_get_main_queue(), ^{
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 0.3;
}
completion:^(BOOL finished){
[self.movieView setHidden:YES];
//P2PPlayingbackController *playingbackController = [[P2PPlayingbackController alloc] init];
P2PPlayingbackVC *playingbackController = [[P2PPlayingbackVC alloc] init];
[self presentViewController:playingbackController animated:YES completion:nil];
}
];
});
}
#pragma mark - 视频回放挂断的回调
-(void)P2PPlaybackReject:(NSDictionary *)info{
NSLog(@"P2PPlaybackReject");
dispatch_async(dispatch_get_main_queue(), ^{
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 0.3;
}
completion:^(BOOL finished){
[self.movieView setHidden:YES];
[self.view makeToast:[info objectForKey:@"rejectMsg"]];
}
];
});
}
#pragma mark -
-(BOOL)shouldAutorotate{
return YES;
}
#pragma mark 支持哪些方向
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
#pragma mark 一开始希望的屏幕方向
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
@end
@@ -0,0 +1,17 @@
//
// IfishPlaybackViewCell.h
// Ifish
//
// Created by imac on 16/12/13.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface IfishPlaybackViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *palybackVideo;
@property (weak, nonatomic) IBOutlet UILabel *videoLongth;
@property (weak, nonatomic) IBOutlet UILabel *videoTime;
@end
@@ -0,0 +1,26 @@
//
// IfishPlaybackViewCell.m
// Ifish
//
// Created by imac on 16/12/13.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishPlaybackViewCell.h"
@implementation IfishPlaybackViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.palybackVideo.image = LXImageWithImageName(@"playback_iocn_video");
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="IfishPlaybackViewCell" id="KGk-i7-Jjw" customClass="IfishPlaybackViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="69"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="录像" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fr5-kU-lL9">
<rect key="frame" x="54" y="13" width="208" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6iO-V5-oJZ">
<rect key="frame" x="54" y="36" width="208" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="30分钟" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uW9-bN-ief">
<rect key="frame" x="270" y="36" width="42" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AnP-CM-Ycx">
<rect key="frame" x="0.0" y="68" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.94509803921568625" green="0.96078431372549022" blue="0.96470588235294119" alpha="1" colorSpace="calibratedRGB"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mrW-Tn-00Y">
<rect key="frame" x="10" y="24" width="30" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="palybackVideo" destination="mrW-Tn-00Y" id="fjd-ft-f5S"/>
<outlet property="videoLongth" destination="uW9-bN-ief" id="xo3-Jd-NaM"/>
<outlet property="videoTime" destination="6iO-V5-oJZ" id="3ar-eN-xk7"/>
</connections>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,47 @@
//
// P2PPlaybackController.h
// Yoosee
//
// Created by guojunyi on 14-4-22.
// Copyright (c) 2014年 guojunyi. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "P2PClient.h"
#import "CyclePickerView.h"
#import "PlayBaseViewController.h"
#import "IfishCameraModel.h"
//技威 回访列表测试用
@class Contact;
@class MBProgressHUD;
@interface P2PPlaybackController : PlayBaseViewController<UITableViewDataSource,UITableViewDelegate,P2PPlaybackDelegate, CyclePickerViewDelegate,CyclePickerViewDatasource>
//@property(strong, nonatomic) Contact *contact;
@property(strong, nonatomic) IfishCameraModel *camera;
@property(nonatomic) BOOL isInitSearch;
@property(strong, nonatomic) UIImageView *layerView;
@property(strong, nonatomic) UIView *searchBarView;
@property(retain, nonatomic) NSMutableArray *playbackFiles;
@property(retain, nonatomic) NSMutableArray *playbackSize;
@property(retain, nonatomic) NSMutableArray *timesData;
@property(strong, nonatomic) UITableView *tableView;
@property(strong, nonatomic) MBProgressHUD *searchMaskView;
@property(strong, nonatomic) UIView *movieView;
@property(strong, nonatomic) NSString *nextStartTime;
@property(strong, nonatomic) NSString *startTime;
@property(strong, nonatomic) NSString *endTime;
@property (strong, nonatomic) UIButton *startTimeBtn;
@property (strong, nonatomic) UIButton *endTimeBtn;
@property (nonatomic) NSInteger selectedTimeTag;
@property (nonatomic) NSInteger selectedLabel;
@property (strong, nonatomic) UIView *customView;
@property (strong, nonatomic) UILabel *startTimeLabel;
@property (strong, nonatomic) UILabel *endTimeLabel;
@property (nonatomic) BOOL isShowCustomView;
@property (nonatomic) BOOL isChangePlaybackItem;//视频回放修复
@property(assign) BOOL isLoadingStorageInfo;
@property(nonatomic,strong)CyclePickerView * cycleview;
@property(nonatomic) NSInteger loadCount; //记录回放文件的个数
@end
@@ -0,0 +1,15 @@
//
// P2PPlayingbackVC.h
// P2PPlayingbackVC
//
// Created by apple on 16/7/19.
// Copyright © 2016年 yuanHongQiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "P2PClient.h"
#import "PlayBaseViewController.h"
#import "P2PCInterface.h"
@interface P2PPlayingbackVC : PlayBaseViewController<P2PPlaybackDelegate>
@property (nonatomic) BOOL isReject;
@end
@@ -0,0 +1,887 @@
//
// P2PPlayingbackVC.m
// P2PPlayingbackVC
//
// Created by apple on 16/7/19.
// Copyright © 2016年 yuanHongQiang. All rights reserved.
//
#import "P2PPlayingbackVC.h"
#import "FounderButton.h"
#import "UIViewExt.h"
#import "YSlider.h"
#import "AppDelegate.h"
#import "PAIOUnit.h"
#import "OpenGLView.h"
#import "FListManager.h"
@interface P2PPlayingbackVC ()
@property (nonatomic) CGPoint swipeLastPos;
@property (nonatomic,strong) OpenGLView *remoteView;
@end
@implementation P2PPlayingbackVC{
BOOL _hadRotating;
BOOL _hadLayout;
BOOL _hadCreateUI;
BOOL _hadAddUI;
UIView* _viewNaviBar;
UIImageView* _imageViewNaviBarColor;
UIView* _viewBottomTools;
UIView* _openGLView;
UIView* _viewSpeed;
FounderButton* _buttonPre;
FounderButton* _buttonNext;
FounderButton* _buttonSpeed;
FounderButton* _buttonPause;
FounderButton* _buttonSilence;
FounderButton* _buttonBack;
FounderButton* _buttonViewSpeed;
UITapGestureRecognizer* _gesOnceTap;
UILabel* _labelPlayTheTime;
UILabel* _labelPlayAllTime;
UILabel* _labelPlaySpeedTime;
YSlider* _sliderPlayProgress;
BOOL _isPause;
BOOL _isSilence;
BOOL _isFasting;
//
BOOL _needUpdatePlayTimeShow;
//OpenGLView *_remoteView;
uint64_t _theTimePlay;
uint64_t _theTimeAll;
NSString* _thetimePlayStr;
NSString* _thetimeAllStr;
BOOL _isFishEyeDevice;
CGSize _theSizeOfScreen;
}
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
-(void)regStatusBarNotification{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(notHadRotating:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:nil];
}
-(void)notHadRotating:(NSNotification*)notification{
_hadRotating=YES;
_hadLayout=NO;
}
-(instancetype)init{
self=[super init];
if (self) {
[self initializeVariable];
[self regStatusBarNotification];
}
return self;
}
- (void)viewDidLoad{
[super viewDidLoad];
[AppDelegate sharedDefault].canFullScreen = YES;
self.view.backgroundColor=[UIColor whiteColor];
[self createUI];
[self addUI];
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[self stSilence:NO];
[[PAIOUnit sharedUnit] setSilentAudio:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
}
- (void)applicationDidEnterBackground {
NSLog(@"========================Enter Background");
_isReject = YES;
}
- (void)applicationDidBecomeActive {
NSLog(@"========================Become Active");
_isReject = NO;
[self startRenderView];
}
-(void)initializeVariable{
_hadRotating=NO;
_hadLayout=NO;
_hadCreateUI=NO;
_hadAddUI=NO;
_isPause=NO;
_isSilence=NO;
_isFasting=NO;
_needUpdatePlayTimeShow=YES;
}
-(void)createUI{
_hadCreateUI=YES;
_viewNaviBar=[[UIView alloc] init];
_viewNaviBar.backgroundColor=[UIColor clearColor];
_imageViewNaviBarColor=[[UIImageView alloc] init];
_imageViewNaviBarColor.backgroundColor=[UIColor clearColor];
_imageViewNaviBarColor.contentMode=UIViewContentModeScaleToFill;
_imageViewNaviBarColor.image=[UIImage imageNamed:@"FullPlay_Gradient_black_alpha_0.png"];
_viewBottomTools=[[UIView alloc] init];
_viewBottomTools.backgroundColor=[UIColor colorWithRed:48/255.0 green:48/255.0 blue:48/255.0 alpha:0.8];
_openGLView=[[UIView alloc] init];
_openGLView.backgroundColor=[UIColor blackColor];
// _openGLView.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"FullScreenTemp.png"]];
_gesOnceTap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showToolsViewChange)];
_gesOnceTap.numberOfTapsRequired=1;
[_openGLView addGestureRecognizer:_gesOnceTap];
_buttonPre=[[FounderButton alloc] init];
_buttonPre.buttonImageViewSize=CGSizeMake(17, 17);
_buttonPre.backgroundColor=[UIColor clearColor];
[_buttonPre addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[_buttonPre setImage:[UIImage imageNamed:@"FullPlay_Previous.png"] forState:UIControlStateNormal];
[_buttonPre setImage:[UIImage imageNamed:@"FullPlay_Previous_down.png"] forState:UIControlStateHighlighted];
_buttonNext=[[FounderButton alloc] init];
_buttonNext.buttonImageViewSize=CGSizeMake(17, 17);
_buttonNext.backgroundColor=[UIColor clearColor];
[_buttonNext addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[_buttonNext setImage:[UIImage imageNamed:@"FullPlay_Next.png"] forState:UIControlStateNormal];
[_buttonNext setImage:[UIImage imageNamed:@"FullPlay_Next_down.png"] forState:UIControlStateHighlighted];
_buttonSpeed=[[FounderButton alloc] init];
_buttonSpeed.buttonImageViewSize=CGSizeMake(17, 17);
_buttonSpeed.backgroundColor=[UIColor clearColor];
[_buttonSpeed addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[_buttonSpeed setImage:[UIImage imageNamed:@"FullPlay_Speed.png"] forState:UIControlStateNormal];
[_buttonSpeed setImage:[UIImage imageNamed:@"FullPlay_Speed_down.png"] forState:UIControlStateHighlighted];
_buttonPause=[[FounderButton alloc] init];
_buttonPause.buttonImageViewSize=CGSizeMake(17, 17);
_buttonPause.backgroundColor=[UIColor clearColor];
[_buttonPause addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[self updatePauseButtonWithPause:_isPause];
_buttonSilence=[[FounderButton alloc] init];
_buttonSilence.buttonImageViewSize=CGSizeMake(17, 17);
_buttonSilence.backgroundColor=[UIColor clearColor];
[_buttonSilence addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[self updateSilenceButtonWithPause:_isSilence];
_buttonBack=[[FounderButton alloc] init];
_buttonBack.buttonImageViewSize=CGSizeMake(17, 17);
_buttonBack.backgroundColor=[UIColor clearColor];
[_buttonBack addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[_buttonBack setImage:[UIImage imageNamed:@"FullPlay_Back.png"] forState:UIControlStateNormal];
[_buttonBack setImage:[UIImage imageNamed:@"FullPlay_Back_down.png"] forState:UIControlStateHighlighted];
_labelPlayTheTime=[[UILabel alloc] init];
_labelPlayTheTime.userInteractionEnabled=NO;
_labelPlayTheTime.backgroundColor=[UIColor clearColor];
_labelPlayTheTime.text=@"00:00:00";
_labelPlayTheTime.textColor=[UIColor whiteColor];
_labelPlayTheTime.font=[UIFont systemFontOfSize:11.0];
_labelPlayTheTime.textAlignment=NSTextAlignmentLeft;
_labelPlayAllTime=[[UILabel alloc] init];
_labelPlayAllTime.userInteractionEnabled=NO;
_labelPlayAllTime.backgroundColor=[UIColor clearColor];
_labelPlayAllTime.text=@"00:00:00";
_labelPlayAllTime.textColor=[UIColor whiteColor];
_labelPlayAllTime.font=[UIFont systemFontOfSize:11.0];
_labelPlayAllTime.textAlignment=NSTextAlignmentRight;
_sliderPlayProgress=[[YSlider alloc] init];
_sliderPlayProgress.backgroundColor=[UIColor clearColor];
[_sliderPlayProgress setMinimumTrackColor:[UIColor colorWithRed:102/255.0 green:185/255.0 blue:255/255.0 alpha:1.0]
forState:UIControlStateNormal];
[_sliderPlayProgress setMinimumTrackColor:[UIColor colorWithRed:102/255.0 green:185/255.0 blue:255/255.0 alpha:1.0]
forState:UIControlStateHighlighted];
[_sliderPlayProgress setMinimumTrackColor:[UIColor colorWithRed:102/255.0 green:185/255.0 blue:255/255.0 alpha:1.0]
forState:UIControlStateSelected];
[_sliderPlayProgress setMaximumTrackColor:[UIColor colorWithRed:118/255.0 green:118/255.0 blue:118/255.0 alpha:1.0]
forState:UIControlStateNormal];
[_sliderPlayProgress setMaximumTrackColor:[UIColor colorWithRed:118/255.0 green:118/255.0 blue:118/255.0 alpha:1.0]
forState:UIControlStateHighlighted];
[_sliderPlayProgress setMaximumTrackColor:[UIColor colorWithRed:118/255.0 green:118/255.0 blue:118/255.0 alpha:1.0]
forState:UIControlStateSelected];
[_sliderPlayProgress setThumbImage:[UIImage imageNamed:@"FullPlay_Slider.png"] forState:UIControlStateNormal];
[_sliderPlayProgress setThumbImage:[UIImage imageNamed:@"FullPlay_Slider_down.png"] forState:UIControlStateHighlighted];
[_sliderPlayProgress setThumbImage:[UIImage imageNamed:@"FullPlay_Slider_down.png"] forState:UIControlStateSelected];
[_sliderPlayProgress setThumbColor:[UIColor clearColor] forState:UIControlStateNormal];
[_sliderPlayProgress setThumbColor:[UIColor clearColor] forState:UIControlStateHighlighted];
[_sliderPlayProgress setThumbColor:[UIColor clearColor] forState:UIControlStateSelected];
_sliderPlayProgress.value=0.0;
_sliderPlayProgress.thumbSize=CGSizeMake(21, 21);
[_sliderPlayProgress addTarget:self action:@selector(dropInsideBegin:) forControlEvents:UIControlEventTouchDown];
[_sliderPlayProgress addTarget:self action:@selector(dropValueChange:) forControlEvents:UIControlEventValueChanged];
[_sliderPlayProgress addTarget:self action:@selector(dropInsideEnd:) forControlEvents:UIControlEventTouchUpInside];
[_sliderPlayProgress addTarget:self action:@selector(dropCancel:) forControlEvents:UIControlEventTouchUpOutside];
[_sliderPlayProgress addTarget:self action:@selector(dropCancel:) forControlEvents:UIControlEventTouchCancel];
//画布
//画布
NSString *contactId = [[P2PClient sharedClient] callId];
// NSInteger deviceSubtype = [[FListManager sharedFList] getDeviceSubtypeWithId:contactId];
_isFishEyeDevice = NO;
//if (isSupportFisheyeDevice(deviceSubtype)) {
// _isFishEyeDevice = YES;
// }
//非鱼眼设备 下面设置无效
int installType = SHAPE_CIRCLE;//360
int fishEyeType = FISHEYE_360;//360
// if (isSupportFisheyeDevice180(deviceSubtype)) {
// installType = SHAPE_180_HALF_SPHERE;//180
// fishEyeType = FISHEYE_180;//180
// }
_remoteView = [[OpenGLView alloc] initWithIsSupportFisheyeDevice:_isFishEyeDevice installType:installType deviceID:[contactId intValue] fishEyeType:fishEyeType];
_remoteView.userInteractionEnabled=YES;
[_remoteView setIsFullScreen:YES];
if (_isFishEyeDevice) {
//缩放手势(鱼眼设备)
UIPinchGestureRecognizer *pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] init];
[pinchGestureRecognizer addTarget:self action:@selector(onPinchToZoom:)];
[_remoteView addGestureRecognizer:pinchGestureRecognizer];
//拖动手势(鱼眼设备才有,普通设备时则禁止)
UIPanGestureRecognizer *panRec = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panEvent:)];
[_remoteView addGestureRecognizer:panRec];
}
_viewSpeed = [[UIView alloc] init];
_viewSpeed.hidden = YES;
_viewSpeed.backgroundColor=[UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.5];
_buttonViewSpeed = [[FounderButton alloc] init];
_buttonViewSpeed.buttonImageViewSize=CGSizeMake(17, 17);
_buttonViewSpeed.backgroundColor=[UIColor clearColor];
[_buttonViewSpeed addTarget:self action:@selector(buttonBeClick:) forControlEvents:UIControlEventTouchUpInside];
[_buttonViewSpeed setImage:[UIImage imageNamed:@"FullPlay_Speed.png"] forState:UIControlStateNormal];
[_buttonViewSpeed setImage:[UIImage imageNamed:@"FullPlay_Speed_down.png"] forState:UIControlStateHighlighted];
_labelPlaySpeedTime=[[UILabel alloc] init];
_labelPlaySpeedTime.userInteractionEnabled=NO;
_labelPlaySpeedTime.backgroundColor=[UIColor clearColor];
_labelPlaySpeedTime.text=@"00:00:00";
_labelPlaySpeedTime.textColor=[UIColor colorWithRed:102.0/255.0 green:185.0/255.0 blue:255.0/255.0 alpha:1.0];
_labelPlaySpeedTime.font=[UIFont systemFontOfSize:10.0];
_labelPlaySpeedTime.textAlignment=NSTextAlignmentLeft;
}
-(void)addUI{
_hadAddUI=YES;
UIView* theView=self.view;
[_openGLView addSubview:_remoteView];
[theView addSubview:_openGLView];
[_viewBottomTools addSubview:_sliderPlayProgress];
[_viewBottomTools addSubview:_buttonPre];
[_viewBottomTools addSubview:_buttonNext];
[_viewBottomTools addSubview:_buttonPause];
[_viewBottomTools addSubview:_buttonSilence];
[_viewBottomTools addSubview:_labelPlayTheTime];
[_viewBottomTools addSubview:_labelPlayAllTime];
[_viewBottomTools addSubview:_buttonSpeed];
//[theView addSubview:_viewBottomTools];
[_viewNaviBar addSubview:_imageViewNaviBarColor];
[_viewNaviBar addSubview:_buttonBack];
[theView addSubview:_viewNaviBar];
[_viewSpeed addSubview:_buttonViewSpeed];
[_viewSpeed addSubview:_labelPlaySpeedTime];
[theView addSubview:_viewSpeed];
}
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
if (!_hadLayout){
_hadLayout=YES;
}
[self layoutAuto];
if (_hadRotating){
_hadRotating=NO;
}
}
-(CGSize)gtScreenSize{
CGSize screenSize = [UIScreen mainScreen].bounds.size;
if (([[UIDevice currentDevice].systemVersion floatValue] < 8.0) &&
UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
return CGSizeMake(screenSize.height, screenSize.width);
}
return screenSize;
}
-(void)layoutAuto{
_theSizeOfScreen=[self gtScreenSize];
CGFloat TempW=_theSizeOfScreen.width;
CGFloat TempH=45;
CGFloat TempX=0;
CGFloat TempY=(_theSizeOfScreen.height-TempH);
CGRect newRect=CGRectMake(TempX, TempY, TempW, TempH);
_viewBottomTools.frame=newRect;
TempW=_theSizeOfScreen.width;
TempH=_theSizeOfScreen.height;
TempX=0;
TempY=0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_openGLView.frame=newRect;
_remoteView.frame=_openGLView.bounds;
if (_isFishEyeDevice) {
// [_remoteView setFullScreenHeight:_remoteView.frame.size.width width:_remoteView.frame.size.width fullScreen:1];//360全景设备
}
TempW=_theSizeOfScreen.width;
TempH=44;
TempX=0;
TempY=0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_viewNaviBar.frame=newRect;
_imageViewNaviBarColor.frame=_viewNaviBar.bounds;
TempW=35;
TempH=_viewNaviBar.height;
TempX=15;
TempY=(_viewNaviBar.height-TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonBack.frame=newRect;
TempW=33;
TempH=_viewBottomTools.height;
TempX=_buttonBack.left;
TempY=(_viewBottomTools.height-TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonPre.frame=newRect;
TempW=_buttonPre.width;
TempH=_buttonPre.height;
TempX=_buttonPre.right;
TempY=_buttonPre.top;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonPause.frame=newRect;
TempW=_buttonPause.width;
TempH=_buttonPause.height;
TempX=_buttonPause.right;
TempY=_buttonPause.top;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonNext.frame=newRect;
TempW=_buttonNext.width;
TempH=_buttonNext.height;
TempX=_buttonNext.right;
TempY=_buttonNext.top;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonSpeed.frame=newRect;
TempW=_buttonPre.width;
TempH=_buttonPre.height;
TempX=(_viewBottomTools.width-TempW)- _buttonPre.left;
TempY=_buttonPre.top;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonSilence.frame=newRect;
TempW=_buttonSilence.left-_buttonSpeed.right+15*2;
TempH=_viewBottomTools.height;
TempX=_buttonSpeed.right-15;
TempY=(_viewBottomTools.height-TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_sliderPlayProgress.frame=newRect;
TempW=(_sliderPlayProgress.width-_sliderPlayProgress.height/2.0*2)/2.0;
TempH=_viewBottomTools.height/2.0;
TempX=_sliderPlayProgress.left+_sliderPlayProgress.height/2.0;
TempY=_viewBottomTools.height-TempH;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_labelPlayTheTime.frame=newRect;
TempW=(_sliderPlayProgress.width-_sliderPlayProgress.height/2.0*2)/2.0;
TempH=_labelPlayTheTime.height;
TempX=(_sliderPlayProgress.width-(TempW+_sliderPlayProgress.height/2.0))+_sliderPlayProgress.left;;
TempY=_labelPlayTheTime.top;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_labelPlayAllTime.frame=newRect;
TempW=170.0/2.0;
TempH=55.0/2.0;
TempX=(_theSizeOfScreen.width - TempW)/2.0;
TempY=(_theSizeOfScreen.height - TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_viewSpeed.frame=newRect;
TempW=_buttonNext.width;
TempH=_buttonNext.height;
TempX=0.0;
TempY=(_viewSpeed.height - TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_buttonViewSpeed.frame=newRect;
TempW=_viewSpeed.width - _buttonViewSpeed.width;
TempH=_viewSpeed.height / 2.0;
TempX=_buttonViewSpeed.right;
TempY=(_viewSpeed.height - TempH)/2.0;
newRect=CGRectMake(TempX, TempY, TempW, TempH);
_labelPlaySpeedTime.frame = newRect;
}
#pragma mark - 将要显示
-(void)viewWillAppear:(BOOL)animated{
[AppDelegate sharedDefault].canFullScreen = YES;
[super viewWillAppear:animated];
[[P2PClient sharedClient] setPlaybackDelegate:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receivePlayingCommand:)
name:RECEIVE_PLAYING_CMD
object:nil];
}
#pragma mark - 收到播放控制消息
- (void)receivePlayingCommand:(NSNotification *)notification{
NSDictionary *parameter = [notification userInfo];
int key = [[parameter valueForKey:@"key"] intValue];
dispatch_async(dispatch_get_main_queue(), ^{
if(key==RECEIVE_PLAYING_CMD_PLAYBACK_STOP){
NSLog(@"停止播放");
_isPause=YES;
_viewSpeed.hidden=YES;
}else if(key==RECEIVE_PLAYING_CMD_PLAYBACK_START){
NSLog(@"开始播放");
_isPause=NO;
}else if(key==RECEIVE_PLAYING_CMD_PLAY_FAST_START){
NSLog(@"开始快进");
_isPause=NO;
_viewSpeed.hidden=NO;
}else if(key==RECEIVE_PLAYING_CMD_PLAY_FAST_STOP){
NSLog(@"停止快进");
_isPause=NO;
_viewSpeed.hidden=YES;
}
[self updatePauseButtonWithPause:_isPause];
});
}
#pragma mark - 将要消失
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self closeThePlay];
[[NSNotificationCenter defaultCenter] removeObserver:self name:RECEIVE_PLAYING_CMD object:nil];
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}
#pragma mark - 视图已经显示
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self startRenderView];
}
#pragma mark - 时间到文本的转换
-(NSString*)stringFromTime:(uint64_t)time{
uint64_t theTime=time;
if (theTime<=0) {
theTime=0;
}
uint64_t hour=theTime/3600;
uint64_t minutes=(theTime - hour*3600 )/60;
uint64_t seconds=(theTime - hour*3600 - minutes*60);
NSString* strTime=[NSString stringWithFormat:@"%02lld:%02lld:%02lld",(uint64_t)hour,(uint64_t)minutes,(uint64_t)seconds];
return strTime;
}
#pragma mark - 渲染视频
- (void)startRenderView{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
GAVFrame * m_pAVFrame ;
while (!_isReject){
if([[P2PClient sharedClient] gwplaybackState]!=PLAYBACK_STATE_PAUSE){
NSLog(@"P2PPlayingbackVC while 渲染监控画面");
if(fgGetVideoFrameToDisplay(&m_pAVFrame)){
//NSLog(@"\n回放的结构体:\n m_pAVFrame->width:%d\n m_pAVFrame->linesize[0]:%d \n m_pAVFrame->height:%d \n m_pAVFrame->linesize[0]:%d \n m_pAVFrame->pts:%llu ",
// m_pAVFrame->width,
// m_pAVFrame->linesize[0],
// m_pAVFrame->height,
// m_pAVFrame->linesize[0],
// m_pAVFrame->pts
// );
UInt64 u64TargetPTS = [[P2PClient sharedClient] playback_u64TargetPTS];
_theTimePlay = (m_pAVFrame->pts-[[P2PClient sharedClient] playback_startTime])/1000000;
_theTimeAll = [[P2PClient sharedClient] playback_totalTime]/1000000;
_thetimePlayStr=[self stringFromTime:_theTimePlay];
_thetimeAllStr=[self stringFromTime:_theTimeAll];
NSLog(@"_theTimePlay=%lld _theTimeAll==%lld",_theTimePlay,_theTimeAll);
if (_needUpdatePlayTimeShow) {
double sliderValue=(double)(_theTimePlay/(double)_theTimeAll);
if (isnan(sliderValue)) {
//若_theTimeAll=0,那么sliderValue值为nan,会引起崩溃
//所以加if判断
sliderValue=0;
}
NSLog(@"sliderValue=%.4f",sliderValue);
dispatch_async(dispatch_get_main_queue(), ^{
if (u64TargetPTS==0 || ((m_pAVFrame->pts >= u64TargetPTS) && (m_pAVFrame->pts-u64TargetPTS<1000000))) {
if (u64TargetPTS!=0) {
[self stSilence:NO];
}
[[P2PClient sharedClient] setPlayback_u64TargetPTS:0];
_labelPlayTheTime.text=_thetimePlayStr;
_labelPlayAllTime.text=_thetimeAllStr;
_labelPlaySpeedTime.text=_thetimePlayStr;
_sliderPlayProgress.value=sliderValue;
}
});
}
if (u64TargetPTS==0 || ((m_pAVFrame->pts >= u64TargetPTS) && (m_pAVFrame->pts-u64TargetPTS<1000000))) {
[self.remoteView render:m_pAVFrame];
}
vReleaseVideoFrame();
}
}
usleep(10000);
}
});
}
#pragma mark - 静音或者不静音
-(void)stSilence:(BOOL)flag{
if (flag) {
[[PAIOUnit sharedUnit] setMuteAudio:YES];
}else{
[[PAIOUnit sharedUnit] setMuteAudio:NO];
}
}
#pragma mark - 上一曲
-(void)preVideo{
if([[P2PClient sharedClient] getPlaybackCurrentFileIndex]==0){
[self.view makeToast:NSLocalizedString(@"no_previous_files", nil)];
}else{
[[P2PClient sharedClient] previous];
}
}
#pragma mark - 下一曲
-(void)nextVideo{
if([[P2PClient sharedClient] getPlaybackCurrentFileIndex]>=([[P2PClient sharedClient] getPlaybackFilesLength]-1)){
[self.view makeToast:NSLocalizedString(@"no_next_files", nil)];
}else{
[[P2PClient sharedClient] next];
}
}
#pragma mark - 快进
-(void)speedVideo{
if(_viewSpeed.hidden){
_viewSpeed.hidden = NO;
[[P2PClient sharedClient] fastBegin:_sliderPlayProgress.value *_theTimeAll];
}else{
[[P2PClient sharedClient] fastEnd:_sliderPlayProgress.value *_theTimeAll];
_viewSpeed.hidden = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)500*NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
if (_viewSpeed.hidden) {
[self playTimeTo:_sliderPlayProgress.value*_theTimeAll];
}
});
}
}
#pragma mark - 关闭播放
-(void)closeThePlay{
_isReject=YES;
//[[P2PClient sharedClient] playbackp2pHungUp];
[self quitFullController];
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - 暂停或者播放
-(void)playOrPause{
vSetSupperDrop(NO);
if ([[P2PClient sharedClient] gwplaybackState]==PLAYBACK_STATE_PLAYING) {
_isPause=YES;
[[P2PClient sharedClient] setGwplaybackState:PLAYBACK_STATE_PAUSE];
[self stSilence:YES];
}else if([[P2PClient sharedClient] gwplaybackState]==PLAYBACK_STATE_PAUSE){
_isPause=NO;
[[P2PClient sharedClient] setGwplaybackState:PLAYBACK_STATE_PLAYING];
if (!_isSilence) {
[self stSilence:NO];
}
}else if([[P2PClient sharedClient] gwplaybackState]==PLAYBACK_STATE_STOP){
_isPause=YES;
[[P2PClient sharedClient] sendCommandType:USR_CMD_PLAY_CTL
andOption:USR_CMD_OPTION_PLAY];
if (!_isSilence) {
[self stSilence:NO];
}
}
[self updatePauseButtonWithPause:_isPause];
}
#pragma mark - 滑块条事件
-(void)dropInsideEnd:(YSlider*)slider{
[self stSilence:YES];
[self playTimeTo:slider.value*_theTimeAll];
_needUpdatePlayTimeShow=YES;
_viewSpeed.hidden = YES;
}
-(void)dropCancel:(YSlider*)slider{
_needUpdatePlayTimeShow=YES;
}
-(void)dropInsideBegin:(YSlider*)slider{
_needUpdatePlayTimeShow=NO;
}
-(void)dropValueChange:(YSlider*)slider{
_thetimePlayStr=[self stringFromTime:slider.value*_theTimeAll];
_labelPlayTheTime.text=_thetimePlayStr;
}
#pragma mark - 全屏和不全屏的切换
-(void)fullScreenChange{
// BOOL is16B9 = [[P2PClient sharedClient] is16B9];
// if (!is16B9) {
// if (_isFullScreen) {
// _isFullScreen=NO;
// //开始切换为不全屏
// }else{
// _isFullScreen=YES;
// //开始切换为全屏
// }
// }
}
#pragma mark - 播放指定时间
-(void)playTimeTo:(NSTimeInterval)time{
[[P2PClient sharedClient] jump:time];
}
#pragma mark - 回调=视频回放挂断
-(void)P2PPlaybackReject:(NSDictionary *)info{
NSLog(@"回调=视频回放挂断");
//[self quitFullController];
//[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - 隐藏工具栏和显示工具栏
-(void)showToolsViewChange{
if (_viewBottomTools.top==(_theSizeOfScreen.height-_viewBottomTools.height)) {
[UIView animateWithDuration:0.26 animations:^{
_viewNaviBar.top=-_viewNaviBar.height;
_viewBottomTools.top=_theSizeOfScreen.height;
}];
}else{
[UIView animateWithDuration:0.26 animations:^{
_viewNaviBar.top=0;
_viewBottomTools.top=(_theSizeOfScreen.height-_viewBottomTools.height);
}];
}
}
#pragma mark - 隐藏任务栏
-(BOOL)prefersStatusBarHidden{
return YES;
}
#pragma mark - 按钮被单击
-(void)buttonBeClick:(FounderButton*)button{
if (button==_buttonPre) {
[self preVideo];
}
if (button==_buttonPause) {
[self playOrPause];
}
if (button==_buttonNext) {
[self nextVideo];
}
if (button==_buttonSpeed) {
[self speedVideo];
}
if (button==_buttonViewSpeed) {
[self speedVideo];
}
if (button==_buttonSilence) {
_isSilence=!_isSilence;
[self stSilence:_isSilence];
[self updateSilenceButtonWithPause:_isSilence];
}
if (button==_buttonBack) {
[self closeThePlay];
}
}
#pragma mark - 更新播放按钮
-(void)updatePauseButtonWithPause:(BOOL)pause{
if (!pause) {
[_buttonPause setImage:[UIImage imageNamed:@"FullPlay_Pause.png"] forState:UIControlStateNormal];
[_buttonPause setImage:[UIImage imageNamed:@"FullPlay_Pause_down.png"] forState:UIControlStateHighlighted];
}else{
[_buttonPause setImage:[UIImage imageNamed:@"FullPlay_Play.png"] forState:UIControlStateNormal];
[_buttonPause setImage:[UIImage imageNamed:@"FullPlay_Play_down.png"] forState:UIControlStateHighlighted];
}
}
#pragma mark - 更新静音按钮
-(void)updateSilenceButtonWithPause:(BOOL)silence{
if (silence) {
[_buttonSilence setImage:[UIImage imageNamed:@"FullPlay_Silence.png"] forState:UIControlStateNormal];
[_buttonSilence setImage:[UIImage imageNamed:@"FullPlay_Silence_down.png"] forState:UIControlStateHighlighted];
}else{
[_buttonSilence setImage:[UIImage imageNamed:@"FullPlay_NO_Silence.png"] forState:UIControlStateNormal];
[_buttonSilence setImage:[UIImage imageNamed:@"FullPlay_NO_Silence_down.png"] forState:UIControlStateHighlighted];
}
}
#pragma mark - 缩放手势(鱼眼设备)
-(void)onPinchToZoom:(UIPinchGestureRecognizer*)sender {
//鱼眼设备
// zoom in/out
if(sender.state == UIGestureRecognizerStateBegan){
}
else if(sender.state == UIGestureRecognizerStateEnded){
}else if(sender.state == UIGestureRecognizerStateChanged){
float fscale = [sender scale];
if(fscale>1)
{
//[_remoteView setZoomInOpenGLView];
}
else{
//[_remoteView setZoomOutOpenGLView];
}
}
}
-(void)panEvent:(UIPanGestureRecognizer*)sender{
if(sender.state == UIGestureRecognizerStateBegan){
//[_remoteView setKeyStatusInOpenGLView:0];//KEY_DOWN
}
else if(sender.state == UIGestureRecognizerStateEnded){
// [_remoteView setKeyStatusInOpenGLView:1];//KEY_UP
// [_remoteView setFlingInOpenGLViewX:[sender locationInView:_remoteView].x - self.swipeLastPos.x Y:[sender locationInView:_remoteView].y - self.swipeLastPos.y];
self.swipeLastPos = CGPointMake(0.0, 0.0);
}
else if(sender.state == UIGestureRecognizerStateChanged){
CGPoint point = [sender locationInView:_remoteView];
if(self.swipeLastPos.x != 0 && self.swipeLastPos.y != 0){
float x0, y0;
x0 = point.x - self.swipeLastPos.x;
y0 = point.y - self.swipeLastPos.y;
//[_remoteView setMoveStepInOpenGLViewX:point.x Y:point.y dX:x0 dY:y0];
}
self.swipeLastPos = point;
}
else if(sender.state == UIGestureRecognizerStateRecognized){
}
}
#pragma mark - 屏幕Autorotate
-(BOOL)shouldAutorotate{
return YES;
}
#pragma mark - 屏幕旋转
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
}
}
#pragma mark 支持哪些方向
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscapeRight;
}
-(void)quitFullController
{
//设置竖屏
[AppDelegate sharedDefault].canFullScreen = NO;
static int isFullScreen = 1; // 3 == 全屏 1 == 竖屏
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)])
{
NSLog(@"self.interfaceOrientation%ld",(long)UIDeviceOrientationPortrait);
//NSNumber *numb=[NSNumber numberWithInteger:UIDeviceOrientationPortrait];
//[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
// withObject:numb];
SEL selector = NSSelectorFromString(@"setOrientation:");
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:[UIDevice currentDevice]];
NSLog(@"-%d-",isFullScreen);
[invocation setArgument:&isFullScreen atIndex:2];
[invocation invoke];
}
}
@end
@@ -0,0 +1,15 @@
//
// PlayBaseViewController.h
// Ifish
//
// Created by imac on 16/12/16.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "YTheNaviBar.h"
@class FounderButton;
@interface PlayBaseViewController : UIViewController
@property(nonatomic,strong,nullable,readonly)YTheNaviBar* naviBar;
-(void)fButtonBackBeClick:(nullable FounderButton*)fbt;
@end
@@ -0,0 +1,86 @@
//
// PlayBaseViewController.m
// Ifish
//
// Created by imac on 16/12/16.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "PlayBaseViewController.h"
@interface PlayBaseViewController ()
@end
@implementation PlayBaseViewController
-(instancetype)init{
self=[super init];
if (self) {
_naviBar=[[YTheNaviBar alloc] init];
_naviBar.yBarColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"YNaviBar_bg.png"]];
_naviBar.yBarBottomLineColor=[UIColor clearColor];
FounderButton* fButtonBack=[[FounderButton alloc] init];
fButtonBack.buttonImageViewSize=CGSizeMake(20, 20);
[fButtonBack addTarget:self action:@selector(fButtonBackBeClick:) forControlEvents:UIControlEventTouchUpInside];
fButtonBack.tag=0;
fButtonBack.backgroundColor=[UIColor clearColor];
fButtonBack.frame=CGRectMake(0, 0, 40, 40);
[fButtonBack setImage:[UIImage imageNamed:@"YNavi_back_black_up.png"] forState:UIControlStateNormal];
[fButtonBack setImage:[UIImage imageNamed:@"YNavi_back_black_down.png"] forState:UIControlStateHighlighted];
_naviBar.yBarButtonsLeft=@[fButtonBack];
}
return self;
}
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
- (void)viewDidLoad{
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets=NO;
}
-(void)fButtonBackBeClick:(FounderButton*)fbt{
[self.navigationController popViewControllerAnimated:YES];
}
-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
-(void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
CGFloat TempW=self.view.width;
CGFloat TempH=[[UIApplication sharedApplication] isStatusBarHidden]?25:64;
CGFloat TempX=0;
CGFloat TempY=0;
CGRect newRect=CGRectMake(TempX, TempY, TempW, TempH);
_naviBar.frame=newRect;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)200*NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
[self.naviBar setNeedsLayout];
[self.naviBar layoutIfNeeded];
});
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
//NSString* cName=NSStringFromClass([self class]);
//[[BaiduMobStat defaultStat] pageviewStartWithName:cName];
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end