|
@@ -159,13 +159,13 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
self.state = MKRAVPlayerStatePlaying;
|
|
|
}
|
|
|
}else if (self.state == MKRAVPlayerStateFinished){
|
|
|
- NSLog(@"播放完成");
|
|
|
+// NSLog(@"播放完成");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (void)playAtIndex:(NSInteger)index{
|
|
|
- NSLog(@"当前模式%zd 下标:%zd",self.playMode,index);
|
|
|
+// NSLog(@"当前模式%zd 下标:%zd",self.playMode,index);
|
|
|
if (self.playList && self.playList.count > index) {
|
|
|
self.currentIndex = index;
|
|
|
NSString *url = [self.playList objectAtIndex:index];
|
|
@@ -392,18 +392,18 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(playbackStalled)]) {
|
|
|
[self.delegate playbackStalled];
|
|
|
}
|
|
|
- NSLog(@"中断");
|
|
|
+// NSLog(@"中断");
|
|
|
}
|
|
|
|
|
|
- (void)playerItemFailedToPlayToEndTime:(NSNotification *)note{
|
|
|
- NSLog(@"失败e没结束");
|
|
|
+// NSLog(@"失败e没结束");
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didFailedToPlayToEndTime)]) {
|
|
|
[self.delegate didFailedToPlayToEndTime];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (void)failedToPlayToEndTimeError:(NSNotification *)note{
|
|
|
- NSLog(@"错误e没结束");
|
|
|
+// NSLog(@"错误e没结束");
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didFailedToPlayToEndTime)]) {
|
|
|
[self.delegate didFailedToPlayToEndTime];
|
|
|
}
|
|
@@ -539,11 +539,11 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
switch (status) {
|
|
|
case AVPlayerStatusUnknown:{
|
|
|
self.state = MKRAVPlayerStateBuffering;
|
|
|
- NSLog(@"AVPlayerStatusUnknown");
|
|
|
+// NSLog(@"AVPlayerStatusUnknown");
|
|
|
}
|
|
|
break;
|
|
|
case AVPlayerItemStatusReadyToPlay:{
|
|
|
- NSLog(@"AVPlayerItemStatusReadyToPlay");
|
|
|
+// NSLog(@"AVPlayerItemStatusReadyToPlay");
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didReadyToPlay)]) {
|
|
|
[self.delegate didReadyToPlay];
|
|
|
}
|
|
@@ -557,10 +557,10 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
}
|
|
|
break;
|
|
|
case AVPlayerItemStatusFailed:{
|
|
|
- NSLog(@"AVPlayerItemStatusFailed");
|
|
|
+// NSLog(@"AVPlayerItemStatusFailed");
|
|
|
self.state = MKRAVPlayerStateFaild;
|
|
|
NSError *error = [self.player.currentItem error];
|
|
|
- NSLog(@"视频加载失败===%@",error.description);
|
|
|
+// NSLog(@"视频加载失败===%@",error.description);
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didFailedToLoadURL:error:)]) {
|
|
|
[self.delegate didFailedToLoadURL:self.currentUrlString error:error];
|
|
|
}
|
|
@@ -588,21 +588,21 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
self.progress = timeInterval / totalDuration;
|
|
|
if (self.progress >= 0.0 && self.progress <= 1.0) {
|
|
|
if (self.progress == 0.0) {
|
|
|
- NSLog(@"开始缓冲");
|
|
|
+// NSLog(@"开始缓冲");
|
|
|
}else if (self.progress == 1.0){
|
|
|
- NSLog(@"缓冲完成");
|
|
|
+// NSLog(@"缓冲完成");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else if ([keyPath isEqualToString:@"playbackBufferEmpty"]){
|
|
|
- NSLog(@"playbackBufferEmpty %@",self.playerItem.playbackBufferEmpty?@"YES":@"NO");
|
|
|
+// NSLog(@"playbackBufferEmpty %@",self.playerItem.playbackBufferEmpty?@"YES":@"NO");
|
|
|
if (self.playerItem.playbackBufferEmpty) {
|
|
|
- NSLog(@"%s playbackBufferEmpty",__FUNCTION__);
|
|
|
+// NSLog(@"%s playbackBufferEmpty",__FUNCTION__);
|
|
|
[self loadedTimeRanges];
|
|
|
}
|
|
|
|
|
|
}else if ([keyPath isEqualToString:@"playbackLikelyToKeepUp"]){
|
|
|
- NSLog(@"playbackLikelyToKeepUp %@",self.playerItem.playbackLikelyToKeepUp ?@"YES":@"NO");
|
|
|
+// NSLog(@"playbackLikelyToKeepUp %@",self.playerItem.playbackLikelyToKeepUp ?@"YES":@"NO");
|
|
|
if (self.playerItem.playbackLikelyToKeepUp && self.state == MKRAVPlayerStateBuffering) {
|
|
|
if (self.state == MKRAVPlayerStateStopped || self.state == MKRAVPlayerStatePause) {
|
|
|
// [self.player play];
|
|
@@ -613,7 +613,7 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
}
|
|
|
}
|
|
|
}else if ([keyPath isEqualToString:@"rate"]){
|
|
|
- NSLog(@"播放速率改变 %f",self.player.rate);
|
|
|
+// NSLog(@"播放速率改变 %f",self.player.rate);
|
|
|
if (self.playerItem.playbackLikelyToKeepUp && self.state == MKRAVPlayerStatePlaying) {
|
|
|
if (!self.player.rate) {
|
|
|
_interruptWhenPlaying = YES;
|
|
@@ -632,10 +632,10 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
}
|
|
|
|
|
|
- (void)loadedTimeRanges{
|
|
|
- NSLog(@"缓冲区为空");
|
|
|
+// NSLog(@"缓冲区为空");
|
|
|
if (self.player.rate == 0 && !self.playerItem.playbackLikelyToKeepUp) {
|
|
|
if (_interruptWhenPlaying) {
|
|
|
- NSLog(@"网络状况导致卡顿");
|
|
|
+// NSLog(@"网络状况导致卡顿");
|
|
|
self.state = MKRAVPlayerStateBuffering;
|
|
|
}
|
|
|
}
|