DWVodPlayerView.m 145 KB
Newer Older
Han Ruisong's avatar
Han Ruisong committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
//  DWVodPlayerView.m
//  Demo
//
//  Created by zwl on 2019/4/15.
//  Copyright © 2019 com.bokecc.www. All rights reserved.
//

#import "DWVodPlayerView.h"
#import "DWPlayerFuncBgView.h"
#import "DWPlayerSlider.h"
#import "DWPlayerSettingView.h"
#import "DWTableChooseModel.h"
#import "DWMarkView.h"
#import "DWQuestionView.h"
#import "DWFeedBackView.h"
#import "DWSubtitleView.h"
#import "DWMessageView.h"
#import "Reachability.h"
#import <MediaPlayer/MediaPlayer.h>
#import "DWGIFManager.h"
#import "DWToastView.h"
#import "CustomDirectorFactory.h"
#import "DWGifRecordFinishView.h"
#import "DWVisitorCollectView.h"
Han Ruisong's avatar
Han Ruisong committed
26
27
#import "DWExercisesAlertView.h"
#import "DWExercisesView.h"
Han Ruisong's avatar
Han Ruisong committed
28
#import <AVKit/AVKit.h>
Han Ruisong's avatar
Han Ruisong committed
29
#import "DWVodPlayerPanGesture.h"
Han Ruisong's avatar
Han Ruisong committed
30
#import <AssetsLibrary/AssetsLibrary.h>
Han Ruisong's avatar
Han Ruisong committed
31
32
33
34
35
//弹幕
#import "OCBarrage.h"
#import "DWBarrageBgView.h"
#import "DWBarrageTextDescriptor.h"
#import "DWBarrageTextCell.h"
Han Ruisong's avatar
Han Ruisong committed
36

Han Ruisong's avatar
Han Ruisong committed
37
@interface DWVodPlayerView ()<DWVideoPlayerDelegate,DWPlayerSettingViewDelegate,DWGifRecordFinishViewDelegate,DWVisitorCollectViewDelegate,DWExercisesAlertViewDelegate,DWExercisesViewDelegate,AVPictureInPictureControllerDelegate,DWVodPlayerPanGestureDelegate,DWBarrageManagerDelegate,DWBarrageBgViewDelegate>
Han Ruisong's avatar
Han Ruisong committed
38
39
40
41
42
43
44
45
46
47
48
49

@property(nonatomic,strong)UIView * maskView;//遮罩层

@property(nonatomic,strong)DWVodVideoModel * videoModel;
@property(nonatomic,strong)DWDownloadModel * downloadModel;

//DWPlayerView
@property(nonatomic,strong)DWPlayerView * playerView;
//音频
@property(nonatomic,strong)UIView * radioBgView;
@property(nonatomic,strong)UIImageView * radioImageView;

Han Ruisong's avatar
Han Ruisong committed
50
//@property(nonatomic,assign)BOOL openWindowsPlay;//是否开启窗口播放功能
Han Ruisong's avatar
Han Ruisong committed
51
52
53
54
55
56
57
@property(nonatomic,assign)BOOL isWindowsPlay;//当前是否在小窗模式

@property(nonatomic,strong)UIPanGestureRecognizer * windowsPan;//窗口拖拽手势
@property(nonatomic,strong)UIButton * windowsCloseButton;
@property(nonatomic,strong)UIButton * windowsPlayOrPauseButton;
@property(nonatomic,strong)UIButton * windowsResumeButton;

Han Ruisong's avatar
Han Ruisong committed
58
59
60
//是否加载完毕
@property(nonatomic,assign)BOOL readyToPlay;

Han Ruisong's avatar
Han Ruisong committed
61
62
63
64
65
//是否开启后台播放
@property(nonatomic,assign)BOOL allowBackgroundPlay;
//是否开启画中画,仅对pad有效
@property(nonatomic,assign)BOOL allowPictureInPicture;

Han Ruisong's avatar
Han Ruisong committed
66
67
68
69
70
71
72
@property(nonatomic,assign)UIEdgeInsets areaInsets;
@property(nonatomic,assign)BOOL isFull;
@property(nonatomic,assign)BOOL isVideo;//当前播放模式 视频 / 音频
@property(nonatomic,assign)NSTimeInterval switchTime;
@property(nonatomic,assign)BOOL isSwitchquality;//是否切换清晰度
@property(nonatomic,assign)BOOL isLock;//锁屏

Han Ruisong's avatar
Han Ruisong committed
73
74
@property(nonatomic,strong)UITapGestureRecognizer * tap;//状态栏控制

Han Ruisong's avatar
Han Ruisong committed
75
76
@property(nonatomic,assign)CGSize titleLabelSize;

Han Ruisong's avatar
Han Ruisong committed
77
78
@property(nonatomic,assign)BOOL playRepeat;//是否进行过重试

Han Ruisong's avatar
Han Ruisong committed
79
80
81
82
83
84
85
86
//top
@property(nonatomic,strong)DWPlayerFuncBgView * topFuncBgView;
@property(nonatomic,strong)UIButton * backButton;//返回按钮
@property(nonatomic,strong)UILabel * titleLabel;//视频标题
@property(nonatomic,strong)UIButton * mediaKindButton;//媒体类型按钮
@property(nonatomic,strong)UIButton * otherFuncButton;//其他功能,字幕切换,画面尺寸之类的
@property(nonatomic,strong)UIButton * vrInteractiveButton;//vrButton
@property(nonatomic,strong)UIButton * vrDisplayButton;//vrButton
Han Ruisong's avatar
Han Ruisong committed
87
@property(nonatomic,strong)UIButton * screeningButton;//投屏按钮
Han Ruisong's avatar
Han Ruisong committed
88
@property(nonatomic,strong)UIButton * pipButton;//画中画按钮
Han Ruisong's avatar
Han Ruisong committed
89
@property(nonatomic,strong)UIButton * windowsButton;//窗口播放按钮
Han Ruisong's avatar
Han Ruisong committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

//bottom
@property(nonatomic,strong)DWPlayerFuncBgView * bottomFuncBgView;
@property(nonatomic,strong)UIButton * playOrPauseButton;//开始/暂停
@property(nonatomic,strong)UIButton * nextButton;//播放下一个视频
@property(nonatomic,strong)UILabel * currentLabel;//当前时间
@property(nonatomic,strong)UILabel * lineLabel;// /!!
@property(nonatomic,strong)UILabel * totalLabel;//总时间
@property(nonatomic,strong)DWPlayerSlider * slider;//进度条,
@property(nonatomic,strong)UIButton * speedButton;//倍速
@property(nonatomic,strong)UIButton * qualityButton;//画质,清晰度
@property(nonatomic,strong)UIButton * chooseButton;//选集
@property(nonatomic,strong)UIButton * rotateScreenButton;//横竖屏切换

@property(nonatomic,strong)UIButton * gifButton;//GIF录制
@property(nonatomic,strong)UIButton * disableGesButton;//禁用页面手势

Han Ruisong's avatar
Han Ruisong committed
107
108
@property(nonatomic,strong)UIButton * screenShotButton;//截屏按钮

Han Ruisong's avatar
Han Ruisong committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@property(nonatomic,strong)MBProgressHUD * hud;

//funcBgView 动画
@property(nonatomic,strong)NSTimer * funcTimer;//页面手势定时器
@property(nonatomic,assign)NSInteger funcSecond;//页面手势定时器 持续时间  默认4秒
@property(nonatomic,assign)BOOL isSlidering;//拖拽手势的定时器, 为了防止频繁拖拽引发的问题

@property(nonatomic,strong)DWPlayerSettingView * settingView;//当前设置页面

