瀏覽代碼

VLCMediaDataSource: Remove knowledge of MediaPlayer

Carola Nitz 7 年之前
父節點
當前提交
6cc452708a
共有 1 個文件被更改,包括 4 次插入6 次删除
  1. 4 6
      Sources/VLCMediaDataSource.m

+ 4 - 6
Sources/VLCMediaDataSource.m

@@ -237,12 +237,10 @@
 
     /* stop playback if needed */
     VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
-    if (vpc.isPlaying) {
-        MLFile *currentlyPlayingFile = [[MLFile fileForURL:vpc.mediaPlayer.media.url] firstObject];
-        if (currentlyPlayingFile) {
-            if (currentlyPlayingFile == mediaObject)
-                [vpc stopPlayback];
-        }
+    VLCMedia *media = [vpc currentlyPlayingMedia];
+    MLFile *currentlyPlayingFile = [MLFile fileForURL:media.url].firstObject;
+    if (currentlyPlayingFile && currentlyPlayingFile == mediaObject) {
+        [vpc stopPlayback];
     }
 
     NSFileManager *fileManager = [NSFileManager defaultManager];