Skip to content

Commit

Permalink
Release 3.1.0
Browse files Browse the repository at this point in the history
- 添加 弹幕控制管理, 现在可以发弹幕了
- 播放控制支持切换为 AliVodPlayer 了
- 修复 `pausedToKeepAppearState` 失效的问题
- 修复 `ijkplayer` 播放结束后, 当前时间未刷新的问题
  • Loading branch information
changsanjiang committed Nov 14, 2019
1 parent ece040e commit cb3acd9
Show file tree
Hide file tree
Showing 23 changed files with 2,026 additions and 18 deletions.
13 changes: 11 additions & 2 deletions SJBaseVideoPlayer.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = 'SJBaseVideoPlayer'
s.version = '3.0.9'
s.version = '3.1.0'
s.summary = 'video player.'
s.description = 'https://github.com/changsanjiang/SJBaseVideoPlayer/blob/master/README.md'
s.homepage = 'https://github.com/changsanjiang/SJBaseVideoPlayer'
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.author = { 'SanJiang' => '[email protected]' }
s.platform = :ios, '9.0'
s.platform = :ios, '8.0'
s.source = { :git => 'https://github.com/changsanjiang/SJBaseVideoPlayer.git', :tag => "v#{s.version}" }
s.frameworks = "UIKit", "AVFoundation"
s.requires_arc = true
Expand Down Expand Up @@ -79,4 +79,13 @@ Pod::Spec.new do |s|
ss.dependency 'SJBaseVideoPlayer/AVPlayer'
ss.dependency 'AliPlayerSDK_iOS'
end

s.subspec 'AliVodPlayer' do |ss|
ss.source_files = 'SJBaseVideoPlayer/AliVodPlayer/*.{h,m}'
ss.subspec 'Core' do |sss|
sss.source_files = 'SJBaseVideoPlayer/AliVodPlayer/Core/*.{h,m}'
end
ss.dependency 'SJBaseVideoPlayer/AVPlayer'
ss.dependency 'AliyunPlayer_iOS/AliyunVodPlayerSDK'
end
end
2 changes: 1 addition & 1 deletion SJBaseVideoPlayer/AliPlayer/Core/SJAliMediaPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ - (void)_toEvaluating {
self.readyForDisplay = YES;
}