@property(nonatomic,strong)NSMutableArray <DWTableChooseModel *> * speedArray;//速率选择数据
@property(nonatomic,strong)NSMutableArray <DWTableChooseModel *> * qualityArray;//清晰度选择数据
@property(nonatomic,strong)NSMutableArray <DWTableChooseModel *> * sizeArray;//画面尺寸
@property(nonatomic,strong)NSMutableArray <DWTableChooseModel *> * selectionArray;//画面尺寸
@property(nonatomic,assign)CGFloat screenLight;//屏幕亮度
@property(nonatomic,assign)CGFloat systemSound;//系统音量
@property(nonatomic,strong)UISlider * volumeViewSlider;

@property(nonatomic,strong)Reachability * reachability; //网络状态监听

Han Ruisong's avatar
Han Ruisong committed
128
@property(nonatomic,strong)DWVodPlayerPanGesture * pan;//亮度,音量,快进快退调节
Han Ruisong's avatar
Han Ruisong committed
129

Han Ruisong's avatar
Han Ruisong committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
//**************************** 视频打点 ****************************
@property(nonatomic,strong)NSArray * videomarkArray;//打点数组
@property(nonatomic,strong)NSMutableArray * markButtonArray;//按钮的数组 取坐标
@property(nonatomic,assign)CGFloat markScrubtime;
@property(nonatomic,strong)DWMarkView * markView;//打点视图
@property(nonatomic,strong)UIImageView * arrowImageView;//箭头
@property(nonatomic,assign)CGFloat sliderWidth;
@property(nonatomic,assign)BOOL isShowMarkView;

//**************************** 视频问答 ****************************
@property(nonatomic,strong)NSArray * questionArray;//问答数组
@property(nonatomic,strong)DWQuestionView * questionView;//问题显示
@property(nonatomic,strong)DWFeedBackView * feedBackView;//回答正确或错误
@property(nonatomic,strong)NSMutableArray * questionIdsArray;//问题ID,做统计使用

//**************************** 视频字幕 ****************************
@property(nonatomic,strong)NSMutableArray <DWTableChooseModel *> * subTitleArray;//字幕数组
@property(nonatomic,strong)DWSubtitleView * subtitleView;

//**************************** 授权验证 ****************************
@property (nonatomic,assign)BOOL enable;//能否完整播放;
@property (nonatomic,strong)UILabel * messageLabel;//授权验证提示
@property (nonatomic,strong)DWMessageView * messageView;//试看结束提示

//**************************** gif录制 ****************************
@property (nonatomic,strong)UIView * gifView;
@property (nonatomic,strong)UIButton * gifCancelBtn;//GIF取消按钮
@property (nonatomic,strong)NSTimer * gifTimer;//GIF定时器
@property (nonatomic,assign)CGFloat clipTime;//截取的视频时间
@property (nonatomic,assign)NSInteger gifStartTime;//制作GIF的起始时间
@property (nonatomic,assign)NSInteger gifTotalTime;//制作GIF的总时间
@property (nonatomic,strong)DWGIFManager * gifManager;
@property (nonatomic,strong)MBProgressHUD * gifHud;
@property (nonatomic,assign)BOOL isGIF;
@property (nonatomic,assign)BOOL isFirstClick;
@property (nonatomic,strong)DWToastView * toastView;

//**************************** VR ****************************
@property (nonatomic,strong)UIView * vrView;
@property (nonatomic,strong)DWVRLibrary * vrLibrary;
@property (nonatomic,strong)DWVRConfiguration * config;
@property (nonatomic,assign)DWModeInteractive interative;//交互模式
@property (nonatomic,assign)DWModeDisplay display;//单双屏

//**************************** 访客信息收集器 ****************************
@property (nonatomic,strong)DWVisitorCollectView * visitorCollectView;

Han Ruisong's avatar
Han Ruisong committed
177
//**************************** 课堂练习 ****************************
Han Ruisong's avatar
Han Ruisong committed
178
179
180
181
@property (nonatomic,assign)CGFloat exercisesFrontScrubTime;//记录回退时间
@property (nonatomic,assign)CGFloat exercisesLastScrubTime;//记录当前时间
@property (nonatomic,strong)DWExercisesAlertView * exercisesAlertView;//课堂练习提示View
@property (nonatomic,strong)DWExercisesView * exercisesView;//课堂练习view
Han Ruisong's avatar
Han Ruisong committed
182

Han Ruisong's avatar
Han Ruisong committed
183
184
185
//**************************** airPlay ****************************
@property(nonatomic,strong)UILabel * airPlayStatusLabel;

Han Ruisong's avatar
Han Ruisong committed
186
187
188
//**************************** ipad PictureInPicture ****************************
@property(nonatomic,strong)AVPictureInPictureController * pipVC;

Han Ruisong's avatar
Han Ruisong committed
189
190
191
//@property(nonatomic,strong)UILabel * testLabel;
//@property(nonatomic,strong)NSTimer * testTimer;

Han Ruisong's avatar
Han Ruisong committed
192
//**************************** marquee ****************************
Han Ruisong's avatar
Han Ruisong committed
193
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
Han Ruisong's avatar
Han Ruisong committed
194
@property(nonatomic,strong)HDMarqueeView * marqueeView;
Han Ruisong's avatar
Han Ruisong committed
195
#endif
Han Ruisong's avatar
Han Ruisong committed
196

Han Ruisong's avatar
Han Ruisong committed
197
198
199
200
201
202
203
204
205
206
//**************************** 弹幕 ****************************
//弹幕数据
@property(nonatomic,strong)NSArray<DWBarrageModel *> * barragesArray;
//弹幕控制视图
@property(nonatomic,strong)DWBarrageBgView * barrageBgView;
//用于获取弹幕数据以及发送弹幕
@property(nonatomic,strong)DWBarrageManager * barrageManager;
//承载弹幕
@property(nonatomic,strong)OCBarrageManager * barrage;

Han Ruisong's avatar
Han Ruisong committed
207
208
209
210
211
212
213
@end

@implementation DWVodPlayerView

static CGFloat topFuncBgHeight = 39;
static CGFloat bottomFuncBgHeight = 39;
static const CGFloat gifSeconds = 0.25;
Han Ruisong's avatar
Han Ruisong committed
214
215
static CGFloat barrageBgHeight = 40;

Han Ruisong's avatar
Han Ruisong committed
216
217
218
219
220

