|
@@ -231,8 +231,9 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(songPlayUrlWithIndex:completion:)]) {
|
|
|
__weak __typeof(self)weakSelf = self;
|
|
|
[self.delegate songPlayUrlWithIndex:self.currentIndex completion:^(NSString * _Nonnull resourceUrl) {
|
|
|
- weakSelf.playUrl = MKRUrlWithString(resourceUrl);
|
|
|
- [weakSelf createPlayerAndReadyToPlay];
|
|
|
+ __strong __typeof(weakSelf)strongSelf = weakSelf;
|
|
|
+ strongSelf.playUrl = MKRUrlWithString(resourceUrl);
|
|
|
+ [strongSelf createPlayerAndReadyToPlay];
|
|
|
}];
|
|
|
return;
|
|
|
}
|
|
@@ -240,7 +241,9 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
}
|
|
|
|
|
|
- (void)createPlayerAndReadyToPlay{
|
|
|
- self.isInitPlayer = YES;
|
|
|
+ if (self.isInitPlayer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
//注册通知
|
|
|
[self registerNotification];
|
|
|
if (self.playerItem) {
|
|
@@ -263,6 +266,7 @@ NSURL * MKRUrlWithString(NSString *string){
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
+ self.isInitPlayer = YES;
|
|
|
if (@available(iOS 10.0, *)) {
|
|
|
self.player.automaticallyWaitsToMinimizeStalling = NO;
|
|
|
}
|