|  | @@ -9,6 +9,7 @@
 | 
											
												
													
														|  |  #import <AVFoundation/AVFoundation.h>
 |  |  #import <AVFoundation/AVFoundation.h>
 | 
											
												
													
														|  |  #import <CloudAccompanyLibrary/AVPlayer+KSSeekSmoothly.h>
 |  |  #import <CloudAccompanyLibrary/AVPlayer+KSSeekSmoothly.h>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  @interface KSVideoPlayerView ()
 |  |  @interface KSVideoPlayerView ()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  @property (nonatomic, strong) AVPlayer *videoPlayer;
 |  |  @property (nonatomic, strong) AVPlayer *videoPlayer;
 | 
											
										
											
												
													
														|  | @@ -108,27 +109,19 @@
 | 
											
												
													
														|  |      }];
 |  |      }];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -- (void)resumePlay {
 |  | 
 | 
											
												
													
														|  | -    if (_isPlaying) {
 |  | 
 | 
											
												
													
														|  | -        [_videoPlayer pause];
 |  | 
 | 
											
												
													
														|  | -    }
 |  | 
 | 
											
												
													
														|  | -    _isPlaying = YES;
 |  | 
 | 
											
												
													
														|  | -    [self.videoPlayer play];
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  - (void)puasePlay {
 |  |  - (void)puasePlay {
 | 
											
												
													
														|  |      self.needResume = NO;
 |  |      self.needResume = NO;
 | 
											
												
													
														|  |      if (_isPlaying) {
 |  |      if (_isPlaying) {
 | 
											
												
													
														|  |          _isPlaying = NO;
 |  |          _isPlaying = NO;
 | 
											
												
													
														|  | -        [_videoPlayer pause];
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +    [_videoPlayer pause];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  - (void)freePlayer {
 |  |  - (void)freePlayer {
 | 
											
												
													
														|  |      if (_isPlaying) {
 |  |      if (_isPlaying) {
 | 
											
												
													
														|  |          _isPlaying = NO;
 |  |          _isPlaying = NO;
 | 
											
												
													
														|  | -        [_videoPlayer pause];
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +    [_videoPlayer pause];
 | 
											
												
													
														|  |      [self removeAllNoticeAndObserver];
 |  |      [self removeAllNoticeAndObserver];
 | 
											
												
													
														|  |      [self resetPlayer];
 |  |      [self resetPlayer];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -317,16 +310,13 @@
 | 
											
												
													
														|  |      [_currentItem removeObserver:self forKeyPath:@"loadedTimeRanges"];
 |  |      [_currentItem removeObserver:self forKeyPath:@"loadedTimeRanges"];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  #pragma mark----播放完成后发送通知
 |  |  #pragma mark----播放完成后发送通知
 | 
											
												
													
														|  | --(void)addPlayToEndObserver
 |  | 
 | 
											
												
													
														|  | -{
 |  | 
 | 
											
												
													
														|  | 
 |  | +- (void)addPlayToEndObserver {
 | 
											
												
													
														|  |      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playFinished:) name:AVPlayerItemDidPlayToEndTimeNotification object:_currentItem];
 |  |      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playFinished:) name:AVPlayerItemDidPlayToEndTimeNotification object:_currentItem];
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #pragma mark---通知的方法
 |  |  #pragma mark---通知的方法
 | 
											
												
													
														|  | --(void)playFinished:(NSNotification *)notice
 |  | 
 | 
											
												
													
														|  | -{
 |  | 
 | 
											
												
													
														|  | 
 |  | +-(void)playFinished:(NSNotification *)notice {
 | 
											
												
													
														|  |      //移除所有监听
 |  |      //移除所有监听
 | 
											
												
													
														|  | -    _isPlaying = NO;
 |  | 
 | 
											
												
													
														|  |      if ([self.delegate respondsToSelector:@selector(videoPlayerFinishedPlay:)]) {
 |  |      if ([self.delegate respondsToSelector:@selector(videoPlayerFinishedPlay:)]) {
 | 
											
												
													
														|  |          [self.delegate videoPlayerFinishedPlay:self.videoPlayer];
 |  |          [self.delegate videoPlayerFinishedPlay:self.videoPlayer];
 | 
											
												
													
														|  |      }
 |  |      }
 |