-(instancetype)init
{
    if (self == [super init]) {
        
Han Ruisong's avatar
Han Ruisong committed
221
        [UIApplication sharedApplication].idleTimerDisabled = YES;
Han Ruisong's avatar
Han Ruisong committed
222
        
Han Ruisong's avatar
Han Ruisong committed
223
224
225
        self.isFull = NO;
        self.isShowMarkView = NO;
        self.isLock = NO;
Han Ruisong's avatar
Han Ruisong committed
226
        self.isScreening = NO;
Han Ruisong's avatar
Han Ruisong committed
227
        //是否允许后台播放
Han Ruisong's avatar
Han Ruisong committed
228
//        self.allowBackgroundPlay = YES;
Han Ruisong's avatar
Han Ruisong committed
229
        self.allowBackgroundPlay = NO;
Han Ruisong's avatar
Han Ruisong committed
230
        self.titleLabelSize = CGSizeZero;
Han Ruisong's avatar
Han Ruisong committed
231
        
Han Ruisong's avatar
Han Ruisong committed
232
233
        self.playRepeat = NO;
        
Han Ruisong's avatar
Han Ruisong committed
234
        //是否开启小窗播放
Han Ruisong's avatar
Han Ruisong committed
235
236
        //        self.openWindowsPlay = YES;
        
Han Ruisong's avatar
Han Ruisong committed
237
        self.isWindowsPlay = NO;
Han Ruisong's avatar
Han Ruisong committed
238
        
Han Ruisong's avatar
Han Ruisong committed
239
240
241
        //是否开启画中画
        self.allowPictureInPicture = NO;
        
Han Ruisong's avatar
Han Ruisong committed
242
243
244
245
246
247
248
249
250
        self.backgroundColor = [UIColor blackColor];
        
        [self initMaskView];
        [self initTopFuncView];
        [self initDownFuncView];
        [self initLeftFuncView];
        [self initPlayerView];
        [self initRadioView];
        [self initFuncGesture];
Han Ruisong's avatar
Han Ruisong committed
251
        [self initAirPlayView];
Han Ruisong's avatar
Han Ruisong committed
252
        [self initPlayerPanGesture];
Han Ruisong's avatar
Han Ruisong committed
253
254
        //设置弹幕视图
        [self initBarrageView];
Han Ruisong's avatar
Han Ruisong committed
255
256
257
258
259
260
261
262
263
        
        //初始化时,默认竖屏设置
        [self hideAndClearNotNecessaryView];
        [self reLayoutWithScreenState:self.isFull];
        
        //增加网络状态监听
        self.reachability = [Reachability reachabilityForInternetConnection];
        [self.reachability startNotifier];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kReachabilityChangedNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
264
        
Han Ruisong's avatar
Han Ruisong committed
265
266
267
268
269
270
271
272
        //开启远程控制
        [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
        [self remoteControlEvent];
        
        //增加前后台切换通知
        //回到前台
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterForegroundNotification) name:UIApplicationWillEnterForegroundNotification object:nil];
        // app退到后台
Han Ruisong's avatar
Han Ruisong committed
273
        //        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
274
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackgroundNotification) name:UIApplicationDidEnterBackgroundNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
275
276
277
        
        //airplay监听
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wirelessRouteActiveNotification:) name:MPVolumeViewWirelessRouteActiveDidChangeNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
278
        
Han Ruisong's avatar
Han Ruisong committed
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
        //        self.testLabel = [[UILabel alloc]init];
        //        self.testLabel.font = [UIFont systemFontOfSize:14];
        //        self.testLabel.textColor = [UIColor purpleColor];
        //        self.testLabel.textAlignment = NSTextAlignmentLeft;
        //        self.testLabel.numberOfLines = 0;
        //        [self addSubview:self.testLabel];
        //        [self.testLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        //            make.left.equalTo(@30);
        //            make.right.equalTo(@(-30));
        //            make.height.equalTo(@50);
        //            make.bottom.equalTo(self.bottomFuncBgView.mas_top).offset(-10);
        //        }];
        //
        //        self.testTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(testTimeAction) userInfo:nil repeats:YES];
        //        [[NSRunLoop mainRunLoop] addTimer:self.testTimer forMode:NSRunLoopCommonModes];
Han Ruisong's avatar
Han Ruisong committed
294
295
296
297
    }
    return self;
}

Han Ruisong's avatar
Han Ruisong committed
298
299
300
301
302
//-(void)testTimeAction
//{
//    self.testLabel.text = [NSString stringWithFormat:@"播放时长:%.2fs \n暂停时长:%.2fs",self.playerView.playedTimes,self.playerView.pausedTimes];
//}

