hyzp_ybqx-Commit001:代码刚转换好,编译通过
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// MMMaterialDesignSpinner.h
|
||||
// Pods
|
||||
//
|
||||
// Created by Michael Maxwell on 12/28/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for MMMaterialDesignSpinner.
|
||||
FOUNDATION_EXPORT double MMMaterialDesignSpinnerVersionNumber;
|
||||
|
||||
//! Project version string for MMMaterialDesignSpinner.
|
||||
FOUNDATION_EXPORT const unsigned char MMMaterialDesignSpinnerVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Cent/PublicHeader.h>
|
||||
|
||||
/**
|
||||
* A control similar to iOS' UIActivityIndicatorView modeled after Google's Material Design Activity spinner.
|
||||
*/
|
||||
@interface MMMaterialDesignSpinner : UIView
|
||||
|
||||
/** Sets the line width of the spinner's circle. */
|
||||
@property (nonatomic) CGFloat lineWidth;
|
||||
|
||||
/** Sets whether the view is hidden when not animating. */
|
||||
@property (nonatomic) BOOL hidesWhenStopped;
|
||||
|
||||
/** Specifies the timing function to use for the control's animation. Defaults to kCAMediaTimingFunctionEaseInEaseOut */
|
||||
@property (nonatomic, strong) CAMediaTimingFunction *timingFunction;
|
||||
|
||||
/** Property indicating whether the view is currently animating. */
|
||||
@property (nonatomic, readonly) BOOL isAnimating;
|
||||
|
||||
/** Property indicating the duration of the animation, default is 1.5s. Should be set prior to -[startAnimating] */
|
||||
@property (nonatomic, readwrite) NSTimeInterval duration;
|
||||
|
||||
/**
|
||||
* Convenience function for starting & stopping animation with a boolean variable instead of explicit
|
||||
* method calls.
|
||||
*
|
||||
* @param animate true to start animating, false to stop animating.
|
||||
@note This method simply calls the startAnimating or stopAnimating methods based on the value of the animate parameter.
|
||||
*/
|
||||
- (void)setAnimating:(BOOL)animate;
|
||||
|
||||
/**
|
||||
* Starts animation of the spinner.
|
||||
*/
|
||||
- (void)startAnimating;
|
||||
|
||||
/**
|
||||
* Stops animation of the spinnner.
|
||||
*/
|
||||
- (void)stopAnimating;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,201 @@
|
||||
//
|
||||
// MMMaterialDesignSpinner.m
|
||||
// Pods
|
||||
//
|
||||
// Created by Michael Maxwell on 12/28/14.
|
||||
//
|
||||
//
|
||||
|
||||
#import "MMMaterialDesignSpinner.h"
|
||||
|
||||
static NSString *kMMRingStrokeAnimationKey = @"mmmaterialdesignspinner.stroke";
|
||||
static NSString *kMMRingRotationAnimationKey = @"mmmaterialdesignspinner.rotation";
|
||||
|
||||
@interface MMMaterialDesignSpinner ()
|
||||
@property (nonatomic, readonly) CAShapeLayer *progressLayer;
|
||||
@property (nonatomic, readwrite) BOOL isAnimating;
|
||||
@end
|
||||
|
||||
@implementation MMMaterialDesignSpinner
|
||||
|
||||
@synthesize progressLayer=_progressLayer;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initialize];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
if (self = [super initWithCoder:aDecoder]) {
|
||||
[self initialize];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
[self initialize];
|
||||
}
|
||||
|
||||
- (void)initialize {
|
||||
self.duration = 1.5f;
|
||||
_timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
|
||||
[self.layer addSublayer:self.progressLayer];
|
||||
|
||||
// See comment in resetAnimations on why this notification is used.
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetAnimations) name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
|
||||
self.progressLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
|
||||
[self updatePath];
|
||||
}
|
||||
|
||||
- (void)tintColorDidChange {
|
||||
[super tintColorDidChange];
|
||||
|
||||
self.progressLayer.strokeColor = self.tintColor.CGColor;
|
||||
}
|
||||
|
||||
- (void)resetAnimations {
|
||||
// If the app goes to the background, returning it to the foreground causes the animation to stop (even though it's not explicitly stopped by our code). Resetting the animation seems to kick it back into gear.
|
||||
if (self.isAnimating) {
|
||||
[self stopAnimating];
|
||||
[self startAnimating];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setAnimating:(BOOL)animate {
|
||||
(animate ? [self startAnimating] : [self stopAnimating]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)startAnimating {
|
||||
if (self.isAnimating)
|
||||
return;
|
||||
|
||||
CABasicAnimation *animation = [CABasicAnimation animation];
|
||||
animation.keyPath = @"transform.rotation";
|
||||
animation.duration = self.duration / 0.375f;
|
||||
animation.fromValue = @(0.f);
|
||||
animation.toValue = @(2 * M_PI);
|
||||
animation.repeatCount = INFINITY;
|
||||
animation.removedOnCompletion = NO;
|
||||
[self.progressLayer addAnimation:animation forKey:kMMRingRotationAnimationKey];
|
||||
|
||||
CABasicAnimation *headAnimation = [CABasicAnimation animation];
|
||||
headAnimation.keyPath = @"strokeStart";
|
||||
headAnimation.duration = self.duration / 1.5f;
|
||||
headAnimation.fromValue = @(0.f);
|
||||
headAnimation.toValue = @(0.25f);
|
||||
headAnimation.timingFunction = self.timingFunction;
|
||||
|
||||
CABasicAnimation *tailAnimation = [CABasicAnimation animation];
|
||||
tailAnimation.keyPath = @"strokeEnd";
|
||||
tailAnimation.duration = self.duration / 1.5f;
|
||||
tailAnimation.fromValue = @(0.f);
|
||||
tailAnimation.toValue = @(1.f);
|
||||
tailAnimation.timingFunction = self.timingFunction;
|
||||
|
||||
|
||||
CABasicAnimation *endHeadAnimation = [CABasicAnimation animation];
|
||||
endHeadAnimation.keyPath = @"strokeStart";
|
||||
endHeadAnimation.beginTime = self.duration / 1.5f;
|
||||
endHeadAnimation.duration = self.duration / 3.0f;
|
||||
endHeadAnimation.fromValue = @(0.25f);
|
||||
endHeadAnimation.toValue = @(1.f);
|
||||
endHeadAnimation.timingFunction = self.timingFunction;
|
||||
|
||||
CABasicAnimation *endTailAnimation = [CABasicAnimation animation];
|
||||
endTailAnimation.keyPath = @"strokeEnd";
|
||||
endTailAnimation.beginTime = self.duration / 1.5f;
|
||||
endTailAnimation.duration = self.duration / 3.0f;
|
||||
endTailAnimation.fromValue = @(1.f);
|
||||
endTailAnimation.toValue = @(1.f);
|
||||
endTailAnimation.timingFunction = self.timingFunction;
|
||||
|
||||
CAAnimationGroup *animations = [CAAnimationGroup animation];
|
||||
[animations setDuration:self.duration];
|
||||
[animations setAnimations:@[headAnimation, tailAnimation, endHeadAnimation, endTailAnimation]];
|
||||
animations.repeatCount = INFINITY;
|
||||
animations.removedOnCompletion = NO;
|
||||
[self.progressLayer addAnimation:animations forKey:kMMRingStrokeAnimationKey];
|
||||
|
||||
|
||||
self.isAnimating = true;
|
||||
|
||||
if (self.hidesWhenStopped) {
|
||||
self.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopAnimating {
|
||||
if (!self.isAnimating)
|
||||
return;
|
||||
|
||||
[self.progressLayer removeAnimationForKey:kMMRingRotationAnimationKey];
|
||||
[self.progressLayer removeAnimationForKey:kMMRingStrokeAnimationKey];
|
||||
self.isAnimating = false;
|
||||
|
||||
if (self.hidesWhenStopped) {
|
||||
self.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)updatePath {
|
||||
CGPoint center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
|
||||
CGFloat radius = MIN(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2) - self.progressLayer.lineWidth / 2;
|
||||
CGFloat startAngle = (CGFloat)(0);
|
||||
CGFloat endAngle = (CGFloat)(2*M_PI);
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
|
||||
self.progressLayer.path = path.CGPath;
|
||||
|
||||
self.progressLayer.strokeStart = 0.f;
|
||||
self.progressLayer.strokeEnd = 0.f;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (CAShapeLayer *)progressLayer {
|
||||
if (!_progressLayer) {
|
||||
_progressLayer = [CAShapeLayer layer];
|
||||
_progressLayer.strokeColor = self.tintColor.CGColor;
|
||||
_progressLayer.fillColor = nil;
|
||||
_progressLayer.lineWidth = 1.5f;
|
||||
}
|
||||
return _progressLayer;
|
||||
}
|
||||
|
||||
- (BOOL)isAnimating {
|
||||
return _isAnimating;
|
||||
}
|
||||
|
||||
- (CGFloat)lineWidth {
|
||||
return self.progressLayer.lineWidth;
|
||||
}
|
||||
|
||||
- (void)setLineWidth:(CGFloat)lineWidth {
|
||||
self.progressLayer.lineWidth = lineWidth;
|
||||
[self updatePath];
|
||||
}
|
||||
|
||||
- (void)setHidesWhenStopped:(BOOL)hidesWhenStopped {
|
||||
_hidesWhenStopped = hidesWhenStopped;
|
||||
self.hidden = !self.isAnimating && hidesWhenStopped;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// PlayerSlider.h
|
||||
// Slider
|
||||
//
|
||||
// Created by annidyfeng on 2018/8/27.
|
||||
// Copyright © 2018年 annidy. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface PlayerPoint : NSObject
|
||||
@property GLfloat where;
|
||||
@property UIControl *holder;
|
||||
@property NSString *content;
|
||||
@property NSInteger timeOffset;
|
||||
@end
|
||||
|
||||
@protocol PlayerSliderDelegate <NSObject>
|
||||
- (void)onPlayerPointSelected:(PlayerPoint *)point;
|
||||
@end
|
||||
|
||||
@interface PlayerSlider : UISlider
|
||||
|
||||
@property NSMutableArray<PlayerPoint *> *pointArray;
|
||||
@property UIProgressView *progressView;
|
||||
@property (weak) id<PlayerSliderDelegate> delegate;
|
||||
@property (nonatomic) BOOL hiddenPoints;
|
||||
|
||||
- (PlayerPoint *)addPoint:(GLfloat)where;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// PlayerSlider.m
|
||||
// Slider
|
||||
//
|
||||
// Created by annidyfeng on 2018/8/27.
|
||||
// Copyright © 2018年 annidy. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PlayerSlider.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "UIView+MMLayout.h"
|
||||
|
||||
@implementation PlayerPoint
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
|
||||
self.holder = [[UIControl alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
|
||||
UIView *inter = [[UIView alloc] initWithFrame:CGRectMake(14, 14, 2, 2)];
|
||||
inter.backgroundColor = [UIColor whiteColor];
|
||||
[self.holder addSubview:inter];
|
||||
self.holder.userInteractionEnabled = YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface PlayerSlider()
|
||||
@property UIImageView *tracker;
|
||||
@end
|
||||
|
||||
@implementation PlayerSlider
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
[self initUI];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super initWithCoder:aDecoder];
|
||||
[self initUI];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initUI {
|
||||
_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
||||
_progressView.progressTintColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.3];
|
||||
_progressView.trackTintColor = [UIColor clearColor];
|
||||
|
||||
[self addSubview:_progressView];
|
||||
|
||||
self.pointArray = [NSMutableArray new];
|
||||
|
||||
self.maximumValue = 1;
|
||||
self.maximumTrackTintColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5];
|
||||
|
||||
[_progressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self);
|
||||
make.right.equalTo(self);
|
||||
make.centerY.equalTo(self).mas_offset(0.5);
|
||||
make.height.mas_equalTo(2);
|
||||
}];
|
||||
_progressView.layer.masksToBounds = YES;
|
||||
_progressView.layer.cornerRadius = 1;
|
||||
self.progressView.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.8];
|
||||
[self sendSubviewToBack:self.progressView];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
self.tracker = self.subviews.lastObject;
|
||||
for (PlayerPoint *point in self.pointArray) {
|
||||
point.holder.center = [self holderCenter:point.where];
|
||||
if (@available(iOS 14.0, *)) {
|
||||
[self addSubview:point.holder];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
[self insertSubview:point.holder belowSubview:self.tracker];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (PlayerPoint *)addPoint:(GLfloat)where
|
||||
{
|
||||
for (PlayerPoint *pp in self.pointArray) {
|
||||
if (fabsf(pp.where - where) < 0.0001)
|
||||
return pp;
|
||||
}
|
||||
PlayerPoint *point = [PlayerPoint new];
|
||||
point.where = where;
|
||||
point.holder.center = [self holderCenter:where];
|
||||
point.holder.hidden = _hiddenPoints;
|
||||
[self.pointArray addObject:point];
|
||||
[point.holder addTarget:self action:@selector(onClickHolder:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self setNeedsLayout];
|
||||
return point;
|
||||
}
|
||||
|
||||
- (CGPoint)holderCenter:(GLfloat)where {
|
||||
return CGPointMake(self.frame.size.width * where, self.progressView.mm_centerY);
|
||||
}
|
||||
|
||||
- (void)onClickHolder:(UIControl *)sender {
|
||||
NSLog(@"clokc");
|
||||
for (PlayerPoint *point in self.pointArray) {
|
||||
if (point.holder == sender) {
|
||||
if ([self.delegate respondsToSelector:@selector(onPlayerPointSelected:)])
|
||||
[self.delegate onPlayerPointSelected:point];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setHiddenPoints:(BOOL)hiddenPoints
|
||||
{
|
||||
for (PlayerPoint *point in self.pointArray) {
|
||||
point.holder.hidden = hiddenPoints;
|
||||
}
|
||||
_hiddenPoints = hiddenPoints;
|
||||
}
|
||||
|
||||
//- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {
|
||||
//
|
||||
// rect.origin.x = rect.origin.x - 10 ;
|
||||
//
|
||||
// rect.size.width = rect.size.width +20;
|
||||
//
|
||||
// return CGRectInset ([super thumbRectForBounds:bounds
|
||||
// trackRect:rect
|
||||
// value:value],
|
||||
// 10 ,
|
||||
// 10);
|
||||
//
|
||||
//}
|
||||
@end
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// SuperPlayerFastView.h
|
||||
// TXLiteAVDemo
|
||||
//
|
||||
// Created by annidyfeng on 2018/8/24.
|
||||
// Copyright © 2018年 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
ImgWithProgress, // 图片+进度,比如声音滑动
|
||||
TextWithProgress, // 文字+进度,比如进度滑动
|
||||
ImgWithText, // 图片+文字,比如缩略图滑动
|
||||
SnapshotImg,
|
||||
} FastViewStyle;
|
||||
|
||||
@interface SuperPlayerFastView : UIView
|
||||
/** 快进快退进度progress*/
|
||||
@property (nonatomic, strong) UIProgressView *progressView;
|
||||
/** 快进快退时间*/
|
||||
@property (nonatomic, strong) UILabel *textLabel;
|
||||
/** 快进快退亮度图片*/
|
||||
@property (nonatomic, strong) UIImageView *imgView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *thumbView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *snapshotView;
|
||||
|
||||
@property CGFloat videoRatio;
|
||||
|
||||
|
||||
@property (nonatomic) FastViewStyle style;
|
||||
|
||||
/// 亮度等
|
||||
- (void)showImg:(UIImage *)img withProgress:(GLfloat)progress;
|
||||
/// 快进
|
||||
- (void)showThumbnail:(UIImage *)img withText:(NSString *)text;
|
||||
- (void)showText:(NSString *)text withText:(GLfloat)progress;
|
||||
/// 截图
|
||||
- (void)showSnapshot:(UIImage *)img;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,190 @@
|
||||
//
|
||||
// SuperPlayerFastView.m
|
||||
// TXLiteAVDemo
|
||||
//
|
||||
// Created by annidyfeng on 2018/8/24.
|
||||
// Copyright © 2018年 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SuperPlayerFastView.h"
|
||||
#import "SuperPlayer.h"
|
||||
#import "SuperPlayerView+Private.h"
|
||||
#import "UIView+MMLayout.h"
|
||||
|
||||
#define THUMB_VIEW_WIDTH 142
|
||||
#define THUMB_VIEW_HEIGHT (142/(16/9.0))
|
||||
|
||||
@implementation SuperPlayerFastView
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
|
||||
self.backgroundColor = RGBA(0, 0, 0, 0.2);
|
||||
|
||||
_videoRatio = 1;
|
||||
_style = -1;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (UILabel *)textLabel {
|
||||
if (!_textLabel) {
|
||||
_textLabel = [[UILabel alloc] init];
|
||||
_textLabel.textColor = [UIColor whiteColor];
|
||||
_textLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_textLabel.font = [UIFont systemFontOfSize:18.0];
|
||||
[self addSubview:_textLabel];
|
||||
}
|
||||
return _textLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)imgView {
|
||||
if (!_imgView) {
|
||||
_imgView = [[UIImageView alloc] init];
|
||||
[self addSubview:_imgView];
|
||||
}
|
||||
return _imgView;
|
||||
}
|
||||
|
||||
- (UIImageView *)thumbView {
|
||||
if (!_thumbView) {
|
||||
_thumbView = [[UIImageView alloc] init];
|
||||
_thumbView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_thumbView.backgroundColor = [UIColor blackColor];
|
||||
[self addSubview:_thumbView];
|
||||
}
|
||||
return _thumbView;
|
||||
}
|
||||
|
||||
- (UIImageView *)snapshotView {
|
||||
if (!_snapshotView) {
|
||||
_snapshotView = [[UIImageView alloc] init];
|
||||
_snapshotView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_snapshotView.backgroundColor = [UIColor blackColor];
|
||||
[self addSubview:_snapshotView];
|
||||
|
||||
[_snapshotView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(THUMB_VIEW_WIDTH);
|
||||
make.height.mas_equalTo(THUMB_VIEW_HEIGHT);
|
||||
make.center.equalTo(self);
|
||||
}];
|
||||
}
|
||||
return _snapshotView;
|
||||
}
|
||||
|
||||
- (UIProgressView *)progressView {
|
||||
if (!_progressView) {
|
||||
_progressView = [[UIProgressView alloc] init];
|
||||
_progressView.progressTintColor = [UIColor whiteColor];
|
||||
_progressView.trackTintColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.4];
|
||||
[self addSubview:_progressView];
|
||||
}
|
||||
return _progressView;
|
||||
}
|
||||
|
||||
- (void)setStyle:(FastViewStyle)style {
|
||||
if (_style == style)
|
||||
return;
|
||||
|
||||
switch (style) {
|
||||
case ImgWithProgress: {
|
||||
self.imgView.hidden = self.progressView.hidden = NO;
|
||||
self.textLabel.hidden = self.thumbView.hidden = self.snapshotView.hidden = YES;
|
||||
self.imgView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
||||
[self.imgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self);
|
||||
}];
|
||||
[self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.equalTo(self.imgView.mas_bottom).offset(10);
|
||||
make.width.mas_equalTo(120);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case ImgWithText: {
|
||||
self.thumbView.hidden = self.textLabel.hidden = NO;
|
||||
self.progressView.hidden = self.imgView.hidden = self.snapshotView.hidden = YES;
|
||||
|
||||
[self.thumbView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.width.mas_equalTo(THUMB_VIEW_WIDTH);
|
||||
make.height.mas_equalTo(THUMB_VIEW_HEIGHT);
|
||||
make.bottom.equalTo(self.mas_centerY).offset(20);
|
||||
}];
|
||||
|
||||
[self.textLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.equalTo(self.thumbView.mas_bottom).offset(10);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case TextWithProgress: {
|
||||
self.progressView.hidden = self.textLabel.hidden = NO;
|
||||
self.imgView.hidden = self.thumbView.hidden = self.snapshotView.hidden = YES;
|
||||
|
||||
[self.textLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self);
|
||||
}];
|
||||
[self.progressView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.equalTo(self.textLabel.mas_bottom).offset(10);
|
||||
make.width.mas_equalTo(120);
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case SnapshotImg: {
|
||||
self.progressView.hidden = self.textLabel.hidden = self.imgView.hidden = self.thumbView.hidden = YES;
|
||||
self.snapshotView.hidden = NO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
_style = style;
|
||||
}
|
||||
|
||||
- (void)showImg:(UIImage *)img withProgress:(GLfloat)progress
|
||||
{
|
||||
self.imgView.image = img;
|
||||
self.progressView.progress = progress;
|
||||
self.style = ImgWithProgress;
|
||||
}
|
||||
|
||||
- (void)showThumbnail:(UIImage *)img withText:(NSString *)text
|
||||
{
|
||||
self.thumbView.image = [self imageWithImage:img];
|
||||
self.textLabel.text = text;
|
||||
[self.textLabel sizeToFit];
|
||||
self.style = ImgWithText;
|
||||
}
|
||||
- (void)showText:(NSString *)text withText:(GLfloat)progress
|
||||
{
|
||||
self.textLabel.text = text;
|
||||
[self.textLabel sizeToFit];
|
||||
self.progressView.progress = progress;
|
||||
self.style = TextWithProgress;
|
||||
}
|
||||
|
||||
- (void)showSnapshot:(UIImage *)img
|
||||
{
|
||||
self.snapshotView.image = img;
|
||||
self.style = SnapshotImg;
|
||||
}
|
||||
|
||||
- (UIImage *)imageWithImage:(UIImage *)image {
|
||||
//UIGraphicsBeginImageContext(newSize);
|
||||
// In next line, pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution).
|
||||
// Pass 1.0 to force exact pixel size.
|
||||
CGSize newSize = CGSizeMake(THUMB_VIEW_WIDTH, THUMB_VIEW_HEIGHT);
|
||||
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
|
||||
|
||||
CGRect rect = AVMakeRectWithAspectRatioInsideRect(CGSizeMake(image.size.width, image.size.width/self.videoRatio), CGRectMake(0, 0, THUMB_VIEW_WIDTH, THUMB_VIEW_HEIGHT));
|
||||
|
||||
[image drawInRect:rect];
|
||||
|
||||
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return newImage;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// SuperPlayerSettingsView.h
|
||||
// TXLiteAVDemo
|
||||
//
|
||||
// Created by annidyfeng on 2018/7/4.
|
||||
// Copyright © 2018年 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "SuperPlayerViewConfig.h"
|
||||
|
||||
#define MoreViewWidth 330
|
||||
|
||||
@class SuperPlayerControlView;
|
||||
|
||||
@interface SuperPlayerSettingsView : UIView
|
||||
|
||||
@property (weak) SuperPlayerControlView *controlView;
|
||||
|
||||
@property UISlider *soundSlider;
|
||||
|
||||
@property UISlider *lightSlider;
|
||||
|
||||
/**
|
||||
* 是否显示播放速度和镜像
|
||||
*
|
||||
* 目前仅点播放支持修改播放速度与设置画面镜像
|
||||
*/
|
||||
@property (nonatomic) BOOL enableSpeedAndMirrorControl;
|
||||
|
||||
@property SuperPlayerViewConfig *playerConfig;
|
||||
- (void)update;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,384 @@
|
||||
//
|
||||
// SuperPlayerSettingsView.m
|
||||
// TXLiteAVDemo
|
||||
//
|
||||
// Created by annidyfeng on 2018/7/4.
|
||||
// Copyright © 2018年 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SuperPlayerSettingsView.h"
|
||||
#import "UIView+MMLayout.h"
|
||||
#import "SuperPlayer.h"
|
||||
#import <MediaPlayer/MediaPlayer.h>
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import "SuperPlayerControlView.h"
|
||||
#import "SuperPlayerView+Private.h"
|
||||
#import "DataReport.h"
|
||||
|
||||
#define TAG_1_SPEED 1001
|
||||
#define TAG_2_SPEED 1002
|
||||
#define TAG_3_SPEED 1003
|
||||
#define TAG_4_SPEED 1004
|
||||
|
||||
@interface SuperPlayerSettingsView()
|
||||
@property (nonatomic) UIView *soundCell;
|
||||
@property (nonatomic) UIView *ligthCell;
|
||||
@property (nonatomic) UIView *speedCell;
|
||||
@property (nonatomic) UIView *mirrorCell;
|
||||
@property (nonatomic) UIView *hwCell;
|
||||
@property BOOL isVolume;
|
||||
@property NSDate *volumeEndTime;
|
||||
@end
|
||||
|
||||
@implementation SuperPlayerSettingsView {
|
||||
NSInteger _contentHeight;
|
||||
NSInteger _speedTag;
|
||||
|
||||
UISwitch *_mirrorSwitch;
|
||||
UISwitch *_hwSwitch;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
self.mm_h = ScreenHeight;
|
||||
self.mm_w = MoreViewWidth;
|
||||
|
||||
[self addSubview:[self soundCell]];
|
||||
[self addSubview:[self lightCell]];
|
||||
[self addSubview:[self speedCell]];
|
||||
[self addSubview:[self mirrorCell]];
|
||||
[self addSubview:[self hwCell]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(volumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification"
|
||||
object:nil];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)volumeChanged:(NSNotification *)notify
|
||||
{
|
||||
if (!self.isVolume) {
|
||||
if (self.volumeEndTime != nil && -[self.volumeEndTime timeIntervalSinceNow] < 2.f)
|
||||
return;
|
||||
float volume = [[[notify userInfo] objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"] floatValue];
|
||||
self.soundSlider.value = volume;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sizeToFit
|
||||
{
|
||||
_contentHeight = 20;
|
||||
|
||||
_soundCell.m_top(_contentHeight);
|
||||
_contentHeight += _soundCell.mm_h;
|
||||
|
||||
_ligthCell.m_top(_contentHeight);
|
||||
_contentHeight += _ligthCell.mm_h;
|
||||
|
||||
|
||||
if (self.enableSpeedAndMirrorControl) {
|
||||
_speedCell.m_top(_contentHeight);
|
||||
_contentHeight += _speedCell.mm_h;
|
||||
|
||||
_mirrorCell.m_top(_contentHeight);
|
||||
_contentHeight += _mirrorCell.mm_h;
|
||||
|
||||
_speedCell.hidden = NO;
|
||||
_mirrorCell.hidden = NO;
|
||||
} else {
|
||||
_speedCell.hidden = YES;
|
||||
_mirrorCell.hidden = YES;
|
||||
}
|
||||
|
||||
_hwCell.m_top(_contentHeight);
|
||||
_contentHeight += _hwCell.mm_h;
|
||||
}
|
||||
|
||||
- (UIView *)soundCell
|
||||
{
|
||||
if (_soundCell == nil) {
|
||||
_soundCell = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
_soundCell.m_width(MoreViewWidth).m_height(50).m_left(10);
|
||||
|
||||
// 声音
|
||||
UILabel *sound = [UILabel new];
|
||||
sound.text = @"声音";
|
||||
sound.textColor = [UIColor whiteColor];
|
||||
[sound sizeToFit];
|
||||
[_soundCell addSubview:sound];
|
||||
sound.m_centerY();
|
||||
|
||||
|
||||
UIImageView *soundImage1 = [[UIImageView alloc] initWithImage:SuperPlayerImage(@"sound_min")];
|
||||
[_soundCell addSubview:soundImage1];
|
||||
soundImage1.m_left(sound.mm_maxX+10).m_centerY();
|
||||
|
||||
UIImageView *soundImage2 = [[UIImageView alloc] initWithImage:SuperPlayerImage(@"sound_max")];
|
||||
[_soundCell addSubview:soundImage2];
|
||||
soundImage2.m_right(50).m_centerY();
|
||||
|
||||
|
||||
UISlider *soundSlider = [[UISlider alloc] init];
|
||||
[soundSlider setThumbImage:SuperPlayerImage(@"slider_thumb") forState:UIControlStateNormal];
|
||||
|
||||
soundSlider.maximumValue = 1;
|
||||
soundSlider.minimumTrackTintColor = TintColor;
|
||||
soundSlider.maximumTrackTintColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5];
|
||||
|
||||
// slider开始滑动事件
|
||||
[soundSlider addTarget:self action:@selector(soundSliderTouchBegan:) forControlEvents:UIControlEventTouchDown];
|
||||
// slider滑动中事件
|
||||
[soundSlider addTarget:self action:@selector(soundSliderValueChanged:) forControlEvents:UIControlEventValueChanged];
|
||||
// slider结束滑动事件
|
||||
[soundSlider addTarget:self action:@selector(soundSliderTouchEnded:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchCancel | UIControlEventTouchUpOutside];
|
||||
[_soundCell addSubview:soundSlider];
|
||||
soundSlider.m_centerY().m_left(soundImage1.mm_maxX).m_width(soundImage2.mm_minX-soundImage1.mm_maxX);
|
||||
|
||||
self.soundSlider = soundSlider;
|
||||
}
|
||||
return _soundCell;
|
||||
}
|
||||
|
||||
- (UIView *)lightCell
|
||||
{
|
||||
if (_ligthCell == nil) {
|
||||
_ligthCell = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
_ligthCell.m_width(MoreViewWidth).m_height(50).m_left(10);
|
||||
|
||||
// 亮度
|
||||
UILabel *ligth = [UILabel new];
|
||||
ligth.text = @"亮度";
|
||||
ligth.textColor = [UIColor whiteColor];
|
||||
[ligth sizeToFit];
|
||||
[_ligthCell addSubview:ligth];
|
||||
ligth.m_centerY();
|
||||
|
||||
UIImageView *ligthImage1 = [[UIImageView alloc] initWithImage:SuperPlayerImage(@"light_min")];
|
||||
[_ligthCell addSubview:ligthImage1];
|
||||
ligthImage1.m_left(ligth.mm_maxX+10).m_centerY();
|
||||
|
||||
UIImageView *ligthImage2 = [[UIImageView alloc] initWithImage:SuperPlayerImage(@"light_max")];
|
||||
[_ligthCell addSubview:ligthImage2];
|
||||
ligthImage2.m_right(50).m_centerY();
|
||||
|
||||
|
||||
UISlider *lightSlider = [[UISlider alloc] init];
|
||||
|
||||
[lightSlider setThumbImage:SuperPlayerImage(@"slider_thumb") forState:UIControlStateNormal];
|
||||
|
||||
lightSlider.maximumValue = 1;
|
||||
lightSlider.minimumTrackTintColor = TintColor;
|
||||
lightSlider.maximumTrackTintColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5];
|
||||
|
||||
// slider开始滑动事件
|
||||
[lightSlider addTarget:self action:@selector(lightSliderTouchBegan:) forControlEvents:UIControlEventTouchDown];
|
||||
// slider滑动中事件
|
||||
[lightSlider addTarget:self action:@selector(lightSliderValueChanged:) forControlEvents:UIControlEventValueChanged];
|
||||
// slider结束滑动事件
|
||||
[lightSlider addTarget:self action:@selector(lightSliderTouchEnded:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchCancel | UIControlEventTouchUpOutside];
|
||||
|
||||
[_ligthCell addSubview:lightSlider];
|
||||
lightSlider.m_centerY().m_left(ligthImage1.mm_maxX).m_width(ligthImage2.mm_minX-ligthImage1.mm_maxX);
|
||||
|
||||
self.lightSlider = lightSlider;
|
||||
}
|
||||
|
||||
|
||||
return _ligthCell;
|
||||
}
|
||||
|
||||
- (UIView *)speedCell {
|
||||
if (!_speedCell) {
|
||||
_speedCell = [UIView new];
|
||||
_speedCell.m_width(MoreViewWidth).m_height(50).m_left(10);
|
||||
|
||||
// 倍速
|
||||
UILabel *speed = [UILabel new];
|
||||
speed.text = @"倍速播放";
|
||||
speed.textColor = [UIColor whiteColor];
|
||||
[speed sizeToFit];
|
||||
[_speedCell addSubview:speed];
|
||||
speed.m_centerY();
|
||||
|
||||
UIButton *speed1 = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[speed1 setTitle:@"1.0X" forState:UIControlStateNormal];
|
||||
[speed1 setTitleColor:TintColor forState:UIControlStateSelected];
|
||||
speed1.selected = YES;
|
||||
speed1.tag = TAG_1_SPEED;
|
||||
[speed1 sizeToFit];
|
||||
[_speedCell addSubview:speed1];
|
||||
[speed1 addTarget:self action:@selector(changeSpeed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
speed1.m_left(speed.mm_maxX+10).m_centerY();
|
||||
|
||||
|
||||
UIButton *speed2 = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[speed2 setTitle:@"1.25X" forState:UIControlStateNormal];
|
||||
[speed2 setTitleColor:TintColor forState:UIControlStateSelected];
|
||||
speed2.tag = TAG_2_SPEED;
|
||||
[speed2 sizeToFit];
|
||||
[_speedCell addSubview:speed2];
|
||||
[speed2 addTarget:self action:@selector(changeSpeed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
speed2.m_left(speed1.mm_maxX+12).m_centerY();
|
||||
|
||||
|
||||
UIButton *speed3 = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[speed3 setTitle:@"1.5X" forState:UIControlStateNormal];
|
||||
[speed3 setTitleColor:TintColor forState:UIControlStateSelected];
|
||||
speed3.tag = TAG_3_SPEED;
|
||||
[speed3 sizeToFit];
|
||||
[_speedCell addSubview:speed3];
|
||||
[speed3 addTarget:self action:@selector(changeSpeed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
speed3.m_left(speed2.mm_maxX+12).m_centerY();
|
||||
|
||||
UIButton *speed4 = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[speed4 setTitle:@"2.0X" forState:UIControlStateNormal];
|
||||
[speed4 setTitleColor:TintColor forState:UIControlStateSelected];
|
||||
speed4.tag = TAG_4_SPEED;
|
||||
[speed4 sizeToFit];
|
||||
[_speedCell addSubview:speed4];
|
||||
[speed4 addTarget:self action:@selector(changeSpeed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
speed4.m_left(speed3.mm_maxX+12).m_centerY();
|
||||
}
|
||||
return _speedCell;
|
||||
}
|
||||
|
||||
- (UIView *)mirrorCell {
|
||||
if (!_mirrorCell) {
|
||||
_mirrorCell = [UIView new];
|
||||
_mirrorCell.m_width(MoreViewWidth).m_height(50).m_left(10);
|
||||
|
||||
|
||||
UILabel *mirror = [UILabel new];
|
||||
mirror.text = @"镜像";
|
||||
mirror.textColor = [UIColor whiteColor];
|
||||
[mirror sizeToFit];
|
||||
[_mirrorCell addSubview:mirror];
|
||||
mirror.m_centerY();
|
||||
|
||||
UISwitch *switcher = [UISwitch new];
|
||||
_mirrorSwitch = switcher;
|
||||
[switcher addTarget:self action:@selector(changeMirror:) forControlEvents:UIControlEventValueChanged];
|
||||
[_mirrorCell addSubview:switcher];
|
||||
switcher.m_right(30).m_centerY();
|
||||
}
|
||||
return _mirrorCell;
|
||||
}
|
||||
|
||||
- (UIView *)hwCell {
|
||||
if (!_hwCell) {
|
||||
_hwCell = [UIView new];
|
||||
_hwCell.m_width(MoreViewWidth).m_height(50).m_left(10);
|
||||
|
||||
|
||||
UILabel *hd = [UILabel new];
|
||||
hd.text = @"硬件加速";
|
||||
|
||||
hd.textColor = [UIColor whiteColor];
|
||||
[hd sizeToFit];
|
||||
[_hwCell addSubview:hd];
|
||||
hd.m_centerY();
|
||||
|
||||
UISwitch *switcher = [UISwitch new];
|
||||
_hwSwitch = switcher;
|
||||
[switcher addTarget:self action:@selector(changeHW:) forControlEvents:UIControlEventValueChanged];
|
||||
[_hwCell addSubview:switcher];
|
||||
switcher.m_right(30).m_centerY();
|
||||
}
|
||||
return _hwCell;
|
||||
}
|
||||
|
||||
- (void)soundSliderTouchBegan:(UISlider *)sender {
|
||||
self.isVolume = YES;
|
||||
}
|
||||
|
||||
- (void)soundSliderValueChanged:(UISlider *)sender {
|
||||
if (self.isVolume)
|
||||
[SuperPlayerView volumeViewSlider].value = sender.value;
|
||||
}
|
||||
|
||||
- (void)soundSliderTouchEnded:(UISlider *)sender {
|
||||
self.isVolume = NO;
|
||||
self.volumeEndTime = [NSDate date];
|
||||
}
|
||||
|
||||
- (void)lightSliderTouchBegan:(UISlider *)sender {
|
||||
|
||||
}
|
||||
|
||||
- (void)lightSliderValueChanged:(UISlider *)sender {
|
||||
[UIScreen mainScreen].brightness = sender.value;
|
||||
}
|
||||
|
||||
- (void)lightSliderTouchEnded:(UISlider *)sender {
|
||||
|
||||
}
|
||||
|
||||
- (void)changeSpeed:(UIButton *)sender {
|
||||
|
||||
for (int i = TAG_1_SPEED; i <= TAG_4_SPEED; i++) {
|
||||
UIButton *b = [_speedCell viewWithTag:i];
|
||||
if (b.isSelected && b != sender)
|
||||
b.selected = NO;
|
||||
}
|
||||
sender.selected = YES;
|
||||
self.playerConfig.playRate = [sender.titleLabel.text floatValue];
|
||||
[self.controlView.delegate controlViewConfigUpdate:self.controlView withReload:NO];
|
||||
[DataReport report:@"change_speed" param:nil];
|
||||
}
|
||||
|
||||
- (void)changeMirror:(UISwitch *)sender {
|
||||
self.playerConfig.mirror = sender.on;
|
||||
[self.controlView.delegate controlViewConfigUpdate:self.controlView withReload:NO];
|
||||
if (sender.on) {
|
||||
[DataReport report:@"mirror" param:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)changeHW:(UISwitch *)sender {
|
||||
self.playerConfig.hwAcceleration = sender.on;
|
||||
[self.controlView.delegate controlViewConfigUpdate:self.controlView withReload:YES];
|
||||
[DataReport report:sender.on?@"hw_decode":@"soft_decode" param:nil];
|
||||
}
|
||||
|
||||
- (void)update
|
||||
{
|
||||
self.soundSlider.value = [SuperPlayerView volumeViewSlider].value;
|
||||
self.lightSlider.value = [UIScreen mainScreen].brightness;
|
||||
|
||||
CGFloat rate = self.playerConfig.playRate;
|
||||
|
||||
for (int i = TAG_1_SPEED; i <= TAG_4_SPEED; i++) {
|
||||
UIButton *b = [_speedCell viewWithTag:i];
|
||||
b.selected = NO;
|
||||
}
|
||||
|
||||
if (rate == 1.0) {
|
||||
[[_speedCell viewWithTag:TAG_1_SPEED] setSelected:YES];
|
||||
}
|
||||
if (rate == 1.25) {
|
||||
[[_speedCell viewWithTag:TAG_2_SPEED] setSelected:YES];
|
||||
}
|
||||
if (rate == 1.5) {
|
||||
[[_speedCell viewWithTag:TAG_3_SPEED] setSelected:YES];
|
||||
}
|
||||
if (rate == 2.0) {
|
||||
[[_speedCell viewWithTag:TAG_4_SPEED] setSelected:YES];
|
||||
}
|
||||
|
||||
_mirrorSwitch.on = self.playerConfig.mirror;
|
||||
_hwSwitch.on = self.playerConfig.hwAcceleration;
|
||||
|
||||
[self sizeToFit];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// SuperPlayerView+Private.h
|
||||
// TXLiteAVDemo
|
||||
//
|
||||
// Created by annidyfeng on 2018/7/9.
|
||||
// Copyright © 2018年 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SuperPlayerView_Private_h
|
||||
#define SuperPlayerView_Private_h
|
||||
#import "SuperPlayer.h"
|
||||
|
||||
#import "SuperPlayerControlViewDelegate.h"
|
||||
#import "NetWatcher.h"
|
||||
#import <MediaPlayer/MediaPlayer.h>
|
||||
|
||||
#import "Masonry/Masonry.h"
|
||||
#import "AFNetworking/AFNetworking.h"
|
||||
//#import "SPResolutionDefination.h"
|
||||
#import "SPSubStreamInfo.h"
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
// 枚举值,包含水平移动方向和垂直移动方向
|
||||
typedef NS_ENUM(NSInteger, PanDirection){
|
||||
PanDirectionHorizontalMoved, // 横向移动
|
||||
PanDirectionVerticalMoved // 纵向移动
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, ButtonAction) {
|
||||
ActionNone,
|
||||
ActionRetry,
|
||||
ActionSwitch,
|
||||
ActionIgnore,
|
||||
ActionContinueReplay,
|
||||
};
|
||||
|
||||
@class TXVodPlayer, TXLivePlayer;
|
||||
@interface SuperPlayerView () <UIGestureRecognizerDelegate,UIAlertViewDelegate,
|
||||
SuperPlayerControlViewDelegate, AVAssetResourceLoaderDelegate>
|
||||
|
||||
|
||||
/** 用来保存快进的总时长 */
|
||||
@property (nonatomic, assign) CGFloat sumTime;
|
||||
@property (nonatomic, assign) CGFloat startVeloctyPoint;
|
||||
|
||||
/** 定义一个实例变量,保存枚举值 */
|
||||
@property (nonatomic, assign) PanDirection panDirection;
|
||||
/** 是否在调节音量*/
|
||||
@property (nonatomic, assign) BOOL isVolume;
|
||||
/** 是否被用户暂停 */
|
||||
@property (nonatomic, assign) BOOL isPauseByUser;
|
||||
/** 播放完了*/
|
||||
@property (nonatomic, assign) BOOL playDidEnd;
|
||||
/** 进入后台*/
|
||||
@property (nonatomic, assign) BOOL didEnterBackground;
|
||||
/** 单击 */
|
||||
@property (nonatomic, strong) UITapGestureRecognizer *singleTap;
|
||||
/** 双击 */
|
||||
@property (nonatomic, strong) UITapGestureRecognizer *doubleTap;
|
||||
/** 快进快退、View*/
|
||||
@property (nonatomic, strong) SuperPlayerFastView *fastView;
|
||||
|
||||
@property (nonatomic, setter=setDragging:) BOOL isDragging;
|
||||
/// 中间的提示按钮
|
||||
@property (nonatomic, strong) UIButton *middleBlackBtn;
|
||||
@property ButtonAction middleBlackBtnAction;
|
||||
|
||||
/** 系统菊花 */
|
||||
@property (nonatomic, strong) MMMaterialDesignSpinner *spinner;
|
||||
|
||||
@property (nonatomic, strong) UIButton *lockTipsBtn;
|
||||
|
||||
@property (nonatomic, strong) SuperPlayerModel *playerModel;
|
||||
|
||||
@property (class, readonly) UISlider *volumeViewSlider;
|
||||
|
||||
@property MPVolumeView *volumeView;
|
||||
|
||||
// add for txvodplayer
|
||||
@property BOOL isLoaded;
|
||||
|
||||
@property (nonatomic) BOOL isShiftPlayback;
|
||||
|
||||
@property CGFloat maxLiveProgressTime; // 直播最大进度/总时间
|
||||
@property CGFloat liveProgressTime; // 直播播放器回调过来的时间
|
||||
@property CGFloat liveProgressBase; // 直播播放器超出时移的最大时间
|
||||
#define MAX_SHIFT_TIME (2*60*60)
|
||||
/** 是否是直播流 */
|
||||
@property BOOL isLive;
|
||||
|
||||
/** 腾讯点播播放器 */
|
||||
@property (nonatomic, strong) TXVodPlayer *vodPlayer;
|
||||
/** 腾讯直播播放器 */
|
||||
@property (nonatomic, strong) TXLivePlayer *livePlayer;
|
||||
|
||||
@property NSDate *reportTime;
|
||||
|
||||
@property NetWatcher *netWatcher;
|
||||
|
||||
@property (nonatomic) CGFloat videoRatio;
|
||||
|
||||
/// 由协议解析出分辨率定义表
|
||||
@property (strong, nonatomic) NSArray<SPSubStreamInfo *> *resolutions;
|
||||
/// 当前可用的分辨率列表
|
||||
//@property (strong, nonatomic) NSArray<NSString *> *currentResolutionNames;
|
||||
@end
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@class AdaptiveStream;
|
||||
|
||||
@interface SuperPlayerModel()
|
||||
|
||||
//@property (nonatomic, strong) NSString *drmType;
|
||||
@property NSMutableArray<AdaptiveStream *> *streams;
|
||||
|
||||
//- (BOOL)canSetDrmType:(NSString *)drmType;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* SuperPlayerView_Private_h */
|
||||
Reference in New Issue
Block a user