Browse Source

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

Carola Nitz 7 years ago
parent
commit
1ebdff9a11
1 changed files with 14 additions and 6 deletions
  1. 14 6
      Sources/VLCPlaybackController.m

+ 14 - 6
Sources/VLCPlaybackController.m

@@ -311,6 +311,17 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 }
 }
 
 
 #if TARGET_OS_IOS
 #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
 - (void)_savePlaybackState
 {
 {
     @try {
     @try {
@@ -743,12 +754,9 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
                 [_listPlayer.mediaList unlock];
                 [_listPlayer.mediaList unlock];
         } break;
         } break;
         case VLCMediaPlayerStateESAdded: {
         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;
         } break;
         default:
         default:
             break;
             break;