Han Ruisong's avatar
Han Ruisong committed
303
304
-(void)dealloc
{
Han Ruisong's avatar
Han Ruisong committed
305
    [UIApplication sharedApplication].idleTimerDisabled = NO;
Han Ruisong's avatar
Han Ruisong committed
306
    
Han Ruisong's avatar
Han Ruisong committed
307
308
309
310
311
    //移除网络监听
    [self.reachability stopNotifier];
    self.reachability = nil;
    [[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
312
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
313
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPVolumeViewWirelessRouteActiveDidChangeNotification object:nil];
Han Ruisong's avatar
Han Ruisong committed
314
        
Han Ruisong's avatar
Han Ruisong committed
315
316
317
318
319
320
    NSLog(@"DWVodPlayerView dealloc");
}

#pragma mark - public
-(void)setVodVideo:(DWVodVideoModel *)videoModel
{
Han Ruisong's avatar
Han Ruisong committed
321
322
    //    _hud = [MBProgressHUD showHUDAddedTo:self.maskView animated:YES];
    //    _hud.label.text = @"努力加载中,请稍后";
Han Ruisong's avatar
Han Ruisong committed
323
324
    self.downloadModel = nil;
    
Han Ruisong's avatar
Han Ruisong committed
325
326
327
328
329
330
331
    [self showHudWithMessage:@"努力加载中,请稍后"];
    
    self.readyToPlay = NO;
    self.enable = YES;
    self.isSwitchquality = NO;
    
    self.videoModel = videoModel;
Han Ruisong's avatar
Han Ruisong committed
332
    
Han Ruisong's avatar
Han Ruisong committed
333
334
    self.playRepeat = NO;
    
Han Ruisong's avatar
Han Ruisong committed
335
    [self.playerView playVodViedo:videoModel withCustomId:nil];
Han Ruisong's avatar
Han Ruisong committed
336
    
Han Ruisong's avatar
Han Ruisong committed
337
    [self play];
Han Ruisong's avatar
Han Ruisong committed
338
    
Han Ruisong's avatar
Han Ruisong committed
339
340
    //处理视频清晰度数据
    [self dealQualityArray];
Han Ruisong's avatar
Han Ruisong committed
341
    
Han Ruisong's avatar
Han Ruisong committed
342
343
344
    //设置videoId,关联弹幕
    self.barrageManager.videoId = self.videoModel.videoId;
    
Han Ruisong's avatar
Han Ruisong committed
345
346
347
348
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
    //开启跑马灯功能
    [self initMarqueeView];
#endif
Han Ruisong's avatar
Han Ruisong committed
349
350
351
352
}

-(void)playLocalVideo:(DWDownloadModel *)downloadModel
{
Han Ruisong's avatar
Han Ruisong committed
353
354
    self.videoModel = nil;
    
Han Ruisong's avatar
Han Ruisong committed
355
356
357
358
359
    self.downloadModel  = downloadModel;
    self.enable = YES;
    
    self.readyToPlay = NO;
    
Han Ruisong's avatar
Han Ruisong committed
360
361
362
    //设置videoId,关联弹幕
    self.barrageManager.videoId = self.downloadModel.videoId;
    
Han Ruisong's avatar
Han Ruisong committed
363
364
365
366
367
368
369
370
371
372
    self.titleLabel.text = [downloadModel.othersInfo objectForKey:@"title"];
    [self.qualityButton setTitle:downloadModel.desp forState:UIControlStateNormal];
    
    [self initVRView];
    
    if ([downloadModel.mediaType isEqualToString:@"1"]) {
        [self changePlayerMediaType:YES];
    }else{
        [self changePlayerMediaType:NO];
    }
Han Ruisong's avatar
Han Ruisong committed
373
    
Han Ruisong's avatar
Han Ruisong committed
374
375
    [self.playerView playLocalVideo:downloadModel];
    [self play];
Han Ruisong's avatar
Han Ruisong committed
376
377
378
379
380
    
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
    //开启跑马灯功能
    [self initMarqueeView];
#endif
Han Ruisong's avatar
Han Ruisong committed
381
382
383
384
385
386
387
388
389
}

-(void)reLayoutWithScreenState:(BOOL)isFull
{
    self.isFull = isFull;
    
    [self hideAndClearNotNecessaryView];
    
    [self updateConstraintsAndHidden];
Han Ruisong's avatar
Han Ruisong committed
390
    
Han Ruisong's avatar
Han Ruisong committed
391
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
Han Ruisong's avatar
Han Ruisong committed
392
393
394
    if (self.marqueeView) {
        [self.marqueeView startMarquee];
    }
Han Ruisong's avatar
Han Ruisong committed
395
#endif
Han Ruisong's avatar
Han Ruisong committed
396
397
    
    [self.barrageBgView screenRotate:self.isFull];
Han Ruisong's avatar
Han Ruisong committed
398
399
400
401
402
}

-(void)play
{
    self.playOrPauseButton.selected = YES;
Han Ruisong's avatar
Han Ruisong committed
403
    self.windowsPlayOrPauseButton.selected = self.playOrPauseButton.selected;
Han Ruisong's avatar
Han Ruisong committed
404
405
406
407
408
409
    [self.playerView play];
}

-(void)pause
{
    self.playOrPauseButton.selected = NO;
Han Ruisong's avatar
Han Ruisong committed
410
    self.windowsPlayOrPauseButton.selected = self.playOrPauseButton.selected;
Han Ruisong's avatar
Han Ruisong committed
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
    [self.playerView pause];
}

//处理选集数据
-(void)setSelectionList:(NSArray *)selectionList
{
    _selectionList = selectionList;
    
    if (!selectionList) {
        return;
    }
    
    [self.selectionArray removeAllObjects];
    
    for (int i = 0; i < selectionList.count; i++) {
        DWVodModel * vodModel = [selectionList objectAtIndex:i];
        
        DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
        chooseModel.title = vodModel.title;
        [self.selectionArray addObject:chooseModel];
    }
Han Ruisong's avatar
Han Ruisong committed
432
    
Han Ruisong's avatar
Han Ruisong committed
433
434
435
436
437
}

//关闭播放器
-(void)closePlayer
{
Han Ruisong's avatar
Han Ruisong committed
438
439
    //    [self.testTimer invalidate];
    //    self.testTimer = nil;
Han Ruisong's avatar
Han Ruisong committed
440
    
Han Ruisong's avatar
Han Ruisong committed
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
    [self destroyFuncTimer];
    
    //清理player
    [self.playerView removeTimer];
    [self.playerView resetPlayer];
    
    //关闭远程控制
    [[UIApplication sharedApplication] endReceivingRemoteControlEvents];
    
    if (self.config) {
        self.config = nil;
    }
    if (self.vrLibrary) {
        self.vrLibrary = nil;
    }
}

//播放在线视频时,设置文件名
-(void)setVodModel:(DWVodModel *)vodModel
{
    _vodModel = vodModel;
    
    self.titleLabel.text = vodModel.title;
}

Han Ruisong's avatar
Han Ruisong committed
466
467
468
469
470
-(NSString *)videoTitle
{
    return self.titleLabel.text;
}

Han Ruisong's avatar
Han Ruisong committed
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
-(void)playFailureRepeat
{
    if (self.videoModel && !self.playRepeat) {
        //在线媒体,且未进行过重试
        if (self.playerView.qualityModel) {
            [self showHudWithMessage:@"努力加载中,请稍后"];
            [self.playerView switchQuality:self.playerView.qualityModel withCustomId:nil];
            [self play];
        }
            
        self.playRepeat = YES;
    }else{
        [@"播放失败,请重试" showAlert];
        
        [self hideHudWithMessage:nil];
    }
}

Han Ruisong's avatar
Han Ruisong committed
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
#pragma mark - function
//保存videoModel ,并对打点,问答,字幕等功能数据进行处理
-(void)setVideoModel:(DWVodVideoModel *)videoModel
{
    _videoModel = videoModel;
    
    self.titleLabel.text = videoModel.title;
    
    //处理VR
    [self initVRView];
    
    //处理选集数据
    [self dealChooseArray];
    
    //处理视频打点数据
    self.isShowMarkView = NO;
    if (videoModel.videomarks.count) {
        self.videomarkArray = videoModel.videomarks;
    }
    
    //处理问答数据
    self.questionArray = videoModel.questions;
    
    //处理字幕数据
    [self dealSubtitleArray];
    
    //处理授权验证数据
    if (videoModel.authorize) {
        [self dealAuthorizeData];
    }
Han Ruisong's avatar
Han Ruisong committed
519
    
Han Ruisong's avatar
Han Ruisong committed
520
521
522
523
524
}

//更新约束和控件状态
-(void)updateConstraintsAndHidden
{
Han Ruisong's avatar
Han Ruisong committed
525
526
527
528
529
    NSInteger buttonCount = 1;
    if (IS_PAD) {
        buttonCount++;
    }
    
Han Ruisong's avatar
Han Ruisong committed
530
    if (self.isFull) {
Han Ruisong's avatar
Han Ruisong committed
531
        
Han Ruisong's avatar
Han Ruisong committed
532
533
534
535
536
537
538
539
540
541
542
543
        [_playerView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        [_radioBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
        [_maskView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self);
        }];
        
Han Ruisong's avatar
Han Ruisong committed
544
545
546
        self.otherFuncButton.hidden = NO;
        self.speedButton.hidden = NO;
        self.qualityButton.hidden = !self.isVideo;
Han Ruisong's avatar
Han Ruisong committed
547
        
Han Ruisong's avatar
Han Ruisong committed
548
549
550
551
552
553
554
555
556
        if (self.downloadModel) {
            self.chooseButton.hidden = YES;
            self.nextButton.hidden = YES;
        }else{
            self.chooseButton.hidden = NO;
            self.nextButton.hidden = NO;
        }
        self.gifButton.hidden = NO;
        self.disableGesButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
557
        self.screenShotButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
558
559
560
561
562
563
564
565
566
567
568
569
        
        //根据状态 切换字幕
        [self switchSubtitleStyle];
        
        if (self.funcTimer) {
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@0);
                make.height.equalTo(@(20 + topFuncBgHeight));
            }];
            
            [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.bottom.equalTo(@0);
Han Ruisong's avatar
Han Ruisong committed
570
                make.height.equalTo(@(self.areaInsets.bottom + bottomFuncBgHeight + barrageBgHeight));
Han Ruisong's avatar
Han Ruisong committed
571
            }];
Han Ruisong's avatar
Han Ruisong committed
572

Han Ruisong's avatar
Han Ruisong committed
573
574
575
576
577
578
579
        }else{
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@(-(20 + topFuncBgHeight)));
                make.height.equalTo(@(20 + topFuncBgHeight));
            }];
            
            [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
580
581
                make.bottom.equalTo(@(self.areaInsets.bottom + bottomFuncBgHeight + barrageBgHeight));
                make.height.equalTo(@(self.areaInsets.bottom + bottomFuncBgHeight + barrageBgHeight));
Han Ruisong's avatar
Han Ruisong committed
582
583
            }];

Han Ruisong's avatar
Han Ruisong committed
584
585
        }
        
Han Ruisong's avatar
Han Ruisong committed
586
587
588
589
        UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
        UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation;
        
        if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
Han Ruisong's avatar
Han Ruisong committed
590
            
Han Ruisong's avatar
Han Ruisong committed
591
592
593
594
            [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-self.areaInsets.right));
            }];
            
Han Ruisong's avatar
Han Ruisong committed
595
596
597
598
599
600
            [_screenShotButton mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-self.areaInsets.right));
                make.centerY.equalTo(self.mas_centerY).offset(-24);
                make.width.and.height.equalTo(@30);
            }];
            
Han Ruisong's avatar
Han Ruisong committed
601
602
603
            [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(@10);
            }];
Han Ruisong's avatar
Han Ruisong committed
604
            
