浏览代码

VLCPlaybackController: fix compilation for tvOS by making the trackrestoration iOS only

Carola Nitz 7 年之前
父节点
当前提交
1ebdff9a11
共有 1 个文件被更改,包括 14 次插入6 次删除
  1. 14 6
      Sources/VLCPlaybackController.m

+ 14 - 6
Sources/VLCPlaybackController.m

@@ -311,6 +311,17 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 }
 
 #if TARGET_OS_IOS
+
+- (void)restoreAudioAndSubtitleTrack
+{
+    MLFile *item = [MLFile fileForURL:_mediaPlayer.media.url].firstObject;
+
+    if (item) {
+        _mediaPlayer.currentAudioTrackIndex = item.lastAudioTrack.intValue;
+        _mediaPlayer.currentVideoSubTitleIndex = item.lastSubtitleTrack.intValue;
+    }
+}
+
 - (void)_savePlaybackState
 {
     @try {
@@ -743,12 +754,9 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
                 [_listPlayer.mediaList unlock];
         } break;
         case VLCMediaPlayerStateESAdded: {
-            MLFile *item = [MLFile fileForURL:_mediaPlayer.media.url].firstObject;
-
-            if (item) {
-                _mediaPlayer.currentAudioTrackIndex = item.lastAudioTrack.intValue;
-                _mediaPlayer.currentVideoSubTitleIndex = item.lastSubtitleTrack.intValue;
-            }
+#if TARGET_OS_IOS
+            [self restoreAudioAndSubtitleTrack];
+#endif
         } break;
         default:
             break;