Skip to content

Commit

Permalink
修复播放完毕监听失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
changsanjiang committed Mar 21, 2024
1 parent 87f73f9 commit 6047112
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Binary file not shown.
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.7.7'
s.version = '3.7.7.1'
s.summary = 'video player.'
s.description = 'https://github.com/changsanjiang/SJBaseVideoPlayer/blob/master/README.md'
s.homepage = 'https://github.com/changsanjiang/SJBaseVideoPlayer'
Expand Down
4 changes: 2 additions & 2 deletions SJBaseVideoPlayer/AVPlayer/Core/SJAVPlayerItemObservation.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ - (void)_registerObserver {
[_playerItem addObserver:self forKeyPath:kLoadedTimeRanges options:options context:&kLoadedTimeRanges];

__weak typeof(self) _self = self;
[NSNotificationCenter.defaultCenter addObserverForName:AVPlayerItemDidPlayToEndTimeNotification object:self queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
[NSNotificationCenter.defaultCenter addObserverForName:AVPlayerItemDidPlayToEndTimeNotification object:_playerItem queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull note) {
__strong typeof(_self) self = _self;
if ( self == nil ) return;
[self playerItemDidPlayToEndTime:note];
}];

[NSNotificationCenter.defaultCenter addObserverForName:AVPlayerItemNewAccessLogEntryNotification object:self queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[NSNotificationCenter.defaultCenter addObserverForName:AVPlayerItemNewAccessLogEntryNotification object:_playerItem queue:nil usingBlock:^(NSNotification * _Nonnull note) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
__strong typeof(_self) self = _self;
if ( self == nil ) return;
Expand Down

0 comments on commit 6047112

Please sign in to comment.