|
@@ -44,6 +44,7 @@
|
|
|
@property (nonatomic, assign) NSInteger lastAudioIndex;//-1未记录
|
|
|
|
|
|
@property (nonatomic, strong) audioPlayListView *audioPlayListV;
|
|
|
+@property (nonatomic, assign) BOOL isAddListType;//添加歌曲
|
|
|
@end
|
|
|
|
|
|
@implementation audioPlayerViewController
|
|
@@ -98,8 +99,11 @@
|
|
|
|
|
|
_allAudioDataArray = [audioPlayListManager shareManager].audioPlayListArr;
|
|
|
_lastAudioIndex = -1;
|
|
|
- _index = [DFPlayer sharedPlayer].currentAudioModel.audioId;
|
|
|
- [self setTitleFunByIndex];
|
|
|
+ if(!_isAddListType){//添加歌曲进来 不用改
|
|
|
+ _index = [DFPlayer sharedPlayer].currentAudioModel.audioId;
|
|
|
+ [self setTitleFunByIndex];
|
|
|
+ }
|
|
|
+ _isAddListType = YES;
|
|
|
[self handleSomeUIFun];
|
|
|
}
|
|
|
|
|
@@ -682,10 +686,13 @@
|
|
|
#pragma mark 处理本地是否需要添加新加的的音乐
|
|
|
- (void)AddNewAudioToListFun
|
|
|
{
|
|
|
+ _isAddListType = YES;
|
|
|
+
|
|
|
[[DFPlayer sharedPlayer] df_reloadData];
|
|
|
|
|
|
KWeakSelf
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ weakSelf.audioPlayListV.playingIndex = weakSelf.index;
|
|
|
[weakSelf.audioPlayListV reGetDataFun];
|
|
|
});
|
|
|
}
|
|
@@ -831,7 +838,16 @@
|
|
|
#pragma mark - DFPlayer delegate
|
|
|
//加入播放队列
|
|
|
- (void)df_playerAudioAddToPlayQueue:(DFPlayer *)player{
|
|
|
-
|
|
|
+ _playPauseBtn.selected = YES;
|
|
|
+ NSInteger curPlayingindex = player.currentAudioModel.audioId;
|
|
|
+ if(curPlayingindex >= 0)
|
|
|
+ {
|
|
|
+ _lastAudioIndex = curPlayingindex;
|
|
|
+ _index = curPlayingindex;
|
|
|
+ [self setTitleFunByIndex];
|
|
|
+ [self startRotatingImage];
|
|
|
+ [self startPlayingRotateRightImage];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//缓冲进度代理
|
|
@@ -851,44 +867,49 @@
|
|
|
//播放进度代理
|
|
|
- (void)df_player:(DFPlayer *)player progress:(CGFloat)progress currentTime:(CGFloat)currentTime{
|
|
|
|
|
|
- NSInteger index = player.currentAudioModel.audioId;
|
|
|
- if(index >0 && index<_dataArray.count){
|
|
|
- lastFileModel *lastFileMod = _allAudioDataArray[index];
|
|
|
- //HLog(@"音频播放进度:%f --- %f --- %@ ---inddex:%ld ---- %ld",progress,currentTime,lastFileMod.name,_lastAudioIndex,index);
|
|
|
- }
|
|
|
- else{
|
|
|
- //HLog(@"音频播放进度:%f --- %f",progress,currentTime);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- playDelayed ++;
|
|
|
- if(!_playPauseBtn.selected && playDelayed >= 3){
|
|
|
- _playPauseBtn.selected = YES;
|
|
|
- }
|
|
|
-
|
|
|
- //HLog(@"df_player progress hxd _ind:%ld ---- %ld",_lastAudioIndex,player.currentAudioModel.audioId);
|
|
|
- if(_lastAudioIndex != player.currentAudioModel.audioId)
|
|
|
- {
|
|
|
- _lastAudioIndex = player.currentAudioModel.audioId;
|
|
|
- _index = _lastAudioIndex;
|
|
|
-// HLog(@"df_player progress hxd _ind:setTitleFunByIndex");
|
|
|
+// NSInteger index = player.currentAudioModel.audioId;
|
|
|
+// if(index >0 && index<_dataArray.count){
|
|
|
+// lastFileModel *lastFileMod = _allAudioDataArray[index];
|
|
|
+// //HLog(@"音频播放进度:%f --- %f --- %@ ---inddex:%ld ---- %ld",progress,currentTime,lastFileMod.name,_lastAudioIndex,index);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// //HLog(@"音频播放进度:%f --- %f",progress,currentTime);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// playDelayed ++;
|
|
|
+// if(!_playPauseBtn.selected && playDelayed >= 3){
|
|
|
+// _playPauseBtn.selected = YES;
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSInteger curPlayingindex = player.currentAudioModel.audioId;
|
|
|
+// //HLog(@"df_player progress hxd _ind:%ld ---- %ld",_lastAudioIndex,player.currentAudioModel.audioId);
|
|
|
+// if(_lastAudioIndex != curPlayingindex
|
|
|
+// && curPlayingindex >= 0 )
|
|
|
+// {
|
|
|
+// _lastAudioIndex = curPlayingindex;
|
|
|
+// _index = curPlayingindex;
|
|
|
+//// HLog(@"df_player progress hxd _ind:setTitleFunByIndex");
|
|
|
+//// [self setTitleFunByIndex];
|
|
|
+// //[self audioPlayerByIndex:_lastAudioIndex];
|
|
|
+//
|
|
|
+// [self startRotatingImage];
|
|
|
+// [self startPlayingRotateRightImage];
|
|
|
+// }
|
|
|
+//
|
|
|
+// //尝试强行修改 歌曲名 后续有时间优化
|
|
|
+// if(curPlayingindex >= 0){
|
|
|
+// _lastAudioIndex = curPlayingindex;
|
|
|
+// _index = curPlayingindex;
|
|
|
+// //HLog(@"df_player progress hxd _ind:setTitleFunByIndex");
|
|
|
// [self setTitleFunByIndex];
|
|
|
- //[self audioPlayerByIndex:_lastAudioIndex];
|
|
|
-
|
|
|
- [self startRotatingImage];
|
|
|
- [self startPlayingRotateRightImage];
|
|
|
- }
|
|
|
-
|
|
|
- //尝试强行修改 歌曲名 后续有时间优化
|
|
|
- _lastAudioIndex = player.currentAudioModel.audioId;
|
|
|
- _index = _lastAudioIndex;
|
|
|
- //HLog(@"df_player progress hxd _ind:setTitleFunByIndex");
|
|
|
- [self setTitleFunByIndex];
|
|
|
-
|
|
|
- if(progress >= 1.0){
|
|
|
- _lastAudioIndex = -1;
|
|
|
- [self stopRotatingImage];
|
|
|
- }
|
|
|
+// }
|
|
|
+//
|
|
|
+
|
|
|
+// if(progress >= 1.0){
|
|
|
+// _lastAudioIndex = -1;
|
|
|
+// [self stopRotatingImage];
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
//状态信息代理
|