Han Ruisong's avatar
Han Ruisong committed
605
606
        }
        if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
Han Ruisong's avatar
Han Ruisong committed
607
            
Han Ruisong's avatar
Han Ruisong committed
608
609
610
611
            [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-10));
            }];
            
Han Ruisong's avatar
Han Ruisong committed
612
613
614
615
616
617
            [_screenShotButton mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-10));
                make.centerY.equalTo(self.mas_centerY).offset(-24);
                make.width.and.height.equalTo(@30);
            }];
            
Han Ruisong's avatar
Han Ruisong committed
618
619
620
            [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(@(self.areaInsets.left));
            }];
Han Ruisong's avatar
Han Ruisong committed
621
            
Han Ruisong's avatar
Han Ruisong committed
622
        }
Han Ruisong's avatar
Han Ruisong committed
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649

        [self.currentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@20);
            make.top.equalTo(@((barrageBgHeight - self.titleLabelSize.height) / 2.0));
            make.height.equalTo(@(self.titleLabelSize.height));
            make.width.equalTo(@(self.titleLabelSize.width));
        }];
        
        [self.totalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(@(-20));
            make.centerY.equalTo(self.currentLabel);
            make.height.equalTo(@(self.titleLabelSize.height));
            make.width.equalTo(@(self.titleLabelSize.width));
        }];
        
        [self.slider mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.currentLabel.mas_right).offset(15);
            make.right.equalTo(self.totalLabel.mas_left).offset(-15);
            make.height.equalTo(@30);
            make.centerY.equalTo(self.currentLabel);
        }];
        
        [self.playOrPauseButton mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(barrageBgHeight + 4.5));
            make.width.and.height.equalTo(@30);
            make.left.equalTo(@10);
        }];
Han Ruisong's avatar
Han Ruisong committed
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
        
        //本地模式 不显示选集按钮。页面控件做调整
        if (self.isVideo) {
            
            if (self.chooseButton.hidden) {
                [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 1) - 10));
                }];
                
                [_qualityButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 0) - 10));
                }];
            }else{
                [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 2) - 10));
                }];
                
                [_qualityButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 1) - 10));
                }];
                
                [_chooseButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 0) - 10));
                }];
            }
            
        }else{
            
            if (self.chooseButton.hidden) {
                [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 0) - 10));
                }];
            }else{
                [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 1) - 10));
                }];
                
                [_chooseButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-(40 * 0) - 10));
                }];
            }
        }
        
        //本地模式 ,不显示下一集按钮
        if (self.nextButton.hidden) {
            [_nextButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.playOrPauseButton.mas_right);
                make.width.equalTo(@0);
            }];
        }else{
            [_nextButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.playOrPauseButton.mas_right).offset(5);
                make.width.equalTo(@30);
            }];
        }
        
Han Ruisong's avatar
Han Ruisong committed
706
707
708
709
710
711
712
713
714
        [self.barrageBgView removeFromSuperview];
        [self.bottomFuncBgView addSubview:self.barrageBgView];
        [self.barrageBgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.nextButton.mas_right).offset(15);
            make.centerY.equalTo(self.playOrPauseButton);
            make.height.equalTo(@(barrageBgHeight));
            make.right.equalTo(self.speedButton.mas_left).offset(-15);
        }];
        
Han Ruisong's avatar
Han Ruisong committed
715
716
717
718
719
720
721
722
723
724
725
726
        //VR
        //此种方法组合可以实现Motion下的正确方向
        if (self.videoModel.vrmode == 1 || self.downloadModel.vrMode) {
            BOOL haveMotion = NO;
            if (_interative ==DWModeInteractiveMotion || _interative ==DWModeInteractiveMotionWithTouch) {
                haveMotion = YES;
            }
            if (haveMotion) {
                [self.vrLibrary switchInteractiveMode:DWModeInteractiveTouch];
                [self.vrLibrary switchInteractiveMode:DWModeInteractiveMotion];
            }
            [self.vrLibrary switchInteractiveMode:_interative];
Han Ruisong's avatar
Han Ruisong committed
727
            
Han Ruisong's avatar
Han Ruisong committed
728
            [_vrInteractiveButton mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
729
                make.right.equalTo(@(-(40 * buttonCount) - 10));
Han Ruisong's avatar
Han Ruisong committed
730
            }];
Han Ruisong's avatar
Han Ruisong committed
731
            
Han Ruisong's avatar
Han Ruisong committed
732
            [_vrDisplayButton mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
733
                make.right.equalTo(@(-(40 * (buttonCount + 1)) - 10));
Han Ruisong's avatar
Han Ruisong committed
734
            }];
Han Ruisong's avatar
Han Ruisong committed
735
        }
Han Ruisong's avatar
Han Ruisong committed
736
        
Han Ruisong's avatar
Han Ruisong committed
737
    }else{
Han Ruisong's avatar
Han Ruisong committed
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
        
        [_playerView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.and.top.equalTo(@0);
            make.width.equalTo(self);
            make.bottom.equalTo(@(-barrageBgHeight));
        }];
        
        [_radioBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.and.top.equalTo(@0);
            make.width.equalTo(self);
            make.bottom.equalTo(@(-barrageBgHeight));
        }];
        
        [_maskView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.and.top.equalTo(@0);
            make.width.equalTo(self);
            make.bottom.equalTo(@(-barrageBgHeight));
        }];
        
Han Ruisong's avatar
Han Ruisong committed
757
        self.mediaKindButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
758
        self.screeningButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
759
        self.windowsButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
760
        self.lineLabel.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
761
        
Han Ruisong's avatar
Han Ruisong committed
762
763
764
        self.rotateScreenButton.hidden = NO;
        //回复锁屏状态
        self.disableGesButton.selected = NO;
Han Ruisong's avatar
Han Ruisong committed
765
        self.screenShotButton.hidden = NO;
Han Ruisong's avatar
Han Ruisong committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
        self.isLock = NO;
        //如果正在录制gif ,取消
        if (self.isGIF) {
            [self gifCancelAction];
        }
        
        //隐藏字幕
        if (self.subtitleView) {
            [self.subtitleView switchSubtitleStyle:3];
        }
        
        if (self.funcTimer) {
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@0);
                make.height.equalTo(@(self.areaInsets.top + topFuncBgHeight));
            }];
Han Ruisong's avatar
Han Ruisong committed
782

Han Ruisong's avatar
Han Ruisong committed
783
            [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
784
                make.bottom.equalTo(@(-barrageBgHeight));
Han Ruisong's avatar
Han Ruisong committed
785
786
                make.height.equalTo(@(bottomFuncBgHeight));
            }];
Han Ruisong's avatar
Han Ruisong committed
787

Han Ruisong's avatar
Han Ruisong committed
788
789
790
791
792
793
794
795
796
797
798
        }else{
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@(-(self.areaInsets.top + topFuncBgHeight)));
                make.height.equalTo(@(self.areaInsets.top + topFuncBgHeight));
            }];
            
            [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.bottom.equalTo(@(bottomFuncBgHeight));
                make.height.equalTo(@(bottomFuncBgHeight));
            }];
        }
Han Ruisong's avatar
Han Ruisong committed
799
        
Han Ruisong's avatar
Han Ruisong committed
800
801
802
803
804
        [_nextButton mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.playOrPauseButton.mas_right);
            make.width.equalTo(@0);
        }];
        