if ( self.timeControlStatus == SJPlaybackTimeControlStatusWaitingToPlay ) {
if ( self.timeControlStatus != SJPlaybackTimeControlStatusPaused ) {
SJPlaybackTimeControlStatus status = self.timeControlStatus;
SJWaitingReason _Nullable reason = self.reasonForWaitingToPlay;
if ( self.eventType == AVPEventLoadingStart ) {
Expand Down
62 changes: 62 additions & 0 deletions SJBaseVideoPlayer/AliVodPlayer/Core/SJAliyunVodModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// SJAliyunVodModel.h
// Demo
//
// Created by BlueDancer on 2019/11/13.
// Copyright © 2019 SanJiang. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
@interface SJAliyunVodModel : NSObject
@end

@interface SJAliyunVodURLModel : SJAliyunVodModel
- (instancetype)initWithURL:(NSURL *)URL;
@property (nonatomic, strong, nullable) NSURL *URL;
@end

@interface SJAliyunVodStsModel : SJAliyunVodModel
- (instancetype)initWithVid:(NSString *)vid
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region;

@property (nonatomic, copy) NSString* vid;
@property (nonatomic, copy) NSString* accessKeyId;
@property (nonatomic, copy) NSString* accessKeySecret;
@property (nonatomic, copy) NSString* securityToken;
@property (nonatomic, copy) NSString* region;
@end

@interface SJAliyunVodAuthModel : SJAliyunVodModel
- (instancetype)initWithVid:(NSString *)vid
playAuth:(NSString *)playAuth;

@property (nonatomic, copy) NSString* vid;
@property (nonatomic, copy) NSString* playAuth;
@end

@interface SJAliyunVodMpsModel : SJAliyunVodModel
- (instancetype)initWithVid:(NSString*)vid
accId:(NSString *)accId
accSecret:(NSString*)accSecret
stsToken:(NSString*)stsToken
authInfo:(NSString*)authInfo
region:(NSString*)region
playDomain:(NSString*)playDomain
mtsHlsUriToken:(NSString*)mtsHlsUriToken;

@property (nonatomic, copy) NSString* vid;
@property (nonatomic, copy) NSString* accId;
@property (nonatomic, copy) NSString* accSecret;
@property (nonatomic, copy) NSString* stsToken;
@property (nonatomic, copy) NSString* authInfo;
@property (nonatomic, copy) NSString* region;
@property (nonatomic, copy) NSString* playDomain;
@property (nonatomic, copy) NSString* mtsHlsUriToken;
@end

NS_ASSUME_NONNULL_END
77 changes: 77 additions & 0 deletions SJBaseVideoPlayer/AliVodPlayer/Core/SJAliyunVodModel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// SJAliyunVodModel.m
// Demo
//
// Created by BlueDancer on 2019/11/13.
// Copyright © 2019 SanJiang. All rights reserved.
//

#import "SJAliyunVodModel.h"

@implementation SJAliyunVodModel
@end


@implementation SJAliyunVodURLModel
- (instancetype)initWithURL:(NSURL *)URL {
self = [super init];
if ( self ) {
_URL = URL;
}
return self;
}
@end

@implementation SJAliyunVodStsModel
- (instancetype)initWithVid:(NSString *)vid
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region {
self = [super init];
if ( self ) {
_vid = vid.copy;
_accessKeyId = accessKeyId.copy;
_accessKeySecret = accessKeySecret.copy;
_securityToken = securityToken.copy;
_region = region.copy;
}
return self;
}
@end

@implementation SJAliyunVodAuthModel
- (instancetype)initWithVid:(NSString *)vid
playAuth:(NSString *)playAuth {
self = [super init];
if ( self ) {
_vid = vid.copy;
_playAuth = playAuth.copy;
}
return self;
}
@end

@implementation SJAliyunVodMpsModel
- (instancetype)initWithVid:(NSString*)vid
accId:(NSString *)accId
accSecret:(NSString*)accSecret
stsToken:(NSString*)stsToken
authInfo:(NSString*)authInfo
region:(NSString*)region
playDomain:(NSString*)playDomain
mtsHlsUriToken:(NSString*)mtsHlsUriToken {
self = [super init];
if ( self ) {
_vid = vid.copy;
_accId = accId.copy;
_accSecret = accSecret.copy;
_stsToken = stsToken.copy;
_authInfo = authInfo.copy;
_region = region.copy;
_playDomain = playDomain.copy;
_mtsHlsUriToken = mtsHlsUriToken.copy;
}
return self;
}
@end
62 changes: 62 additions & 0 deletions SJBaseVideoPlayer/AliVodPlayer/Core/SJAliyunVodPlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// SJAliyunVodPlayer.h
// Demo
//
// Created by BlueDancer on 2019/11/13.
// Copyright © 2019 SanJiang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SJVideoPlayerPlaybackControllerDefines.h"
#import "SJAVMediaPlayer.h"
#import "SJAliyunVodModel.h"

NS_ASSUME_NONNULL_BEGIN
extern NSNotificationName const SJAliyunVodPlayerAssetStatusDidChangeNotification;
extern NSNotificationName const SJAliyunVodPlayerTimeControlStatusDidChangeNotification;
extern NSNotificationName const SJAliyunVodPlayerPresentationSizeDidChangeNotification;
extern NSNotificationName const SJAliyunVodPlayerDidPlayToEndTimeNotification;
extern NSNotificationName const SJAliyunVodPlayerReadyForDisplayNotification;

@interface SJAliyunVodPlayer : NSObject
- (instancetype)initWithMedia:(__kindof SJAliyunVodModel *)media specifyStartTime:(NSTimeInterval)time;
@property (nonatomic, strong, readonly) SJAliyunVodModel *media;
@property (nonatomic, readonly) NSTimeInterval specifyStartTime;
@property (nonatomic, readonly, nullable) SJWaitingReason reasonForWaitingToPlay;
@property (nonatomic, readonly) SJPlaybackTimeControlStatus timeControlStatus;
@property (nonatomic, readonly) SJSeekingInfo seekingInfo;
@property (nonatomic, readonly) SJAssetStatus assetStatus;
@property (nonatomic, readonly) CGSize presentationSize;
@property (nonatomic, readonly) BOOL isReplayed;
@property (nonatomic, readonly) BOOL isPlayed;
@property (nonatomic, readonly) BOOL isPlayedToEndTime;
@property (nonatomic) SJVideoGravity videoGravity;
@property (nonatomic) float rate;
@property (nonatomic) float volume;
@property (nonatomic, getter=isMuted) BOOL muted;
@property (nonatomic, readonly, getter=isReadyForDisplay) BOOL readyForDisplay;
@property (nonatomic, strong, readonly) UIView *view;
@property (nonatomic) BOOL shouldAutoplay;

- (void)seekToTime:(CMTime)time completionHandler:(nullable void (^)(BOOL finished))completionHandler;

@property (nonatomic, readonly) NSTimeInterval currentTime;
@property (nonatomic, readonly) NSTimeInterval duration;
@property (nonatomic, readonly) NSTimeInterval playableDuration;

- (void)play;
- (void)pause;

@property (nonatomic) BOOL pauseWhenAppDidEnterBackground;

- (void)replay;
- (void)report;

- (id)addTimeObserverWithCurrentTimeDidChangeExeBlock:(void (^)(NSTimeInterval time))block
playableDurationDidChangeExeBlock:(void (^)(NSTimeInterval time))block1
durationDidChangeExeBlock:(void (^)(NSTimeInterval time))block2;
- (void)removeTimeObserver:(id)observer;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
Loading

0 comments on commit cb3acd9

Please sign in to comment.