ifish/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishLivelist/IfishP2PLivePlayViewControl...

138 lines
3.5 KiB
Objective-C

//
// IfishP2PLivePlayViewController.m
// Ifish
//
// Created by imac on 16/11/11.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishP2PLivePlayViewController.h"
@interface IfishP2PLivePlayViewController ()<P2PShareViewBootomViewDelegate>
@end
@implementation IfishP2PLivePlayViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"分享中"];
self.view.backgroundColor = TABLE_BACKGROUD_COLOR;
[self resetBootomView];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBar.translucent = YES;
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.navigationController.navigationBar.translucent = NO;
}
-(void)resetBootomView{
CGFloat playViewH= self.view.bounds.size.width * 9 / 16;
P2PShareViewBootomView *bootomView = [[P2PShareViewBootomView alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(self.canvasView.frame), self.view.frame.size.width,self.view.frame.size.height - playViewH)];
[bootomView initDataWithRoomId:self.listRoomInfo.room_id];
bootomView.roomModel = self.listRoomInfo;
if (self.HbootmView) {
[self.HbootmView removeFromSuperview];
}
self.subHbottomView = bootomView;
self.subHbottomView.delegate = self;
[self.view addSubview:self.subHbottomView];
[self.view bringSubviewToFront:self.subHbottomView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)popularityAdd:(int)onLineP
{
NSLog(@"人气涨1");
// dispatch_async(dispatch_get_main_queue(), ^{
// [self.view makeToast:[NSString stringWithFormat:@"当前在线人数%d",onLineP]];
//});
//人气涨+
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool popularityValueRoomId:self.listRoomInfo.room_id userId:userId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]) {
NSString* popular = reDic[@"data"];
self.listRoomInfo.popularityValue = popular;
[self.subHbottomView.tableView reloadData];
}
} failure:^(NSError *err) {
}];
}
-(void)disHideSubControlerBootomm
{
self.subHbottomView.hidden= NO;
}
-(void)hideSubControlerBootomm
{
self.subHbottomView.hidden= YES;
}
#pragma mark -P2PShareViewBootomViewDelegate
//聊天
-(void)chatBtnClickAction
{
}
#pragma mark- 暂停 挂断
-(void)stopP2PPlayingGLViewVideo{
if ([self.player isPlaying]) {
[self.player p2pStop];
}
}
#pragma mark -已有人观看事件
-(void)alreadyHaveLookP
{
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"当前有人正在观看,请稍后再来观看" delegate:self cancelButtonTitle:@"知道了" otherButtonTitles:nil];
[alert show];
});
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//取消
[self stopP2PPlayingGLViewVideo];
///[self.remoteView getLastImgGoback];
[AppDelegate sharedDefault].canFullScreen = NO;
[self.navigationController popViewControllerAnimated:YES];
}
@end