Han Ruisong's avatar
Han Ruisong committed
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
        [self.playOrPauseButton mas_remakeConstraints:^(MASConstraintMaker *make) {
             make.top.equalTo(@(4.5));
             make.width.and.height.equalTo(@30);
             make.left.equalTo(@10);
         }];
        
        [_currentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.nextButton.mas_right).offset(5);
            make.centerY.equalTo(self.playOrPauseButton);
            make.height.equalTo(@(self.titleLabelSize.height));
            make.width.equalTo(@(self.titleLabelSize.width));
        }];
        [_lineLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.currentLabel.mas_right).offset(2.5);
            make.centerY.equalTo(self.playOrPauseButton);
            make.height.equalTo(@(self.lineLabel.frame.size.height));
            make.width.equalTo(@(self.lineLabel.frame.size.width));
        }];
        [_totalLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.lineLabel.mas_right).offset(2.5);
            make.centerY.equalTo(self.playOrPauseButton);
            make.height.equalTo(@(self.titleLabelSize.height));
            make.width.equalTo(@(self.titleLabelSize.width));
        }];
  
        [_slider mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.totalLabel.mas_right).offset(5);
            make.centerY.equalTo(self.playOrPauseButton);
            make.height.equalTo(@30);
Han Ruisong's avatar
Han Ruisong committed
834
835
            make.right.equalTo(@(-45));
        }];
Han Ruisong's avatar
Han Ruisong committed
836
837
838
839
840
841
842
843
844
845
846
847
848
849
        [_rotateScreenButton mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(@(-5));
            make.centerY.equalTo(self.playOrPauseButton);
            make.width.equalTo(@30);
            make.height.equalTo(@30);
        }];

        [self.barrageBgView removeFromSuperview];
        [self insertSubview:self.barrageBgView aboveSubview:self.bottomFuncBgView];
        [self.barrageBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(@0);
            make.left.and.right.equalTo(@0);
            make.height.equalTo(@(barrageBgHeight));
        }];
Han Ruisong's avatar
Han Ruisong committed
850
851
852
853
854
855
856
857
858
859
860
        
        if (self.videoModel.vrmode == 1 || self.downloadModel.vrMode) {
            BOOL haveMotion = NO;
            if (_interative == DWModeInteractiveMotion || _interative == DWModeInteractiveMotionWithTouch) {
                haveMotion =YES;
            }
            if (haveMotion) {
                [self.vrLibrary switchInteractiveMode:DWModeInteractiveTouch];
                [self.vrLibrary switchInteractiveMode:DWModeInteractiveMotion];
            }
            [self.vrLibrary switchInteractiveMode:_interative];
Han Ruisong's avatar
Han Ruisong committed
861
862
            
            [_vrInteractiveButton mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
863
                //                make.right.equalTo(@(-(40 * (buttonCount + 1)) - 10));
Han Ruisong's avatar
Han Ruisong committed
864
                make.right.equalTo(@(-(40 * (buttonCount + 2)) - 10));
Han Ruisong's avatar
Han Ruisong committed
865
866
867
            }];
            
            [_vrDisplayButton mas_updateConstraints:^(MASConstraintMaker *make) {
Han Ruisong's avatar
Han Ruisong committed
868
                //                make.right.equalTo(@(-(40 * (buttonCount + 2)) - 10));
Han Ruisong's avatar
Han Ruisong committed
869
                make.right.equalTo(@(-(40 * (buttonCount + 3)) - 10));
Han Ruisong's avatar
Han Ruisong committed
870
            }];
Han Ruisong's avatar
Han Ruisong committed
871
        }
Han Ruisong's avatar
Han Ruisong committed
872
        
Han Ruisong's avatar
Han Ruisong committed
873
874
875
876
877
        [_screenShotButton mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@10);
            make.centerY.equalTo(self);
            make.width.and.height.equalTo(@30);
        }];
Han Ruisong's avatar
Han Ruisong committed
878
879
880
881
882
883
    }
    
    //访客信息收集器
    if (self.visitorCollectView) {
        [self.visitorCollectView screenRotate:self.isFull];
    }
Han Ruisong's avatar
Han Ruisong committed
884
    
Han Ruisong's avatar
Han Ruisong committed
885
886
    [self setNeedsLayout];
    [self layoutIfNeeded];
Han Ruisong's avatar
Han Ruisong committed
887
    
Han Ruisong's avatar
Han Ruisong committed
888
889
890
    //修改弹幕视图frame
    self.barrage.renderView.frame = self.playerView.bounds;
    
Han Ruisong's avatar
Han Ruisong committed
891
892
    //获取到真实位置后,重置进度条位置
    [self.slider resetSubViewFrame];
Han Ruisong's avatar
Han Ruisong committed
893
894
895
896
897
898
899
900
}

//清理和隐藏页面控件
-(void)hideAndClearNotNecessaryView
{
    //top
    self.mediaKindButton.hidden = YES;
    self.otherFuncButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
901
    self.screeningButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
902
    self.windowsButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
903
904
905
906
907
908
909
    
    //bottom
    self.nextButton.hidden = YES;
    self.speedButton.hidden = YES;
    self.qualityButton.hidden = YES;
    self.chooseButton.hidden = YES;
    self.rotateScreenButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
910
911
    self.lineLabel.hidden = YES;
    
Han Ruisong's avatar
Han Ruisong committed
912
913
914
    //left
    self.gifButton.hidden = YES;
    self.disableGesButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
915
    self.screenShotButton.hidden = YES;
Han Ruisong's avatar
Han Ruisong committed
916
    
Han Ruisong's avatar
Han Ruisong committed
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
    //打点视图隐藏
    self.isShowMarkView = NO;
    [self showOrHiddenMarkView:YES];
    if (self.videomarkArray && self.videomarkArray.count) {
        //有打点数据
        [self dealMarkArray:self.videomarkArray];
    }
}

//处理清晰度数据
-(void)dealQualityArray
{
    [self.qualityArray removeAllObjects];
    
    if (!self.videoModel.videoQualities || self.videoModel.videoQualities.count == 0) {
        //无视频清晰度
        [self changePlayerMediaType:NO];
    }else if (!self.videoModel.radioQualities || self.videoModel.radioQualities.count == 0){
        //无音频清晰度
        [self changePlayerMediaType:YES];
    }else{
        [self changePlayerMediaType:YES];
    }
    
    for (DWVideoQualityModel * quality in self.videoModel.videoQualities) {
        DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
        chooseModel.title = quality.desp;
        if ([quality.quality isEqualToString:self.playerView.qualityModel.quality]) {
            chooseModel.isSelect = YES;
        }else{
            chooseModel.isSelect = NO;
        }
        [self.qualityArray addObject:chooseModel];
    }
    
    [self.qualityButton setTitle:self.playerView.qualityModel.desp forState:UIControlStateNormal];
}

//处理选集默认数据
-(void)dealChooseArray
{
    if (self.selectionArray.count == 0) {
        return;
    }
    
    for (int i = 0; i < self.selectionList.count; i++) {
        DWTableChooseModel * chooseModel = [self.selectionArray objectAtIndex:i];
        //这里应该是拿videoId做判断
        DWVodModel * vodModel = [self.selectionList objectAtIndex:i];
        if ([vodModel.videoId isEqualToString:self.videoModel.videoId]) {
            chooseModel.isSelect = YES;
        }else{
            chooseModel.isSelect = NO;
        }
    }
}

