urm9ril
urm9ril
if ([DFPlayerTool networkStatus] == DFPlayerNetworkStatusUnknown || [DFPlayerTool networkStatus] == DFPlayerNetworkStatusNotReachable){ if (cachePath){//有缓存,播放缓存 [self loadPlayerItemWithURL:[NSURL fileURLWithPath:cachePath]]; }else{//无缓存,提示联网 /// 这里有个逻辑漏洞, 前一个音频缓存完毕可以播放, 若此时断网, 则播放下一个音频的时候, 会播放第一个缓存完毕的音频 **[self loadPlayerItemWithURL:self.currentAudioModel.audioUrl];** [self df_getStatusCode:DFPlayerStatusNoNetwork]; } }
操作步骤如下: 1 - 使用DF播放一个MP3 2 - 切到后台, 使用其他播放器中断DF的播放 3 - 暂停其他播放器的播放, 回到DF的前台 大约 20s后才会执行到, NSLog(@"----------------------:结束打断"); 这里 - (void)df_playerAudioBeInterrupted:(NSNotification *)notification { NSInteger InterruptionType = [[notification.userInfo objectForKey:AVAudioSessionInterruptionTypeKey] integerValue]; switch (InterruptionType) { case...