Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
changsanjiang committed Sep 6, 2017
1 parent 3d5c312 commit a2fd5d8
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 60 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 changsanjiang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions SJVideoPlayer.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Pod::Spec.new do |s|
s.name = 'SJVideoPlayer'
s.version = '0.0.1'
s.summary = 'video player.'
s.description = 'https://github.com/changsanjiang/SJVideoPlayer/blob/master/README.md'
s.homepage = 'https://github.com/changsanjiang/SJVideoPlayer'
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.author = { 'SanJiang' => '[email protected]' }
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.com/changsanjiang/SJVideoPlayer.git', :tag => "v#{s.version}" }
s.source_files = 'SJVideoPlayer/**/*.{h,m}'
s.resource = 'SJVideoPlayer/Resource/SJVideoPlayer.bundle'
s.framework = 'UIKit'
s.requires_arc = true
s.dependency 'Masonry'
end
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// NSTimer+SJExtention.h
// NSTimer+SJExtension.h
// SJVideoPlayerProject
//
// Created by BlueDancer on 2017/8/23.
// Created by BlueDancer on 2017/9/6.
// Copyright © 2017年 SanJiang. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSTimer (SJExtention)
@interface NSTimer (SJExtension)

+ (instancetype)sj_scheduledTimerWithTimeInterval:(NSTimeInterval)ti exeBlock:(void(^)())block repeats:(BOOL)yesOrNo;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// NSTimer+SJExtention.m
// NSTimer+SJExtension.m
// SJVideoPlayerProject
//
// Created by BlueDancer on 2017/8/23.
// Created by BlueDancer on 2017/9/6.
// Copyright © 2017年 SanJiang. All rights reserved.
//

#import "NSTimer+SJExtention.h"
#import "NSTimer+SJExtension.h"

@implementation NSTimer (SJExtention)
@implementation NSTimer (SJExtension)