//切换页面播放模式
-(void)changePlayerMediaType:(BOOL)isVideo
{
    self.mediaKindButton.selected = !isVideo;
    self.isVideo = isVideo;
    if (self.isVideo) {
        self.radioBgView.hidden = YES;
        if (self.videoModel.vrmode == 1 || self.downloadModel.vrMode) {
            self.vrView.hidden = NO;
        }else{
            self.playerView.hidden = NO;
        }
    }else{
        self.radioBgView.hidden = NO;
        self.playerView.hidden = YES;
    }
    
    //清理视频打点数据
    if (self.videomarkArray && self.videomarkArray.count) {
        [self dealMarkArray:self.videoModel.videomarks];
    }
    
    //取消gif录制
    if (self.isGIF) {
        [self gifCancelAction];
    }
    
    if (self.isFull) {
        self.qualityButton.hidden = !self.isVideo;
        if (self.isVideo) {
            //显示清晰度按钮
            [_slider mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-(40 * 3) - 10 - 5));
            }];
            
            [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-(40 * 2) - 10));
            }];
        }else{
            //隐藏清晰度按钮
            [_slider mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-(40 * 2) - 10 - 5));
            }];
            
            [_speedButton mas_updateConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(@(-(40 * 1) - 10));
            }];
        }
    }
Han Ruisong's avatar
Han Ruisong committed
1023
    
Han Ruisong's avatar
Han Ruisong committed
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
}

//切换清晰度
-(void)switchQuality:(DWVideoQualityModel *)qualityModel
{
    if (!qualityModel) {
        [_hud hideAnimated:NO];
        [@"暂未找到当前清晰度,请检查数据" showAlert];
        return;
    }
    
    self.readyToPlay = NO;
    
Han Ruisong's avatar
Han Ruisong committed
1037
1038
    self.playRepeat = NO;
    
Han Ruisong's avatar
Han Ruisong committed
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
    //如果VR视图存在,需要重新创建
    if (self.vrView) {
        [self.vrView removeFromSuperview];
        self.vrView = nil;
    }
    [self initVRView];
    
    if ([qualityModel.mediaType isEqualToString:@"1"] && !self.isVideo) {
        [self changePlayerMediaType:YES];
    }else if ([qualityModel.mediaType isEqualToString:@"2"] && self.isVideo) {
        [self changePlayerMediaType:NO];
    }
    
    //修改当前清晰度
    if (self.isVideo) {
        NSInteger selectIndex = [self.videoModel.videoQualities indexOfObject:qualityModel];
        DWTableChooseModel * chooseModel = [self.qualityArray objectAtIndex:selectIndex];
        if (!chooseModel.isSelect) {
            for (DWTableChooseModel * chooseModel in self.qualityArray) {
                if (chooseModel.isSelect) {
                    chooseModel.isSelect = NO;
                    break;
                }
            }
        }
        chooseModel.isSelect = YES;
    }
    
    //清理默认值
    self.currentLabel.text = @"00:00";
    self.totalLabel.text = @"00:00";
    self.slider.value = 0;
    self.slider.bufferValue = 0;
    self.isSwitchquality = YES;
    self.switchTime = CMTimeGetSeconds([self.playerView.player currentTime]);
    
    [self pause];
Han Ruisong's avatar
Han Ruisong committed
1076
1077
1078
    
    //    _hud = [MBProgressHUD showHUDAddedTo:self.maskView animated:YES];
    //    _hud.label.text = @"切换清晰度,请稍后";
Han Ruisong's avatar
Han Ruisong committed
1079
    [self showHudWithMessage:@"切换中..."];
Han Ruisong's avatar
Han Ruisong committed
1080
    
Han Ruisong's avatar
Han Ruisong committed
1081
    //    self.currentQualityModel = qualityModel;
Han Ruisong's avatar
Han Ruisong committed
1082
1083
1084
    
    [self.qualityButton setTitle:qualityModel.desp forState:UIControlStateNormal];
    [self.playerView switchQuality:qualityModel withCustomId:nil];
Han Ruisong's avatar
Han Ruisong committed
1085
1086
1087
1088
1089
    
    //如果播放加密视频时,SDK解密服务需要一定的时间启动,这里延迟执行play。
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self play];
    });
Han Ruisong's avatar
Han Ruisong committed
1090
    //    [self play];
Han Ruisong's avatar
Han Ruisong committed
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
}

-(void)showHudWithMessage:(NSString *)message
{
    if (_hud) {
        [_hud hideAnimated:NO];
        self.hud = nil;
    }
    _hud = [MBProgressHUD showHUDAddedTo:self.maskView animated:YES];
    _hud.label.text = message;
}

-(void)hideHudWithMessage:(NSString *)message
{
    if (_hud) {
        if (message) {
            _hud.label.text = message;
            [_hud hideAnimated:YES afterDelay:2];
        }else{
            [_hud hideAnimated:YES];
        }
    }
    self.hud = nil;
}

//记忆播放
-(void)saveNsUserDefaults
{
    if (!self.videoModel && !self.downloadModel) {
        return;
    }
    
    NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
    NSNumber * playTime = [NSNumber numberWithFloat:CMTimeGetSeconds([self.playerView.player currentTime])];
    if (self.videoModel) {
        [userDefaults setValue:playTime forKey:self.videoModel.videoId];
    }else{
        [userDefaults setValue:playTime forKey:self.downloadModel.filePath];
    }
    [userDefaults synchronize];
}

-(void)readNSUserDefaults
{
    if (!self.videoModel && !self.downloadModel) {
        return;
    }
    
    CGFloat playTime = 0;
    NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
    
    id saveTime = nil;
    if (self.videoModel) {
        saveTime = [userDefaults objectForKey:self.videoModel.videoId];
    }else{
        saveTime = [userDefaults objectForKey:self.downloadModel.filePath];
    }
    if ([saveTime isKindOfClass:[NSDictionary class]]) {
        //旧版本存储的播放数据
        playTime = [[saveTime objectForKey:@"playbackTime"] floatValue];
    }else{
        playTime = [saveTime floatValue];
    }
    
    //若不考虑旧版本的兼容性问题,这里直接获取即可
Han Ruisong's avatar
Han Ruisong committed
1156
1157
1158
1159
1160
    //    if (self.videoModel) {
    //        playTime = [[userDefaults objectForKey:self.videoModel.videoId] floatValue];
    //    }else{
    //        playTime = [[userDefaults objectForKey:self.downloadModel.filePath] floatValue];
    //    }
Han Ruisong's avatar
Han Ruisong committed
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
    
    self.switchTime = playTime;
}

//切换备用线路
-(void)switchSparLine
{
    if (self.playerView.isSpar) {
        [@"当前已经是备用线路了" showAlert];
        return;
    }
    
    [self showHudWithMessage:@"切换线路中,请稍后"];
    
    //记录当前播放到的时间
    if (!CMTimeCompare(self.playerView.player.currentTime, kCMTimeZero)) {
        self.switchTime = CMTimeGetSeconds([self.playerView.player currentTime]);
    }
    
    [self.playerView switchSparPlayLine];
    
}

Han Ruisong's avatar
Han Ruisong committed
1184
-(void)startDownloadTask:(DWVodVideoModel *)vodVideo
Han Ruisong's avatar
Han Ruisong committed
1185
{
Han Ruisong's avatar
Han Ruisong committed
1186
    DWVideoQualityModel * qualitiyModel = self.playerView.qualityModel;
Han Ruisong's avatar
Han Ruisong committed
1187
    
Han Ruisong's avatar
Han Ruisong committed
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
    DWDownloadSessionManager * manager = [DWDownloadSessionManager manager];
    //验证当前任务是否已经在下载队列中
    if ([manager checkLocalResourceWithVideoId:self.videoModel.videoId WithQuality:qualitiyModel.quality]) {
        [@"当前任务已经在下载队列中" showAlert];
        return;
    }
    
    NSString * imageUrl = nil;
    NSString * title = @"";
    if (self.vodModel) {
        imageUrl = self.vodModel.imageUrl;
        title = self.vodModel.title;
Han Ruisong's avatar
Han Ruisong committed
1200
    }else{
Han Ruisong's avatar
Han Ruisong committed
1201
        imageUrl = @"icon_placeholder.png";
Han Ruisong's avatar
Han Ruisong committed
1202
    }
Han Ruisong's avatar
Han Ruisong committed
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
    
    DWDownloadModel * model = [DWDownloadSessionManager createDownloadModel:vodVideo Quality:qualitiyModel.quality AndOthersInfo:@{@"imageUrl":imageUrl,@"title":title}];
    
    if (!model) {
        [@"DownloadModel创建失败,请检查参数" showAlert];
        return;
    }
    
    [manager startWithDownloadModel:model];
    
    [[NSString stringWithFormat:@"开始下载:%@",vodVideo.title] showAlert];
Han Ruisong's avatar
Han Ruisong committed
1214
1215
}

