yyqxiaoyin 5 rokov pred
rodič
commit
b9a9de20e5

+ 6 - 1
MKRRadioManager/Classes/MKRRadioManager/MKRAVPlayer/MKRAVPlayer.m

@@ -220,7 +220,11 @@ NSURL * MKRUrlWithString(NSString *string){
                                                     name:nil
                                                   object:_playerItem];
     
-    [self.player removeObserver:self forKeyPath:@"rate"];
+    @try {
+        [self.player removeObserver:self forKeyPath:@"rate"];
+    } @catch (NSException *exception) {
+    } @finally {
+    }
     self.player = nil;
 }
 
@@ -241,6 +245,7 @@ NSURL * MKRUrlWithString(NSString *string){
     //注册通知
     [self registerNotification];
     if (self.playerItem) {
+        [self resetPlayer];
         self.player = [AVPlayer playerWithPlayerItem:self.playerItem];
     }else{
         self.playAsset = [AVURLAsset assetWithURL:self.playUrl];