+ (instancetype)sj_scheduledTimerWithTimeInterval:(NSTimeInterval)ti exeBlock:(void(^)())block repeats:(BOOL)yesOrNo {
NSAssert(block, @"block 不可为空");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// UIView+Extension.h
// CSJQQMusic
// UIView+SJExtension.h
// SJVideoPlayerProject
//
// Created by ya on 12/21/16.
// Copyright © 2016 ya. All rights reserved.
// Created by BlueDancer on 2017/9/6.
// Copyright © 2017年 SanJiang. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIView (Extension)
@interface UIView (SJExtension)

@property (nonatomic, assign) CGFloat csj_x;
@property (nonatomic, assign) CGFloat csj_y;
Expand All @@ -23,13 +23,13 @@
@property (nonatomic, strong, readonly) UIImage *csj_currentSnapshot;
@property (nonatomic, strong, readonly) UIViewController *csj_viewController;

// MARK: - 设置中心点
// MARK: - 设置中心点
- (void)csj_centerWithView:(UIView *)view;

// MARK: - ⚠️ 视图底部 用OC 画虚线, 需要把代码拷贝到 drawRect中.
// MARK: - ⚠️ 视图底部 用OC 画虚线, 需要把代码拷贝到 drawRect中.
- (void)csj_lyXuXian;

// MARK: - 切圆
// MARK: - 切圆
- (void)csj_cornerRadius;

/** 设置圆角 */
Expand Down Expand Up @@ -65,7 +65,7 @@
- (void)scaleAnimation;

- (void)praiseAnimationWithFatherView:(UIView *)fatherView;

- (void)praiseAnimationWithFatherView:(UIView *)fatherView complete:(void(^)())block;

#pragma mark - 创建视图
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//
// UIView+Extension.m
// CSJQQMusic
// UIView+SJExtension.m
// SJVideoPlayerProject
//
// Created by ya on 12/21/16.
// Copyright © 2016 ya. All rights reserved.
// Created by BlueDancer on 2017/9/6.
// Copyright © 2017年 SanJiang. All rights reserved.
//

#import "UIView+Extension.h"
#import "UIView+SJExtension.h"


@interface _SJRoundImageView : UIImageView
Expand Down Expand Up @@ -43,11 +43,11 @@ - (void)layoutSubviews {
@end


@implementation UIView (Extension)
@implementation UIView (SJExtension)


- (UIViewController *)csj_viewController {

if ([self isKindOfClass:[UIView class]]) {
UIView *view = (UIView *)self;
UIResponder *responder = view.nextResponder;
Expand All @@ -59,11 +59,11 @@ - (UIViewController *)csj_viewController {
}
return (UIViewController *)responder;
}

return nil;
}

/// 截当前视图, 返回Image.
/// 截当前视图, 返回Image.
- (UIImage *)csj_currentSnapshot {
UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, 0);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
Expand All @@ -72,30 +72,30 @@ - (UIImage *)csj_currentSnapshot {
return result;
}

/// 视图底部 用OC 画虚线. ⚠️ 需要把代码拷贝到 drawRect中.
/// 视图底部 用OC 画虚线. ⚠️ 需要把代码拷贝到 drawRect中.
- (void)csj_lyXuXian {

CGRect rect = self.bounds;
CGFloat width = rect.size.width;
CGFloat height = rect.size.height;
CGFloat gapSpace = 4.0;
CGFloat length = width - gapSpace * 2;
NSInteger count = length * 0.5;
CGFloat startX = gapSpace;

UIBezierPath *path = [UIBezierPath bezierPath];
for (int i = 0; i < count * 0.5; i ++) {
[path moveToPoint:CGPointMake(startX + i * 2.0,
height)];

[path addLineToPoint:CGPointMake(startX + (i + 1) * 2.0,
height)];
startX += 2.0;
[path setLineWidth:6.0 / [UIScreen mainScreen].scale];

/// 颜色
[UIColor.redColor set];

/// 绘制
[path stroke];
}
Expand Down Expand Up @@ -149,7 +149,7 @@ - (void)setCsj_size:(CGSize)csj_size {
CGRect frame = self.frame;
frame.size = csj_size;
self.frame = frame;

}

- (CGSize)csj_size {
Expand Down Expand Up @@ -281,7 +281,7 @@ - (void)fadeAnimation {

- (void)animationWithType:(NSString *)type key:(NSString *)key {
CATransition *anima = [CATransition animation];
anima.type = type;
anima.type = type;
anima.subtype = kCATransitionFromRight;
anima.duration = 1.0f;
[self.layer addAnimation:anima forKey:key];
Expand All @@ -296,7 +296,7 @@ - (void)scaleAnimation {
anima.repeatCount = 1;
[self.layer addAnimation:anima forKey:@"scaleAnimation"];
}

- (void)praiseAnimationWithFatherView:(UIView *)fatherView complete:(void(^)())block {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
NSInteger random = arc4random() % 8;
Expand Down Expand Up @@ -381,7 +381,7 @@ - (void)praiseAnimationWithFatherView:(UIView *)fatherView complete:(void(^)())b
[imageView removeFromSuperview];
if ( block ) block();
}];

}

- (void)praiseAnimationWithFatherView:(UIView *)fatherView {
Expand Down Expand Up @@ -478,12 +478,12 @@ + (UICollectionView *)collectionViewWithItemSize:(CGSize)itemSize backgroundColo
flowLayout.scrollDirection = direction;
flowLayout.headerReferenceSize = headerSize;
flowLayout.footerReferenceSize = footerSize;

UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
collectionView.backgroundColor = backgroundColor;
collectionView.showsHorizontalScrollIndicator = YES;
collectionView.showsVerticalScrollIndicator = YES;

return collectionView;
}

Expand All @@ -509,7 +509,7 @@ + (UIButton *)buttonWithImageName:(NSString *)imageName title:(NSString *)title
[btn addTarget:target action:sel forControlEvents:UIControlEventTouchUpInside];
btn.titleLabel.font = [UIFont systemFontOfSize:14];
return btn;

}

+ (UIButton *)buttonWithTitle:(NSString *)title backgroundColor:(UIColor *)backgroundColor tag:(NSUInteger)tag target:(id)target sel:(SEL)sel fontSize:(CGFloat)fontSize {
Expand Down
2 changes: 1 addition & 1 deletion SJVideoPlayer/Control/SJVideoPlayerControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#import "SJVideoPlayerStringConstant.h"
#import "SJVideoPlayerControlView.h"
#import "SJVideoPlayerTipsView.h"
#import "NSTimer+SJExtention.h"
#import "NSTimer+SJExtension.h"
#import "SJVideoPlayer.h"
#import "SJVideoPlayer.h"

Expand Down
4 changes: 2 additions & 2 deletions SJVideoPlayer/Control/SJVideoPlayerControlView.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

#import <UIKit/UIKit.h>

#import "UIView+Extension.h"
#import "UIView+SJExtension.h"

#import <Masonry/Masonry.h>

#import "NSAttributedString+ZFBAdditon.h"

#import <objc/message.h>

#import "NSTimer+SJExtention.h"
#import "NSTimer+SJExtension.h"

#import "SJVideoPlayerStringConstant.h"

Expand Down
2 changes: 1 addition & 1 deletion SJVideoPlayer/Control/SJVideoPlayerTipsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "SJVideoPlayerTipsView.h"

#import "UIView+Extension.h"
#import "UIView+SJExtension.h"

#import <SJBorderLineView/SJBorderlineView.h>

Expand Down
3 changes: 2 additions & 1 deletion SJVideoPlayer/Present/SJVideoPlayerPresentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import "SJVideoPlayerStringConstant.h"

#import "UIView+Extension.h"
#import "UIView+SJExtension.h"

#import <AVFoundation/AVAssetImageGenerator.h>

Expand Down Expand Up @@ -186,6 +186,7 @@ - (void)_installNotifications {

- (void)_removeNotifications {
[self _removeDeviceOrientationChangeObserver];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)playerBeginPlayingNotification {
Expand Down
4 changes: 2 additions & 2 deletions SJVideoPlayer/Prompt/SJVideoPlayerPrompt.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#import <Masonry/Masonry.h>

#import "UIView+Extension.h"
#import "UIView+SJExtension.h"

#import "NSTimer+SJExtention.h"
#import "NSTimer+SJExtension.h"

#define SJVideoPlayerPrompt_H (50)

Expand Down
Loading

0 comments on commit a2fd5d8

Please sign in to comment.