Han Ruisong's avatar
Han Ruisong committed
1216
1217
1218
#pragma mark - func Timer
-(void)initFuncGesture
{
Han Ruisong's avatar
Han Ruisong committed
1219
1220
    self.tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(funcIsAppearTap)];
    [self addGestureRecognizer:self.tap];
Han Ruisong's avatar
Han Ruisong committed
1221
    
Han Ruisong's avatar
Han Ruisong committed
1222
1223
1224
1225
1226
    [self createFuncTimer];
}

-(void)funcIsAppearTap
{
Han Ruisong's avatar
Han Ruisong committed
1227
1228
1229
1230
1231
    //新增判断,画中画启动时,不显示状态栏
    if (self.pipVC && self.pipVC.isPictureInPictureActive) {
        return;
    }
    
Han Ruisong's avatar
Han Ruisong committed
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
    if (self.funcTimer) {
        self.isShowMarkView = NO;
        [self destroyFuncTimer];
    }else{
        [self createFuncTimer];
    }
}

//func timer 相关
-(void)createFuncTimer
{
    self.funcSecond = 4;
    
    if (self.funcTimer) {
        [self.funcTimer invalidate];
        self.funcTimer = nil;
    }
    
    self.funcTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(funcTimerAction) userInfo:nil repeats:YES];
    
    [self funcBgViewIsAppear:YES];
}

-(void)destroyFuncTimer
{
    if (self.funcTimer) {
        [self.funcTimer invalidate];
        self.funcTimer = nil;
    }
    
    [self funcBgViewIsAppear:NO];
}

-(void)funcTimerAction
{
    if (self.funcSecond == 0) {
        [self destroyFuncTimer];
        return;
    }
    
    self.funcSecond--;
}

-(void)funcBgViewIsAppear:(BOOL)appear
{
    CGFloat topHeight = self.isFull ? 20 + topFuncBgHeight : self.areaInsets.top + topFuncBgHeight;
Han Ruisong's avatar
Han Ruisong committed
1278
1279
1280

    CGFloat bottomHeight = self.isFull ? self.areaInsets.bottom + bottomFuncBgHeight + barrageBgHeight : bottomFuncBgHeight;

Han Ruisong's avatar
Han Ruisong committed
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation;
    
    if (self.isLock) {
        [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(-topHeight));
            make.height.equalTo(@(topHeight));
        }];
        
        [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(@(bottomHeight));
            make.height.equalTo(@(bottomHeight));
        }];
        
        if (appear) {
            if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
                
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1302
1303
1304
1305
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1306
1307
1308
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@10);
                }];
Han Ruisong's avatar
Han Ruisong committed
1309
                
Han Ruisong's avatar
Han Ruisong committed
1310
1311
1312
1313
1314
1315
            }
            if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(10 + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1316
1317
1318
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(10 + 30));
                }];
Han Ruisong's avatar
Han Ruisong committed
1319
                
Han Ruisong's avatar
Han Ruisong committed
1320
1321
1322
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@(self.areaInsets.left));
                }];
Han Ruisong's avatar
Han Ruisong committed
1323
                
Han Ruisong's avatar
Han Ruisong committed
1324
1325
1326
1327
1328
1329
1330
1331
            }
        }else{
            if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
                
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1332
1333
1334
1335
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1336
1337
1338
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@(-10 - 30));
                }];
Han Ruisong's avatar
Han Ruisong committed
1339
                
Han Ruisong's avatar
Han Ruisong committed
1340
1341
1342
1343
1344
1345
1346
            }
            if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
                
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(10 + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1347
1348
1349
1350
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(10 + 30));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1351
1352
1353
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@(-self.areaInsets.left - 30));
                }];
Han Ruisong's avatar
Han Ruisong committed
1354
                
Han Ruisong's avatar
Han Ruisong committed
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
            }
        }
    }else{
        if (appear) {
            if (self.topFuncBgView.frame.origin.y == 0) {
                return;
            }
            
            if (self.isGIF) {
                return;
            }
            
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@0);
                make.height.equalTo(@(topHeight));
            }];
            
Han Ruisong's avatar
Han Ruisong committed
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
            if (self.isFull) {
                [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.bottom.equalTo(@0);
                    make.height.equalTo(@(bottomHeight));
                }];
            }else{
                [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.bottom.equalTo(@(-barrageBgHeight));
                    make.height.equalTo(@(bottomHeight));
                }];
            }
Han Ruisong's avatar
Han Ruisong committed
1383
1384
1385
1386
1387
1388
1389
            
            if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
                
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-self.areaInsets.right));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1390
1391
1392
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-self.areaInsets.right));
                }];
Han Ruisong's avatar
Han Ruisong committed
1393
                
Han Ruisong's avatar
Han Ruisong committed
1394
1395
1396
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@10);
                }];
Han Ruisong's avatar
Han Ruisong committed
1397
                
Han Ruisong's avatar
Han Ruisong committed
1398
1399
1400
1401
1402
1403
1404
            }
            if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
                
                [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-10));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1405
1406
1407
1408
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(-10));
                }];
                
Han Ruisong's avatar
Han Ruisong committed
1409
1410
1411
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@(self.areaInsets.left));
                }];
Han Ruisong's avatar
Han Ruisong committed
1412
                
Han Ruisong's avatar
Han Ruisong committed
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
            }
            
            if (self.isShowMarkView && self.isFull) {
                [self showOrHiddenMarkView:NO];
            }else{
                [self showOrHiddenMarkView:YES];
            }
            
        }else{
            if (self.topFuncBgView.frame.origin.y == -self.topFuncBgView.frame.size.height) {
                return;
            }
Han Ruisong's avatar
Han Ruisong committed
1425
            
Han Ruisong's avatar
Han Ruisong committed
1426
1427
1428
1429
1430
1431
1432
1433
1434
            [_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(@(-topHeight));
                make.height.equalTo(@(topHeight));
            }];
            
            [_bottomFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.bottom.equalTo(@(bottomHeight));
                make.height.equalTo(@(bottomHeight));
            }];
Han Ruisong's avatar
Han Ruisong committed
1435
            
Han Ruisong's avatar
Han Ruisong committed
1436
1437
1438
1439
1440
1441
1442
1443
            if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
                
                if (!self.isGIF) {
                    //如果正在录制gif ,按钮不动
                    [_gifButton mas_updateConstraints:^(MASConstraintMaker *make) {
                        make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                    }];
                }
Han Ruisong's avatar
Han Ruisong committed
1444
1445
1446
1447
                
                [_screenShotButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.right.equalTo(@(ScreenWidth + self.areaInsets.right + 30));
                }];
Han Ruisong's avatar
Han Ruisong committed
1448
                
Han Ruisong's avatar
Han Ruisong committed
1449
1450
1451
                [_disableGesButton mas_updateConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(@(-10 - 30));
                }];
Han Ruisong's avatar
Han Ruisong committed
1452