Skip to content

Commit

Permalink
Release 3.3.8
Browse files Browse the repository at this point in the history
- 修复 在tableviewcell中播放时不响应tableview的上下滚动
- 修复 调用player stop后,进度条没有重置为0
  • Loading branch information
changsanjiang committed Jul 30, 2020
1 parent d28ca72 commit 4cbd814
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion SJBaseVideoPlayer.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'SJBaseVideoPlayer'
s.version = '3.3.7'
s.version = '3.3.8'
s.summary = 'video player.'
s.description = 'https://github.com/changsanjiang/SJBaseVideoPlayer/blob/master/README.md'
s.homepage = 'https://github.com/changsanjiang/SJBaseVideoPlayer'
Expand Down
12 changes: 11 additions & 1 deletion SJBaseVideoPlayer/Common/Implements/SJMediaPlaybackController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ - (void)cancel;
@interface SJMediaPlayerTimeObserverItem : NSObject
- (instancetype)initWithInterval:(NSTimeInterval)interval player:(__weak id<SJMediaPlayer>)player currentTimeDidChangeExeBlock:(nonnull void (^)(NSTimeInterval time))currentTimeDidChangeExeBlock playableDurationDidChangeExeBlock:(nonnull void (^)(NSTimeInterval time))playableDurationDidChangeExeBlock durationDidChangeExeBlock:(nonnull void (^)(NSTimeInterval time))durationDidChangeExeBlock;
- (void)invalidate;
- (void)stop;
@end

@implementation SJMediaPlayerTimeObserverItem {
Expand Down Expand Up @@ -96,6 +97,13 @@ - (void)resumeOrPause {
[NSRunLoop.mainRunLoop addTimer:_timer forMode:NSRunLoopCommonModes];
}
}

- (void)stop {
[self invalidate];
if ( _playableDurationDidChangeExeBlock ) _playableDurationDidChangeExeBlock(0);
if ( _currentTimeDidChangeExeBlock ) _currentTimeDidChangeExeBlock(0);
if ( _durationDidChangeExeBlock ) _durationDidChangeExeBlock(0);
}

- (void)_refresh {
NSTimeInterval currentTime = _player.currentTime;
Expand Down Expand Up @@ -248,11 +256,12 @@ - (void)stop {
[_definitionMediaPlayerLoader cancel];
_definitionMediaPlayerLoader = nil;
_definitionMedia = nil;
[self _removePeriodicTimeObserver];
[self.currentPlayerView removeFromSuperview];
_playerView.view = nil;
self.currentPlayer = nil;
_media = nil;
[_periodicTimeObserver stop];
[self _removePeriodicTimeObserver];
if ( self.timeControlStatus != SJPlaybackTimeControlStatusPaused )
self.timeControlStatus = SJPlaybackTimeControlStatusPaused;
}
Expand Down Expand Up @@ -545,6 +554,7 @@ - (void)_addPeriodicTimeObserver {
}

- (void)_removePeriodicTimeObserver {
[_periodicTimeObserver invalidate];
_periodicTimeObserver = nil;
}

Expand Down

0 comments on commit 4cbd814

Please sign in to comment.